Manual Ship

On this page
  1. Export a sprite
  2. Choose the formats
  3. Animation timing
  4. Frames straight from mode8 anim
  5. Preview GIFs
  6. The atlas JSON
  7. The pivot
  8. Export a project asset again
  9. Pitfalls
  10. Next

Exporting

Turn animation frames into a packed atlas, Godot resources, preview GIFs and any engine's own format with one command.

mode8 export takes a folder of frames and writes what a game engine loads: one atlas PNG with its JSON, Godot 4 SpriteFrames, a preview GIF per animation, and on request the files of PixiJS, Phaser 3, LÖVE, Unity, CSS sprites or an indexed PNG. The frames keep their animation timing and share one pivot at the feet, in every format.

The examples on this page export the hero of a starter project. Make one to follow along:

bash
mode8 init my-game --template platformer
cd my-game

Export a sprite#

Point mode8 export at the frames, and at the asset's sidecar for the timing:

terminal
$ mode8 export assets/hero/frames --out-dir exports/hero --name hero --animations assets/hero/master.m8.json
✓ Exported hero (15 frames) → exports/hero/
  atlas, godot, gif · 9 files
  animations attack, hurt, idle, jump, walk
  preview exports/hero/hero.gif + one GIF per animation (5)
    Godot exports/hero/hero.tres
  palette nes_master_gothic from mode8.toml

Next:
  mode8 verify --assets-dir exports/hero

Without --formats you get the three core formats:

FormatFilesWhat it is
atlashero_atlas.png, hero_atlas.jsonEvery frame packed into one PNG, and JSON with each frame's rectangle, its duration and the animations
godothero.tresA Godot 4 SpriteFrames resource over the atlas, one animation per name, crisp in any project
gifhero.gif, hero_<animation>.gifA preview of each animation at its own speed, and hero.gif for the idle loop
The hero's atlas: every frame of the platformer knight, packed animation by animation with a 1 px gap
hero_atlas.png at 2x
The hero's walk preview GIF
hero_walk.gif, at the walk's own speed

The --name is the stem of every file, so exports of several sprites can share one folder.

Choose the formats#

--formats takes a comma-separated list. Ask for the engine you use; the atlas comes with every engine format:

terminal
$ mode8 export assets/hero/frames --out-dir exports/web --name hero --formats pixi,phaser --animations assets/hero/master.m8.json
✓ Exported hero (15 frames) → exports/web/
  pixi, phaser · 5 files
  animations attack, hurt, idle, jump, walk
  palette nes_master_gothic from mode8.toml

Next:
  mode8 verify --assets-dir exports/web
FormatGroupWritesPage
atlascore<name>_atlas.png, <name>_atlas.jsonthis page
gifcore<name>.gif, <name>_<animation>.gifthis page
godotGodot<name>.tres (SpriteFrames)Godot
godot_sceneGodot<name>.tscn, mode8_actor.gdGodot
normalGodot<name>_atlas_n.png, <name>_lit.tres, <name>_lit_frames.tresLighting
emissionGodot<name>_atlas_e.png, <name>_emission.gdshader, <name>_emission.tresLighting
pixiengine<name>_pixi.jsonPixiJS
phaserengine<name>_phaser_atlas.json, <name>_phaser_anims.jsonPhaser
love2dengine<name>.luaLÖVE
unityengine, experimental<name>_atlas.png.metaUnity
cssengine<name>.css, <name>_demo.htmlOther formats
indexedengine<name>_indexed.png, <name>.hexOther formats

mode8 schema --section formats lists the same formats with their stability, for scripts.

Animation timing#

Each animation has its own speed (fps) and either loops or plays once. Every export format carries that timing, so it has to come from somewhere. Mode 8 looks in this order:

  1. --animations FILE. A project asset's sidecar (assets/<name>/master.m8.json) holds the timing the Studio and the rig recorded. A plain JSON file of {"walk": {"frames": [...], "fps": 8, "loop": true}} works too.
  2. A timing sidecar next to the frames. mode8 anim writes <prefix>.anim.json beside its frames, and export reads it on its own.
  3. The frame names. walk_0 to walk_3 become walk, windup and attack become one attack, idle plays at half speed, and one-shot poses such as jump, attack and hurt do not loop. --fps (default 8) sets the speed of every animation found this way.

The rig's attack runs at 10 fps. Without the sidecar, the names alone give it the default 8 fps:

terminal
$ mode8 export assets/hero/frames --out-dir exports/guessed --name hero --formats atlas
✓ Exported hero (15 frames) → exports/guessed/
  atlas · 2 files
  animations attack, hurt, idle, jump, walk
  palette nes_master_gothic from mode8.toml

Next:
  mode8 verify --assets-dir exports/guessed
$ sed -n '/"animations"/,/"hurt"/p' exports/guessed/hero_atlas.json
  "animations": {
    "attack": {
      "frames": [
        "windup",
        "attack",
        "recover"
      ],
      "fps": 8,
      "loop": false
    },
    "hurt": {

The animations key of hero_atlas.json (and of the --json report) shows the timing every format used.

Frames straight from mode8 anim#

mode8 anim names its frames <prefix>_<frame>.png, and the prefix defaults to the master's file name. Give it the sprite's name, so the export's animations are called walk rather than master_walk:

terminal
$ mode8 anim assets/hero/master.png --rig humanoid --out-dir frames/hero --prefix hero
✓ Animated 15 frames → frames/hero/
  idle 4, walk 6, jump 1, attack 3, hurt 1  rig humanoid

Next:
  mode8 export frames/hero --out-dir exports/hero --name hero
  mode8 verify --assets-dir frames/hero --check-anim --include-root
$ mode8 export frames/hero --out-dir exports/from-anim --name hero
✓ Exported hero (15 frames) → exports/from-anim/
  atlas, godot, gif · 9 files
  animations idle, walk, jump, attack, hurt
  preview exports/from-anim/hero.gif + one GIF per animation (5)
    Godot exports/from-anim/hero.tres
  palette nes_master_gothic from mode8.toml

Next:
  mode8 verify --assets-dir exports/from-anim

The export strips the hero_ from each file name and finds hero.anim.json by itself, so the attack keeps its 10 fps with no --animations.

Preview GIFs#

hero_<animation>.gif plays one animation at its own speed and hero.gif repeats the idle loop (else the first looping animation). Two options shape them:

  • --gif-scale N enlarges every pixel N times (1 to 16, default 4).
  • --gif-transparent keeps the sprite's transparency; by default the GIF has a solid backdrop, which reads better in chat apps and issue trackers.
terminal
$ mode8 export assets/hero/frames --out-dir exports/previews --name hero --formats gif --gif-scale 2 --gif-transparent --animations assets/hero/master.m8.json
✓ Exported hero (15 frames) → exports/previews/
  gif · 6 files
  animations attack, hurt, idle, jump, walk
  preview exports/previews/hero.gif + one GIF per animation (5)
  palette nes_master_gothic from mode8.toml

Next:
  mode8 verify --assets-dir exports/previews

The atlas JSON#

hero_atlas.json uses the TexturePacker "JSON hash" layout, which most engines and tools read, with three additions: each frame's duration in milliseconds, an animations map with the timing, and Aseprite-style meta.frameTags, one per animation. Frames are packed animation by animation, so each animation is one run of frames:

terminal
$ head -24 exports/hero/hero_atlas.json
{
  "frames": {
    "windup": {
      "frame": {
        "x": 1,
        "y": 1,
        "w": 64,
        "h": 72
      },
      "rotated": false,
      "trimmed": false,
      "spriteSourceSize": {
Show 12 more lines
        "x": 0,
        "y": 0,
        "w": 64,
        "h": 72
      },
      "sourceSize": {
        "w": 64,
        "h": 72
      },
      "duration": 250
    },
    "attack": {

--padding PX sets the transparent gap around each frame (0 to 64, default 1). The gap keeps neighbors from bleeding in when an engine filters or scales the texture.

The pivot#

Every format shares one pivot: the point between the feet of the idle frame (else the first frame), measured on the art. Godot scenes offset the sprite by it, PixiJS and Phaser frames carry it as an anchor, Unity as a custom pivot, LÖVE as pivot. Frames are never trimmed, so a character stands on the same spot in every frame and every engine.

Export a project asset again#

After you paint on the hero in the Studio, or run its rig again, export it the same way. The command the starter suggests writes straight into its Godot project:

terminal
$ mode8 export assets/hero/frames --out-dir godot/art/hero --name hero --formats godot,godot_scene --animations assets/hero/master.m8.json
✓ Exported hero (15 frames) → godot/art/hero/
  godot, godot_scene · 4 files
  animations attack, hurt, idle, jump, walk
  Godot godot/art/hero/hero.tres
  scene godot/art/hero/hero.tscn (CharacterBody2D, mode8_actor.gd)
  palette nes_master_gothic from mode8.toml

Next:
  mode8 verify --assets-dir godot/art/hero

Exporting overwrites the files it writes and nothing else, so it is safe to run as often as you like. mode8 verify --assets-dir godot/art/hero checks the result; see Checks.

Pitfalls#

  • Wrong animation names. If the animations come out as master_walk, the frames carry a prefix the export did not strip. Use the same --name as the frames' prefix, or mode8 anim --prefix.
  • One frame per animation. A folder of loose PNGs with no numbering and no timing gives one animation per file. Name walk frames walk_0, walk_1 and so on, or pass --animations.
  • The export folder is not the source. Edit the frames or the project asset, then export again. An edit to hero_atlas.png is lost on the next export.

Next#

  • Godot: SpriteFrames, a playable scene with gameplay boxes, TileSets and themes.
  • Lighting: normal and emission maps for 2D lights.
  • Checks: lint the frames and verify the export.
  • Export formats reference: every file and key.