From 30d80bb74b89699fdc6135e385acb442c7913897 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Mon, 5 Oct 2020 08:06:53 +0100 Subject: [PATCH] Added keyframe --- src/animations/AnimationFrame.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/animations/AnimationFrame.js b/src/animations/AnimationFrame.js index 49b4dc752..35d94ec33 100644 --- a/src/animations/AnimationFrame.js +++ b/src/animations/AnimationFrame.js @@ -24,13 +24,16 @@ var Class = require('../utils/Class'); * @param {(string|integer)} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. * @param {integer} index - The index of this AnimationFrame within the Animation sequence. * @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering. + * @param {boolean} [isKeyFrame=false] - Is this Frame a Keyframe within the Animation? */ var AnimationFrame = new Class({ initialize: - function AnimationFrame (textureKey, textureFrame, index, frame) + function AnimationFrame (textureKey, textureFrame, index, frame, isKeyFrame) { + if (isKeyFrame === undefined) { isKeyFrame = false; } + /** * The key of the Texture this AnimationFrame uses. * @@ -133,6 +136,15 @@ var AnimationFrame = new Class({ * @since 3.0.0 */ this.progress = 0; + + /** + * Is this Frame a KeyFrame within the Animation? + * + * @name Phaser.Animations.AnimationFrame#isKeyFrame + * @type {boolean} + * @since 3.50.0 + */ + this.isKeyFrame = isKeyFrame; }, /** @@ -148,7 +160,8 @@ var AnimationFrame = new Class({ return { key: this.textureKey, frame: this.textureFrame, - duration: this.duration + duration: this.duration, + keyframe: this.isKeyFrame }; },