Phaser
Export a sprite as a Phaser 3 texture atlas plus animation JSON, with each frame's origin at the feet.
The phaser format writes what Phaser 3 loads in two lines: a texture atlas whose frames carry their pivot at the feet, and an animation file for the Animation Manager with every animation's speed and loop setting.

Export#
Make a starter project to follow along, then export its hero:
mode8 init my-game --template platformer
cd my-game$ mode8 export assets/hero/frames --out-dir web/assets --name hero --formats phaser --animations assets/hero/master.m8.json
✓ Exported hero (15 frames) → web/assets/
phaser · 4 files
animations attack, hurt, idle, jump, walk
palette nes_master_gothic from mode8.toml
Next:
mode8 verify --assets-dir web/assetsNext to the atlas PNG you get:
hero_phaser_atlas.json, a "JSON hash" texture atlas in which each frame has ananchorat the feet. Phaser turns it into the frame's pivot, so a sprite stands on its feet instead of on its center.hero_phaser_anims.json, the animations in Phaser's Animation Manager format: one key per animation, named<name>_<animation>, its frame rate, andrepeat: -1for a loop or0for a one-shot.
$ python3 -c "import json; print(json.load(open('web/assets/hero_phaser_anims.json'))['anims'][0])"
{'key': 'hero_attack', 'type': 'frame', 'frames': [{'key': 'hero', 'frame': 'windup', 'duration': 125}, {'key': 'hero', 'frame': 'attack'}, {'key': 'hero', 'frame': 'recover', 'duration': 125}], 'frameRate': 8, 'repeat': 0}The plain hero_atlas.json is written too, unchanged, for tools that read the shared atlas layout.
Play it#
class Play extends Phaser.Scene {
preload() {
this.load.atlas("hero", "assets/hero_atlas.png", "assets/hero_phaser_atlas.json");
this.load.animation("hero_anims", "assets/hero_phaser_anims.json");
}
create() {
this.add.sprite(240, 220, "hero").setScale(2).play("hero_walk");
}
}
new Phaser.Game({ type: Phaser.AUTO, width: 480, height: 270, pixelArt: true, scene: Play });The texture key is the export's --name, so it must match the first argument of load.atlas. pixelArt: true turns on nearest filtering and pixel rounding for the whole game. A one-shot animation such as hero_attack plays once and stops on its last frame; listen for the sprite's animationcomplete event to go back to hero_idle.
Several sprites#
Each sprite gets its own --name, its own texture key and its own animation keys, so a whole cast shares one folder:
$ mode8 export assets/slime/master.png --out-dir web/assets --name slime --formats phaser
✓ Exported slime (1 frame) → web/assets/
phaser · 4 files
animations master
palette nes_master_gothic from mode8.toml
Next:
mode8 verify --assets-dir web/assetsPitfalls#
- The sprite stands on its center. Load
hero_phaser_atlas.json, nothero_atlas.json: only the Phaser file carries the pivots. - "Missing animation" means the key differs: animations are called
<name>_<animation>, such ashero_walk. - Blurry sprites. Set
pixelArt: truein the game config, and scale by whole numbers.
Next#
- PixiJS and LÖVE: the same sprite in other engines.
- Exporting: timing, the pivot and the atlas JSON.
- Engine formats reference: every key of both files.