i have sequenced animation started button a, how can stop animation button b?thank you
store animation in state variable , call start or stop when click button:
constructor() { super(props); var my_animation = ... // define 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()} /> } for more info on start , stop see https://facebook.github.io/react-native/docs/animations.html
Comments
Post a Comment