Example
import { Assets } from 'pixi.js';
import { GifSprite } from 'pixi.js/gif';
const source = await Assets.load('example.gif');
const gif = new GifSprite({ source });
Classes
Interface Definitions
-
Options when constructing from buffer
Properties:
Name Type Description fpsnumber FPS to use when the GIF animation doesn't define any delay between frames
-
Represents a single frame of a GIF. Includes image and timing data.
Properties:
Name Type Description endnumber The end of the current frame, in milliseconds
startnumber The start of the current frame, in milliseconds
textureTexture<CanvasSource> Image data for the current frame
-
Default options for all GifSprite objects.
Properties:
Name Type Description animationSpeednumber Speed of the animation
autoPlayboolean Whether to start playing right away
autoUpdateboolean Set to
falseto manage updates yourselffpsnumber Fallback FPS if GIF contains no time information
loopboolean To enable looping
onCompletenull | (() => void) The completed callback, optional
onFrameChangenull | ((currentFrame: number) => void) The frame callback, optional
onLoopnull | (() => void) The loop callback, optional
scaleModePIXI.SCALE_MODE Scale Mode to use for the texture
sourceGifSource Source to the GIF frame and animation data
Members
Handle the loading of GIF images. Registering this loader plugin will
load all .gif images as an ArrayBuffer and transform into an
GifSource object.