A React component that animates simple spritesheets
ISC License
This is a component that animates through an image sprite.
npm i react-sprite-animator -S
# or
yarn add react-sprite-animator
React is used with this library but do not come bundled with this library. Please make sure you have those installed before using.
You are able to use this library as a component or as a hook.
import { SpriteAnimator } from 'react-sprite-animator'
...
<SpriteAnimator
sprite="/path-to/sprite.svg"
width={100}
height={100}
/>
import { useSprite } from 'react-sprite-animator'
const MyComponent = () => {
const styles = useSprite({
sprite: '/path-to/sprite.svg',
width: 100,
height: 100,
})
return <div style={style} />
}
This is the same for the hooks options and the props of the component.
Only required for two-dimensional sprites