From 72913b63ddd2395e3b59ee5ba4a3a71a49a7b776 Mon Sep 17 00:00:00 2001 From: photonstorm Date: Mon, 26 Jun 2017 15:08:12 +0100 Subject: [PATCH] Added ignoreIfPlaying argument to Animation.Play. --- v3/src/components/animation/Play.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/v3/src/components/animation/Play.js b/v3/src/components/animation/Play.js index a61ee251e..b3637af18 100644 --- a/v3/src/components/animation/Play.js +++ b/v3/src/components/animation/Play.js @@ -1,7 +1,13 @@ -var Play = function (key, startFrame) +var Play = function (key, ignoreIfPlaying, startFrame) { + if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } if (startFrame === undefined) { startFrame = 0; } + if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) + { + return this; + } + this.load(key, startFrame); var anim = this.currentAnim;