Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.