Skip to content

Commit 386694c

Browse files
authored
Add play and reset imperative api (#19)
* Add play and reset imperative api * Remove unnecessary `play`
1 parent fc3aed5 commit 386694c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ class Animation extends PureComponent {
3232

3333
setAnimationDOMNode = ref => (this.animationDOMNode = ReactDOM.findDOMNode(ref));
3434

35+
play = (...frames) => {
36+
if (!this.anim) {
37+
return
38+
}
39+
40+
this.anim.playSegments(frames, true)
41+
}
42+
43+
reset = () => {
44+
if (!this.anim) {
45+
return
46+
}
47+
48+
this.anim.stop()
49+
}
50+
3551
render() {
3652
return <View style={this.props.style} ref={this.setAnimationDOMNode} />;
3753
}

0 commit comments

Comments
 (0)