Gamalto

Fork me on GitHub

Object BaseAnimation Overview

Gamalto. BaseAnimation

new Gamalto.BaseAnimation(sheet)

Abstract object to create an animation sequence. It is not meant to be used directly.

Parameters
Name Type Description
sheet Gamalto.SpriteSheet

Sprites sheet containing the sections for the animation.

Extends

Members

length :number

readonly

Length of the animation in frames.

loop :boolean

Gets or sets the loop state of the animation.

playing :boolean

inherited readonly

Whether the animation is playing.

Inherited From

progress :number

inherited readonly

Position in the duration array.

Inherited From

tag :object

inherited

Utility property to exchange data between objects.

Inherited From

transform :Gamalto.Transform

readonly

Drawing transformation information.

Methods

clone() object

override abstract

Creates a clone of the current object.

Overrides
Returns
  • Copy of the object.

draw(renderer, x, y, frameopt) number

Draws the current animation frame.

Parameters
Name Type Attributes Description
renderer Gamalto.BaseRenderer

Renderer of the Gamalto.surface to which the animation frame will be rendered.

x number

Horizontal drawing position.

y number

Vertical drawing position.

frame number <optional>

Index of the frame to draw. Usually, the frame index is internally calculated.

Returns
  • Drawn frame index.

duplicateFrame(index, dest)

Duplicates a frame including all its properties.

Parameters
Name Type Description
index number

Frame index.

dest number

New frame destination.

reset()

inherited

Resets the animation.

Inherited From

setDuration(time)

Sets the global duration of the animation, for the current animation content only. This will reset durations set with setFrameDuration()

Parameters
Name Type Description
time number

Duration in milliseconds.

setFrameDuration(frame, time)

Sets the local duration of a frame.

Parameters
Name Type Description
frame number

Frame index.

time number

setFrameOffset(frame, x, y)

Sets the local drawing offset of a frame. It will be added to the global offset.

Parameters
Name Type Description
frame number

Frame index.

x number

Horizontal offset.

y number

Vertical offset.

setOffset(x, y)

Sets the global offset of the animation, for the current animation content only.

Parameters
Name Type Description
x number

Horizontal offset.

y number

Vertical offset.

toString() string

inherited abstract

Converts the object into a string.

Inherited From
Returns
  • string

update(timer) boolean

Updates the animation state.

Parameters
Name Type Description
timer Gamalto.ITiming

Timer object from which the elpased time will be read.

Returns
  • Playing state.

Documentation generated by JSDoc 3.3.2 on Sun Sep 13 2015 20:13:31 GMT+0200 (CEST)