|
@@ -102,23 +102,41 @@
|
|
|
var idx = this._scene._activeAnimatables.indexOf(this);
|
|
|
|
|
|
if (idx > -1) {
|
|
|
- var animations = this._animations;
|
|
|
- var numberOfAnimationsStopped = 0;
|
|
|
- for (var index = animations.length - 1; index >= 0; index--) {
|
|
|
- if (typeof animationName === "string" && animations[index].name != animationName) {
|
|
|
- continue;
|
|
|
+
|
|
|
+ if(animationName){
|
|
|
+
|
|
|
+ var animations = this._animations;
|
|
|
+ var numberOfAnimationsStopped = 0;
|
|
|
+ for (var index = animations.length - 1; index >= 0; index--) {
|
|
|
+ if (typeof animationName === "string" && animations[index].name != animationName) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ animations[index].reset();
|
|
|
+ animations.splice(index, 1);
|
|
|
+ numberOfAnimationsStopped ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (animations.length == numberOfAnimationsStopped) {
|
|
|
+ this._scene._activeAnimatables.splice(idx, 1);
|
|
|
+
|
|
|
+ if (this.onAnimationEnd) {
|
|
|
+ this.onAnimationEnd();
|
|
|
+ }
|
|
|
}
|
|
|
- animations[index].reset();
|
|
|
- animations.splice(index, 1);
|
|
|
- numberOfAnimationsStopped ++;
|
|
|
- }
|
|
|
|
|
|
- if (animations.length == numberOfAnimationsStopped) {
|
|
|
- this._scene._activeAnimatables.splice(idx, 1);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ this._scene._activeAnimatables.splice(index, 1);
|
|
|
+ var animations = this._animations;
|
|
|
+
|
|
|
+ for (var index = 0; index < animations.length; index++) {
|
|
|
+ animations[index].reset();
|
|
|
+ }
|
|
|
|
|
|
if (this.onAnimationEnd) {
|
|
|
this.onAnimationEnd();
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|