Constructor
# new Animation(spritesheetImagePath, framesJSONPath)
Create a new Animation.
Parameters:
Name | Type | Description |
---|---|---|
spritesheetImagePath |
string
|
The path to an image representing a spritesheet. |
framesJSONPath |
string
|
The path to a JSON file holding all frames data for the spritesheet. |
Members
# CurrentAnimationLoop
Set the current animation loop to a previously-defined animation-loop.
Methods
# AddAnimationLoop(loopName, …frameNumbers)
Add an animationloop to the animation. An animation loop consists of several frames that are defined in the framesJSON file for this animation.
Framenumbers are 0-based.
Frames can be reused in different animationloops.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
loopName |
string
|
The name for this animationloop. This name must be unique! | |
frameNumbers |
number
|
<repeatable> |
the framenumbers for this animationloop, as defined (in order) in the framesJSON file for this animation. |
# Draw(w, h)
Draws the current animation-frame for the currently selected animation-loop.
Parameters:
Name | Type | Description |
---|---|---|
w |
number
|
the draw-width for this animation |
h |
number
|
the draw-height for this animation |