AnimationManager#add()

add(name, frames, frameRate, loop, useNumericIndex) → {Phaser.Animation}

Adds a new animation under the given key. Optionally set the frames, frame rate and loop.
Animations added in this way are played back with the play function.

Parameters
Name Type Argument Default Description
name string

The unique (within this Sprite) name for the animation, i.e. "run", "fire", "walk".

frames Array <optional>
null

An array of numbers/strings that correspond to the frames to add to this animation and in which order. e.g. [1, 2, 3] or ['run0', 'run1', run2]). If null then all frames will be used.

frameRate number <optional>
60

The speed at which the animation should play. The speed is given in frames per second.

loop boolean <optional>
false

Whether or not the animation is looped or just plays once.

useNumericIndex boolean <optional>
true

Are the given frames using numeric indexes (default) or strings?

Returns

The Animation object that was created.

Source code: animation/AnimationManager.js (Line 170)
doc_phaser
2017-02-14 10:36:00
Comments
Leave a Comment

Please login to continue.