Created
July 24, 2018 02:38
-
-
Save pavelvlasov/85555cadaa7c7df7f7622fef56d005df to your computer and use it in GitHub Desktop.
Sprite animate function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { state } = this.state; | |
const { framesPerStep, states } = this.props; | |
if (this.tick === framesPerStep) { | |
this.tick = 0; | |
this.setState({ | |
state: (state + 1) % states | |
}); | |
} | |
this.tick += 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment