forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimation.js
More file actions
40 lines (34 loc) · 1.67 KB
/
Animation.js
File metadata and controls
40 lines (34 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2015 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* The Animation Component provides a `play` method, which is a proxy to the `AnimationManager.play` method.
*
* @class
*/
Phaser.Component.Animation = function () {};
Phaser.Component.Animation.prototype = {
/**
* 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`.
*
* @method
* @param {string} name - The name of the animation to be played, e.g. "fire", "walk", "jump". Must have been previously created via 'AnimationManager.add'.
* @param {number} [frameRate=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.
* @param {boolean} [loop=false] - Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.
* @param {boolean} [killOnComplete=false] - If set to true when the animation completes (only happens if loop=false) the parent Sprite will be killed.
* @return {Phaser.Animation} A reference to playing Animation.
*/
play: function (name, frameRate, loop, killOnComplete) {
if (this.animations)
{
return this.animations.play(name, frameRate, loop, killOnComplete);
}
}
};