Skip to content

Instantly share code, notes, and snippets.

@pavelvlasov
Created July 24, 2018 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavelvlasov/592a00692c39c66b7317e899de968177 to your computer and use it in GitHub Desktop.
Save pavelvlasov/592a00692c39c66b7317e899de968177 to your computer and use it in GitHub Desktop.
Sprite component
class Sprite extends React.Component {
static defaultProps = {
src: PropTypes.string.isRequired,
tile: PropTypes.object.isRequired,
scale: PropTypes.number.isRequired
};
tick = 0;
frame: number = 0;
state = {
state: 0
};
componentDidMount() {
this.animate();
}
componentWillUnmount() {
cancelAnimationFrame(this.frame);
}
animate = () => {
// TODO: implement
}
render() {
const { src, tile, scale } = this.props;
const { state } = this.state;
return <Tile src={src} state={state} tile={tile} scale={scale} />;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment