Browse Source

Allow automatic reverse order for AnimationGroup

David Catuhe 6 years ago
parent
commit
7a274ae408
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/Animations/animationGroup.ts

+ 8 - 2
src/Animations/animationGroup.ts

@@ -245,8 +245,14 @@ export class AnimationGroup implements IDisposable {
 
         this._speedRatio = speedRatio;
 
-        if (from !== undefined && to !== undefined && from > to && this._speedRatio > 0) {
-            this._speedRatio = -speedRatio;
+        if (from !== undefined && to !== undefined) {
+            if (from < to && this._speedRatio < 0) {
+                let temp = to;
+                to = from;
+                from = temp;
+            } else if (from > to && this._speedRatio > 0) {
+                this._speedRatio = -speedRatio;
+            }
         }
 
         this._isStarted = true;