0.1.2 • Published 2 years ago

react-sprite-animation v0.1.2

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

React Sprite Animation

To create animation from the image sprite.

Install

npm i react-sprite-animation -S
# or
yarn add react-sprite-animation

React is used with this library but do not come bundled with this library. Please make sure you have those installed before using.

Usage

Include library, and call sprite and pass spriteImg source and frames (the number of in sprite)

The component

import { Sprite } from 'react-sprite-animation';
...
      <Sprite
        spriteImg={
          'https://miro.medium.com/max/1400/1*GJ6ZL0eX8tJE54ZYFSnI9Q.png'
        }
        frames={8}
      />

Props

This are the props of the component.

  • spriteImg {string} - path to sprite
  • frames {number} - manually sets current frame
  • className {string} - to add class to sprite container