Class vxlFrameAnimation

Manages a frame-to-frame animation

Constructor

vxlFrameAnimation(map)
Provides frame-to-frame animation

Parameters:

map

JSON object where each property name is one frame and each property value is a list of actors var map = {"frame1":["actor1","actor2"], "frame2":["actor3","actor4"]}

Methods

.addActorToFrame(frame, actorName)
The actor will appear in the indicated frame of this animation

Parameters:

Type Name Description
Number frame

the frame

String actorName

the name of the actor. It must exist.

.getNextFrames(n)
Gets the next n valid frames. Works as a circular buffer.

Parameters:

Type Name Description
n

.getPreviousFrames(n)
Gets the previous n frames. Works as a circular buffer.

Parameters:

Type Name Description
n

.isValidFrame(f)
Verifies if the frame number passed as parameter is in the range of the current animation

Parameters:

Type Name Description
f

a frame number

Returns:

true if the number passed as parameter is a valid frame number, false otherwise
.nextFrame()
Moves the animation to the next valid frame. If the activeFrame is the last frame in the animation, then the animation is reset to the first frame.
.setFrame(f)
Sets f as the active frame

Parameters:

Type Name Description
f

the frame to set as active

.setFrameRate(rate)

Parameters:

Type Name Description
rate

.start(rate)
Starts the animation loop

Parameters:

Type Name Description
Number rate

the framerate for the animation (optional)

.stop()
Stops the animation loop
.update()
Selects the actors that will be visible in the current frame