react-native-reanimated 不接受以度为单位的旋转值

vik*_*iki 3 react-native react-native-reanimated

我正在学习 reanimated,因为它在 UI 线程上工作,并且我想实现旋转动画。以度数旋转(如 45 度)不起作用并提示错误。那么如何在react-native-reanimation v1(version 1)中实现旋转动画呢?

Ali*_*sei 7

也许您需要concat复活库中的函数:

import Animated, { concat } from 'react-native-reanimated';
...
return (
  <Animated.View style={{
    transform: [{rotateZ: concat(yourAnimatedValue, 'deg')}],
  }}/>
);
Run Code Online (Sandbox Code Playgroud)