gifloop

play gif image by frame


License
MIT
Install
npm install gifloop@0.2.0

Documentation

gifloop

play gif image, gif decode base on gifuct-js

Examples

draw gif by canvas
draw gif by maptalks symbol system

Install

  • CDN
<script src="https://unpkg.com/gifloop/dist/gifloop.js"></script>
  • NPM
npm i gifloop
# or
yarn add gifloop

API

GIF class

constructor(options)

  • options
    • {Number} loopTime:default value is 70ms
    • {String} url:gif file url
import {
    GIF
} from 'gifloop';
const gif = new GIF({
    loopTime: 70,
    url: './people.gif'
});
gif.on('frame', function(frame) {
    //do somethings
});

//if you use cdn
const gif = new gifloop.GIF({
    loopTime: 70,
    url: './people.gif'
});

method

  • config(options) update options
gif.config({
    loopTime: 100
});
  • on(event, handler) Listen for events
gif.on('frame', function(frame) {
    //do somethings
});
  • off(event, handler) remove Listen for events
  • play()
  • pause()
  • isPlay()
   if (gif.isPlay()) {
       gif.pause();
   } else {
       gif.play();
   }
  • dispose()
gif.dispose();