|
15 | 15 | * @param {string} name - The unique name for this animation, used in playback commands. |
16 | 16 | * @param {Phaser.FrameData} frameData - The FrameData object that contains all frames used by this Animation. |
17 | 17 | * @param {number[]|string[]} frames - An array of numbers or strings indicating which frames to play in which order. |
18 | | -* @param {number} delay - The time between each frame of the animation, given in ms. |
| 18 | +* @param {number} [frameRate=60] - The speed at which the animation should play. The speed is given in frames per second. |
| 19 | +* @param {boolean} [loop=false] - Whether or not the animation is looped or just plays once. |
19 | 20 | * @param {boolean} loop - Should this animation loop when it reaches the end or play through once. |
20 | 21 | */ |
21 | | -Phaser.Animation = function (game, parent, name, frameData, frames, delay, loop) { |
| 22 | +Phaser.Animation = function (game, parent, name, frameData, frames, frameRate, loop) { |
| 23 | + |
| 24 | + if (typeof loop === 'undefined') { loop = false; } |
22 | 25 |
|
23 | 26 | /** |
24 | 27 | * @property {Phaser.Game} game - A reference to the currently running Game. |
@@ -50,9 +53,9 @@ Phaser.Animation = function (game, parent, name, frameData, frames, delay, loop) |
50 | 53 | this._frames = this._frames.concat(frames); |
51 | 54 |
|
52 | 55 | /** |
53 | | - * @property {number} delay - The delay in ms between each frame of the Animation. |
| 56 | + * @property {number} delay - The delay in ms between each frame of the Animation, based on the given frameRate. |
54 | 57 | */ |
55 | | - this.delay = 1000 / delay; |
| 58 | + this.delay = 1000 / frameRate; |
56 | 59 |
|
57 | 60 | /** |
58 | 61 | * @property {boolean} loop - The loop state of the Animation. |
@@ -677,7 +680,7 @@ Object.defineProperty(Phaser.Animation.prototype, 'frame', { |
677 | 680 |
|
678 | 681 | /** |
679 | 682 | * @name Phaser.Animation#speed |
680 | | -* @property {number} speed - Gets or sets the current speed of the animation, the time between each frame of the animation, given in ms. Takes effect from the NEXT frame. Minimum value is 1. |
| 683 | +* @property {number} speed - Gets or sets the current speed of the animation in frames per second. Changing this in a playing animation will take effect from the next frame. Minimum value is 1. |
681 | 684 | */ |
682 | 685 | Object.defineProperty(Phaser.Animation.prototype, 'speed', { |
683 | 686 |
|
|
0 commit comments