Skip to content

Commit

Permalink
docs(reactive-transform): add new docs page
Browse files Browse the repository at this point in the history
  • Loading branch information
Tahul committed Apr 2, 2022
1 parent 4188472 commit 6d6140a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions docs/api/reactive-transform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# reactiveTransform

reactiveTransform is an helper function creating a reactive object compatible with an HTML `style` attribute.

## Parameters

### `props`

Default [**TransformProperties**](https://github.com/vueuse/motion/tree/main/src/types/variants.ts#L21) object to create the reactive one from.

## Exposed

### `state`

The reactive [**TransformProperties**](https://github.com/vueuse/motion/tree/main/src/types/variants.ts#L21) object to manipulate.

### `style`

A reactive [**transform attribute**](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) compatible string.

#### Example

```vue
<template>
<div :style="{transform}" @click="shift" />
</template>
<script setup>
const { state, transform } = reactiveTransform({
x: 100,
y: 25,
rotate: 25,
})
const shift = () => {
state.x += 100
}
</script>
```

0 comments on commit 6d6140a

Please sign in to comment.