|
@@ -101,14 +101,14 @@
|
|
|
public stop(animationName?: string): void {
|
|
|
|
|
|
if (animationName) {
|
|
|
-
|
|
|
+
|
|
|
var idx = this._scene._activeAnimatables.indexOf(this);
|
|
|
-
|
|
|
- if (idx) {
|
|
|
+
|
|
|
+ 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;
|
|
@@ -121,30 +121,30 @@
|
|
|
|
|
|
if (animations.length == numberOfAnimationsStopped) {
|
|
|
this._scene._activeAnimatables.splice(idx, 1);
|
|
|
-
|
|
|
+
|
|
|
if (this.onAnimationEnd) {
|
|
|
this.onAnimationEnd();
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
-
|
|
|
- var index = this._scene._activeAnimatables.indexOf(this);
|
|
|
+ } else {
|
|
|
|
|
|
- if (index > -1) {
|
|
|
- this._scene._activeAnimatables.splice(index, 1);
|
|
|
- var animations = this._animations;
|
|
|
-
|
|
|
- for (var index = 0; index < animations.length; index++) {
|
|
|
- animations[index].reset();
|
|
|
- }
|
|
|
+ var index = this._scene._activeAnimatables.indexOf(this);
|
|
|
|
|
|
- if (this.onAnimationEnd) {
|
|
|
- this.onAnimationEnd();
|
|
|
- }
|
|
|
+ if (index > -1) {
|
|
|
+ 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();
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|