Create an animation over a run of frames, looping from the start
tileInfo TileInfoThe first frame
frameCount numberHow many frames, one or more
frameTime number optional, default 0.1Seconds each frame shows for
const walk = new SpriteAnimation(tile(0, 16), 4, .1); // four frames, a tenth of a second each
const attack = new SpriteAnimation(tile(4, 16), 3, .05).play(); // once, then holds the last frame
// in update: this.tileInfo = (attack.isDone ? walk : attack).tileInfo;
How many frames have gone by since the start, fractional
The first frame, the others follow it as tileInfo.frame counts them
The frame showing now, 0 to frameCount-1
Seconds each frame shows for
The frame held by stop, undefined while running
True once a play has shown its last frame for its time, the first read after that calls onEnd
How it runs, set by loop, play and pingPong
Called once when a play ends, on the first read after it
Rate multiplier, 2 plays twice as fast; set it before starting
Engine time it started at
The tile of the frame showing now
Start over from the first frame and repeat forever
Start over from the first frame and run there and back forever
Start over from the first frame, run through once and hold the last frame, last to first at a negative speed
onEnd function optionalCalled once when it ends, on the first read of it after that
Start over from the first frame in a mode, with no end callback
mode 'loop'|'once'|'pingPong' optionalThe current mode when left out