Export a JSON hash atlas
Choose Phaser · PNG + JSON hash after cleaning your frames. Unzip sprite-sheet.png and atlas.json into your game's public assets directory. The JSON describes actual atlas rectangles, so you do not need to guess the source grid.
Load and animate
This is the standard Phaser atlas workflow. Replace the paths and coordinates for your project:
preload() {
this.load.atlas('robot', '/assets/sprite-sheet.png', '/assets/atlas.json');
}
create() {
const names = Object.keys(this.textures.get('robot').frames)
.filter(name => name !== '__BASE');
// Use the JSON frame order or list the exact exported names explicitly.
this.anims.create({
key: 'walk',
frames: names.map(frame => ({ key: 'robot', frame })),
frameRate: 10,
repeat: -1
});
this.add.sprite(160, 160, 'robot', names[0]).play('walk');
}
Frame names are frame-000.png, frame-001.png and so on. Reordering keeps names attached to their original artwork, so do not sort the names if you want your edited order. A more explicit option is to read Object.keys(atlas.frames) in the exported JSON and pass those names to your animation.
Variable timing
The atlas includes a duration field in milliseconds. Do not assume your Phaser animation builder will apply this automatically. If you imported a GIF with variable delays, read these durations and configure animation frame timing in your game. The fixed frameRate: 10 example intentionally uses uniform timing.
Filtering and padding
Use pixel-art or nearest-neighbor rendering for crisp pixels. Keep transparent padding between cells. The output uses equal cells and does not rotate frames or extrude borders. For downscaled scenes with mipmaps, test texture edges in your actual renderer; padding alone is not a guarantee against every mip level.
PixiJS alternative
Choose PixiJS · PNG + JSON hash. Load the JSON with PixiJS Assets and use the named textures from its parsed spritesheet. The animations.default list preserves your edited frame order. For example:
const sheet = await Assets.load('/assets/atlas.json');
const walk = new AnimatedSprite(sheet.animations.default);
walk.animationSpeed = 10 / 60;
walk.play();
app.stage.addChild(walk);
Import Assets and AnimatedSprite from your project's PixiJS package. This example uses uniform 10 FPS; apply variable timing yourself if needed. Check the PixiJS version your project uses; this export provides texture rectangles, not a running game project or an animation state machine.
Reference
Phaser TextureManager atlas documentation documents the JSON hash atlas shape. See your project's Phaser version for animation-specific timing behavior.