Namespace: gif

gif

Optional module to import to decode and play animated GIFs.

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

GifSource
GifSprite

Interface Definitions

GifBufferOptions

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

GifFrame

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

GifSpriteOptions

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 yourself

fps 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

GifAsset readonly

Handle the loading of GIF images. Registering this loader plugin will load all .gif images as an ArrayBuffer and transform into an GifSource object.