如何修复冻结的动画?

时间:2019-04-02 00:52:43

标签: react-native expo

我有一个简单的Animated.spring。由于某些原因无法正常工作。它从动画的中间开始。图片就在这里。 [https://www.reddit.com/r/reactnative/comments/b89vcg/does_anyone_know_how_to_fix_this_im_using_a]

`upAnim = new Animated.Value(60);


Animated.spring(this.upAnim, {
  toValue: nearbyHeight,
  timing: 500,
  friction: 7
}).start();`

1 个答案:

答案 0 :(得分:1)

如果要使用计时,请使用具有timing属性的duration函数。 spring使用默认计时。这是docs。确保在制作中使用useNativeDriver: true,以便动画在真实设备上流畅运行,而不是在速度较慢的javascript线程上流畅运行。

Animated.timing(this.upAnim, {
  toValue: nearbyHeight,
  duration: 500,
  friction: 7
}).start();