SpriteAnimation
Since 0.6Changed in next
Fields
| Field | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|
name | string | yes | What animation and ctx.sprite.play call it. Unique within the sprite. | ||
frames | string[] | yes | Frame names, in the order they play; a name may repeat. At least one, and each a frame of this sprite (sprite-frame-missing). | ||
fps | number | yes | Frames per second, above zero. | ||
loop | boolean | no | true | Default true. A non-looping animation stops on its last frame and raises the animation-end event (or the event a ctx.sprite.play names). | |
durations | number[] | no | Seconds each entry of frames shows for, one per entry, each above zero: for frames that hold for different times. Absent: every frame shows for 1 / fps. | ||
mode | SpriteAnimationMode | no | loop, once, pingpong, reverse | "loop" repeats, "once" stops on the last frame, "pingpong" plays forward then back without repeating the end frames, "reverse" plays last to first. Absent: loop decides. loop is read with "pingpong" and "reverse": false plays them through once. | |
events | SpriteAnimationEvent[] | no | Bus events raised as the animation reaches its frames, in any mode. Absent: none. |