-->

Phaser.Component. Animation

new Animation()

The Animation Component provides a play method, which is a proxy to the AnimationManager.play method.

Source - gameobjects/components/Animation.js, line 12

Methods

play(name, frameRate, loop, killOnComplete) → {Phaser.Animation}

Plays an Animation.

The animation should have previously been created via animations.add.

If the animation is already playing calling this again won't do anything.
If you need to reset an already running animation do so directly on the Animation object itself or via AnimationManager.stop.

Parameters:
Name Type Argument Default Description
name string

The name of the animation to be played, e.g. "fire", "walk", "jump". Must have been previously created via 'AnimationManager.add'.

frameRate number <optional>
null

The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.

loop boolean <optional>
false

Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.

killOnComplete boolean <optional>
false

If set to true when the animation completes (only happens if loop=false) the parent Sprite will be killed.

Returns:

A reference to playing Animation.

Source - gameobjects/components/Animation.js, line 31
Phaser Copyright © 2012-2016 Photon Storm Ltd.
Documentation generated by JSDoc 3.4.0 on Fri Aug 26 2016 01:16:10 GMT+0100 (BST) using the DocStrap template.