Class

Animation

Animation(spritesheetImagePath, framesJSONPath)

Class representing an animation based on a spritesheet and json.
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.

View Source lib.js, line 2

Members

# CurrentAnimationLoop

Set the current animation loop to a previously-defined animation-loop.

View Source lib.js, line 41

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.

View Source lib.js, line 33

# 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

View Source lib.js, line 56