我已经使用Animated.timing()
在react-native中创建了一个动画,我想在其中中途开始动画。有没有办法像css中的this那样对延迟应用负值?我的示例代码如下所示:
Animated.timing(this.state.animatedVal, {
toValue: 100,
duration: 500,
easing: Easing.inOut(Easing.ease),
delay: 200,
}).start()
发布于 2017-01-30 22:54:25
据我所知,负延迟不是...但是,可以在开始动画之前对动画值使用setValue
以获得相同的效果。这真的取决于你的动画值的用例,因为它可能会导致动画的突然跳跃,但既然你想在中途启动它,这应该是可行的,例如:
this.state.animatedVal.setValue(50);
Animated.timing(this.state.animatedVal, {
toValue: 100,
duration: 250, // the portion of the time of the full animation
easing: Easing.inOut(Easing.ease),
}).start()
https://stackoverflow.com/questions/41757843
复制相似问题