Skip to content

Commit 30d80bb

Browse files
committed
Added keyframe
1 parent c8a99f0 commit 30d80bb

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/animations/AnimationFrame.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ var Class = require('../utils/Class');
2424
* @param {(string|integer)} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses.
2525
* @param {integer} index - The index of this AnimationFrame within the Animation sequence.
2626
* @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering.
27+
* @param {boolean} [isKeyFrame=false] - Is this Frame a Keyframe within the Animation?
2728
*/
2829
var AnimationFrame = new Class({
2930

3031
initialize:
3132

32-
function AnimationFrame (textureKey, textureFrame, index, frame)
33+
function AnimationFrame (textureKey, textureFrame, index, frame, isKeyFrame)
3334
{
35+
if (isKeyFrame === undefined) { isKeyFrame = false; }
36+
3437
/**
3538
* The key of the Texture this AnimationFrame uses.
3639
*
@@ -133,6 +136,15 @@ var AnimationFrame = new Class({
133136
* @since 3.0.0
134137
*/
135138
this.progress = 0;
139+
140+
/**
141+
* Is this Frame a KeyFrame within the Animation?
142+
*
143+
* @name Phaser.Animations.AnimationFrame#isKeyFrame
144+
* @type {boolean}
145+
* @since 3.50.0
146+
*/
147+
this.isKeyFrame = isKeyFrame;
136148
},
137149

138150
/**
@@ -148,7 +160,8 @@ var AnimationFrame = new Class({
148160
return {
149161
key: this.textureKey,
150162
frame: this.textureFrame,
151-
duration: this.duration
163+
duration: this.duration,
164+
keyframe: this.isKeyFrame
152165
};
153166
},
154167

0 commit comments

Comments
 (0)