Use a service like ezgif.com to create a sprite from your gif. Make sure you select "Stack horizontally".
yarn add sprite-gif
<div id="myGif" width="320" height="280"></div>
import SpriteGif from 'sprite-gif';
let gif = new SpriteGif(document.getElementById('myGif'), {
sprite: './sprite.png',
});
gif.play();
gif.pause();
gif.stop();
gif.setLoop(true);
gif.setSpeed(1);
gif.setFrameRate(30);
You can add some optional settings to the settings object:
default: true
default: true
default: 1
default: 30