Skip to content

Commit 888573a

Browse files
Fixes support for looping
1 parent 6ac4480 commit 888573a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/keyframes.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,14 @@ export default class Keyframes extends React.Component {
7474
requestNextFrame () {
7575
this.waitForDelay(() => {
7676
const frameNum = this.state.frameNum + 1;
77-
const loopNum = this.state.loopNum + 1;
7877
if (this.props.children.length <= frameNum) {
79-
if (this.props.loop === true || this.props.loop === 'infinite' || loopNum < this.props.loop) {
78+
if (this.props.loop === true || this.props.loop === 'infinite' || this.state.loopNum < this.props.loop) {
8079
this.setState({
8180
frameNum: 0,
82-
loopNum
81+
loopNum: this.state.loopNum + 1
8382
});
83+
this.requestNextFrame();
84+
return;
8485
} else {
8586
this.props.onEnd();
8687
return;

0 commit comments

Comments
 (0)