From a13b79f86e3fdd0204d6f547cd91e16a77930b8b Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Fri, 19 Aug 2022 18:49:08 +0100 Subject: [PATCH] Added getTotal test --- src/tweens/TweenManager.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/tweens/TweenManager.js b/src/tweens/TweenManager.js index 4118afe74..660c54b73 100644 --- a/src/tweens/TweenManager.js +++ b/src/tweens/TweenManager.js @@ -383,7 +383,7 @@ var TweenManager = new Class({ { list.splice(idx, 1); - tween.state = TWEEN_CONST.REMOVED; + tween.destroy(); } } @@ -502,6 +502,22 @@ var TweenManager = new Class({ return this; }, + getTotal: function () + { + var tweens = this.tweens; + var active = 0; + + for (var i = 0; i < tweens.length; i++) + { + if (tweens[i].state === TWEEN_CONST.ACTIVE) + { + active++; + } + } + + return { active: active, total: tweens.length }; + }, + /** * Returns an array containing references to of all Tweens and Timelines in this Tween Manager. *