浏览代码

Update animation.ts

ycw 5 年之前
父节点
当前提交
90d4891dae
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/Animations/animation.ts

+ 2 - 1
src/Animations/animation.ts

@@ -553,6 +553,7 @@ export class Animation {
      */
     public addEvent(event: AnimationEvent): void {
         this._events.push(event);
+        this._events.sort((a, b) => a.frame - b.frame);
     }
 
     /**
@@ -1302,4 +1303,4 @@ export class Animation {
 }
 
 _TypeStore.RegisteredTypes["BABYLON.Animation"] = Animation;
-Node._AnimationRangeFactory = (name: string, from: number, to: number) => new AnimationRange(name, from, to);
+Node._AnimationRangeFactory = (name: string, from: number, to: number) => new AnimationRange(name, from, to);