Browse Source

Update babylon.animatable.ts

Remove the finished animatable before running onAnimationEnd (that could contain other animations)
Temechon 10 years ago
parent
commit
61bf5deb81
1 changed files with 6 additions and 1 deletions
  1. 6 1
      Babylon/Animations/babylon.animatable.ts

+ 6 - 1
Babylon/Animations/babylon.animatable.ts

@@ -86,6 +86,11 @@
                 var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
                 running = running || isRunning;
             }
+            if (!running) {
+                // Remove from active animatables
+                var index = this._scene._activeAnimatables.indexOf(this);
+                this._scene._activeAnimatables.splice(index, 1);
+            }
 
             if (!running && this.onAnimationEnd) {
                 this.onAnimationEnd();
@@ -94,4 +99,4 @@
             return running;
         }
     }
-} 
+}