play(name, frameRate, loop, killOnComplete) → {Phaser.Animation}
Play an animation based on the given key. The animation should previously have been added via animations.add
If the requested animation is already playing this request will be ignored.
If you need to reset an already running animation do so directly on the Animation object itself.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
name | string | The name of the animation to be played, e.g. "fire", "walk", "jump". | ||
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 instance.
- Source code: animation/AnimationManager.js (Line 253)
Please login to continue.