Gamalto

Fork me on GitHub

Object Animation Overview

Gamalto. Animation

new Gamalto.Animation(sheet)

Creates a new animation sequence from a sprites sheet.

Parameters
Name Type Description
sheet Gamalto.SpriteSheet

Sprites sheet containing the sections for the animation.

Extends
Example
var anim = new Gamalto.Animation(sheet);

Members

length :number

inherited readonly

Length of the animation in frames.

Inherited From

loop :boolean

inherited

Gets or sets the loop state of the animation.

Inherited From

playing :boolean

inherited readonly

Whether the animation is playing.

Inherited From

progress :number

inherited readonly

Position in the duration array.

Inherited From

sheet :Gamalto.SpriteSheet

readonly

Sprites sheet use by the animation.

tag :object

inherited

Utility property to exchange data between objects.

Inherited From

transform :Gamalto.Transform

inherited readonly

Drawing transformation information.

Inherited From

Methods

clone() Gamalto.Animation

override

Creates a clone of the current object.

Overrides
Returns
  • Copy of the object.

draw(renderer, x, y, frameopt) number

inherited

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.

Inherited From
Returns
  • Drawn frame index.

duplicateFrame(index, dest)

inherited

Duplicates a frame including all its properties.

Parameters
Name Type Description
index number

Frame index.

dest number

New frame destination.

Inherited From

getSection(frame) Gamalto.Rect

Gets the sprites sheet section for the given frame.

Parameters
Name Type Description
frame number

Frame index.

Returns
  • Rectangle defining the section.

reset()

inherited

Resets the animation.

Inherited From

setDuration(time)

inherited

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.

Inherited From

setFrameDuration(frame, time)

inherited

Sets the local duration of a frame.

Parameters
Name Type Description
frame number

Frame index.

time number
Inherited From

setFrameOffset(frame, x, y)

inherited

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.

Inherited From

setOffset(x, y)

inherited

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.

Inherited From

toString() string

inherited abstract

Converts the object into a string.

Inherited From
Returns
  • string

update(timer) boolean

inherited

Updates the animation state.

Parameters
Name Type Description
timer Gamalto.ITiming

Timer object from which the elpased time will be read.

Inherited From
Returns
  • Playing state.

useSectionRange(start, length)

Sets a section indices range to be used for the animation.

Parameters
Name Type Description
start number

Start index is the sections list.

length number

Number of sections to be used.

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