litiengine icon indicating copy to clipboard operation
litiengine copied to clipboard

Support Aseprite export format (.json) for animations

Open steffen-wilke opened this issue 4 years ago • 3 comments

Format Documentation:_ https://www.aseprite.org/docs/cli/#filename-format

Aseprite provides a JSON based export format for animation data. It would be great if the engine could support importing this format. Maybe even an export could be useful.

gurke-idle-right-sheet.png

Example JSON for: "gurke-idle-right-sheet.png"

{ "frames": {
   "gurke-idle-right 0.png": {
    "frame": { "x": 0, "y": 0, "w": 40, "h": 40 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 40, "h": 40 },
    "sourceSize": { "w": 40, "h": 40 },
    "duration": 120
   },
   "gurke-idle-right 1.png": {
    "frame": { "x": 40, "y": 0, "w": 40, "h": 40 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 40, "h": 40 },
    "sourceSize": { "w": 40, "h": 40 },
    "duration": 120
   },
   "gurke-idle-right 2.png": {
    "frame": { "x": 80, "y": 0, "w": 40, "h": 40 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 40, "h": 40 },
    "sourceSize": { "w": 40, "h": 40 },
    "duration": 120
   }
 },
 "meta": {
  "app": "http://www.aseprite.org/",
  "version": "1.2.16.3-x64",
  "image": "gurke-idle-right-sheet.png",
  "format": "RGBA8888",
  "size": { "w": 120, "h": 40 },
  "scale": "1",
  "frameTags": [
  ],
  "layers": [
   { "name": "Layer", "opacity": 255, "blendMode": "normal" }
  ],
  "slices": [
  ]
 }
}

steffen-wilke avatar Mar 15 '20 09:03 steffen-wilke

I'm working in a group with @DD2480-Group-11 and we were interested in working on this. The project doesn't seem to be using any JSON libraries, would json-simple work? Also, what files would require integration (importing from toolbar etc.)?

danhalv avatar Mar 03 '21 11:03 danhalv

I would recommend gson https://github.com/google/gson

Gamebuster19901 avatar Mar 03 '21 18:03 Gamebuster19901

I think this requires Animation to become a Resource.

Currently, you can export a spritesheet, but that's not the same as exporting an animation, as a spritesheet can have multiple animations.

Gamebuster19901 avatar Mar 21 '21 09:03 Gamebuster19901