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 fps
number 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 end
number The end of the current frame, in milliseconds
start
number The start of the current frame, in milliseconds
texture
Texture<CanvasSource> Image data for the current frame
-
Default options for all GifSprite objects.
Properties:
Name Type Description animationSpeed
number Speed of the animation
autoPlay
boolean Whether to start playing right away
autoUpdate
boolean Set to
false
to manage updates yourselffps
number Fallback FPS if GIF contains no time information
loop
boolean To enable looping
onComplete
null | (() => void) The completed callback, optional
onFrameChange
null | ((currentFrame: number) => void) The frame callback, optional
onLoop
null | (() => void) The loop callback, optional
scaleMode
PIXI.SCALE_MODE Scale Mode to use for the texture
source
GifSource 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.