0.2.3 • Published 11 months ago

pi3r-gif2sprite v0.2.3

Weekly downloads
-
License
-
Repository
github
Last release
11 months ago

Gif2Sprite

Convert a gif (animated or not) to data image sprite or data images array (including inter-frame coalescing)

yarn add pi3r-gif2sprite

Sprite

import { gif2Sprite } from 'gif2sprite';

const gifUrl = 'GifUrl';
const mySpriteData = await gif2Sprite(gifUrl);

The function gif2Sprite(url :string) return a Promise<G2Sprite> :

interface G2Sprite {
  animated: boolean,      //the gif is an animated gif or not
  width: number,          //the width of the frames
  height: number,         //the height of the frames
  spriteData: string,     //the base64 sprite image
  delayArray?: number[]   //the delay of each frames (if the gif is an animated gif)
}

Images array

import { gif2ImgArray } from 'gif2sprite';

const gifUrl = 'GifUrl';
const mySpriteData = await gif2ImgArray(gifUrl);

The function gif2ImgArray(url :string) return a Promise<G2ImgArray> :

interface G2ImgArray {
  animated: boolean,      //the gif is an animated gif or not
  width: number,          //the width of the frames
  height: number,         //the height of the frames
  imgArray: string[],     //the base64 images array
  delayArray?: number[]   //the delay of each frames (if the gif is an animated gif)
}
0.2.3

11 months ago

0.2.2

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago