浏览代码

Merge pull request #1489 from abow/goToFrame

fix for Animatable.goToFrame
David Catuhe 8 年之前
父节点
当前提交
2ef0345a99
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/Animations/babylon.animatable.ts

+ 8 - 0
src/Animations/babylon.animatable.ts

@@ -74,6 +74,14 @@
         public goToFrame(frame: number): void {
             var animations = this._animations;
 
+            if (animations[0]) {
+                var fps = animations[0].framePerSecond;
+                var currentFrame = animations[0].currentFrame;
+                var adjustTime = frame - currentFrame;
+                var delay = adjustTime * 1000 / fps;
+                this._localDelayOffset -= delay;
+            }
+
             for (var index = 0; index < animations.length; index++) {
                 animations[index].goToFrame(frame);
             }