A MoonBit pipeline for Aseprite JSON sprite animation assets.
moon check
moon test
moon run cmd/main///|
test {
let json =
#|{
#| "frames": [{
#| "filename": "hero_idle_0",
#| "frame": {"x": 0, "y": 0, "w": 16, "h": 24},
#| "rotated": false,
#| "trimmed": false,
#| "spriteSourceSize": {"x": 0, "y": 0, "w": 16, "h": 24},
#| "sourceSize": {"w": 16, "h": 24},
#| "duration": 100
#| }],
#| "meta": {
#| "image": "hero.png",
#| "size": {"w": 16, "h": 24},
#| "frameTags": [{"name": "idle", "from": 0, "to": 0, "direction": "forward"}],
#| "slices": []
#| }
#|}
let sheet = parse_aseprite_json(json)
let machine = build_machine(sheet)
inspect(machine.initial, content="idle")
}moon check --target all --deny-warn
moon test --target wasm
moon test --target wasm-gc
moon test --target js
moon fmt --check
moon info
moon run cmd/mainpub struct AnimationMachine {
initial : String
clips : Array[AnimationClip]
transitions : Array[StateTransition]
} derive(Eq, ToJson, Debug, FromJson)fn AnimationMachine::transition_target(self : AnimationMachine, from~ : String, event~ : String) -> String?fn AnimationMachine::with_transition(self : AnimationMachine, from~ : String, event~ : String, to~ : String) -> AnimationMachinepub struct ExportBundle {
sheet : SpriteSheet
atlas : AtlasPlan
machine : AnimationMachine
nine_patches : Array[NinePatch]
diagnostics : Array[Diagnostic]
} derive(Eq, ToJson, Debug, FromJson)fn SpriteSheet::with_box(self : SpriteSheet, filename~ : String, name~ : String, rect~ : Rect) -> SpriteSheetA MoonBit pipeline for Aseprite JSON sprite animation assets.