0
我有按钮A开始了有序的动画,我怎么能停止按钮B动画?谢谢停止序列化动画阵营本地
我有按钮A开始了有序的动画,我怎么能停止按钮B动画?谢谢停止序列化动画阵营本地
存储你的动画中的状态变量,并调用start
或stop
当你点击一个按钮:
constructor() {
super(props);
var my_animation = ... // define your animation here
this.state = {
my_animation: my_animation;
}
}
startAnimation() {
this.state.my_animation.start();
}
stopAnimation() {
this.state.my_animation.stop();
}
render() {
<Button onPress={() => this.startAnimation()} />
<Button onPress={() => this.stopAnimation()} />
}
欲了解更多信息有关start
和stop
看到https://facebook.github.io/react-native/docs/animations.html
很抱歉不能使问题清楚,其实我是想通过启动按钮A动画和停止,但吨B –
@GerardTaub看到更新 – FuzzyTree
thx @FuzzyTree,在这里提出了一个示例,但没有按预期工作:( https://rnplay.org/apps/PozUMg –