name: pixijs-scene-gif description: "Use for PixiJS v8 animated GIFs: pixi.js/gif import, Assets.load to GifSource, GifSprite playback, autoPlay/loop, currentFrame, animationSpeed, callbacks, clone/destroy." license: MIT
Use this for displaying animated GIF assets as PixiJS sprites.
Fast Path
import 'pixi.js/gif';
import { Assets, GifSprite } from 'pixi.js';
const source = await Assets.load('loader.gif');
app.stage.addChild(new GifSprite({ source, autoPlay: true }));
Rules
- Import
pixi.js/gifbefore loading GIF assets. Assets.loadreturns aGifSource; pass it toGifSprite.- Use
play,stop,currentFrame,animationSpeed,loop, and callbacks for playback control. - Share a
GifSourcewhen multiple sprites use the same GIF. GifSpriteextendsSprite; it is a leaf and should be grouped in aContainerwhen needed.
Deep Reads
- Full GIF options and lifecycle: references/details.md
- Spritesheet animation alternative:
pixijs-scene-sprite - Asset cache/unload:
pixijs-assets
Common Fixes
- GIF loads as a normal texture: import the GIF extension first.
- Need per-frame spritesheet control: use
AnimatedSpriteinstead. - Memory grows after GIF removal: destroy sprites and unload unused assets.