Skip to content

Commit a3f652b

Browse files
committed
chore: add docs on how to animate transform properties
1 parent efe4169 commit a3f652b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

apps/docs/docs/animations/reanimated3.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ React Native Skia offers integration with [Reanimated v3 and above](https://docs
99

1010
React Native Skia supports the direct usage of Reanimated's shared and derived values as properties. There is no need for functions like `createAnimatedComponent` or `useAnimatedProps`; simply pass the Reanimated values directly as properties.
1111

12+
**Note:** For animating `transform` properties, pass the entire transform object instead of individual properties. See section below for details.
13+
1214
```tsx twoslash
1315
import {useEffect} from "react";
1416
import {Canvas, Circle, Group} from "@shopify/react-native-skia";
@@ -113,3 +115,22 @@ export const AnimatedGradient = () => {
113115
);
114116
};
115117
```
118+
119+
## Animating Transforms
120+
121+
For animating `transform` properties, create a derived value that returns the array of transforms with each property as a separate object. Passing reanimated values directly will not work.
122+
123+
```tsx
124+
const transform = useDerivedValue(() => {
125+
return [
126+
{ rotate: rotation.value },
127+
{ scale: scale.value }
128+
];
129+
});
130+
131+
return (
132+
<Canvas>
133+
<Group transform={transform}>...</Group>
134+
</Canvas>
135+
);
136+
```

0 commit comments

Comments
 (0)