Ver código fonte

AnimationAction: Fix time warping bug. (#33617)

Michael Herzog 4 semanas atrás
pai
commit
f7e0cb485a
1 arquivos alterados com 15 adições e 2 exclusões
  1. 15 2
      src/animation/AnimationAction.js

+ 15 - 2
src/animation/AnimationAction.js

@@ -56,6 +56,7 @@ class AnimationAction {
 		this._byClipCacheIndex = null; // for the memory manager
 
 		this._timeScaleInterpolant = null;
+		this._restoreTimeScale = null;
 		this._weightInterpolant = null;
 
 		/**
@@ -343,6 +344,10 @@ class AnimationAction {
 				startEndRatio = fadeOutDuration / fadeInDuration,
 				endStartRatio = fadeInDuration / fadeOutDuration;
 
+
+			fadeOutAction._restoreTimeScale = fadeOutAction.timeScale;
+			this._restoreTimeScale = this.timeScale;
+
 			fadeOutAction.warp( 1.0, startEndRatio, duration );
 			this.warp( endStartRatio, 1.0, duration );
 
@@ -511,6 +516,8 @@ class AnimationAction {
 
 		}
 
+		this._restoreTimeScale = null;
+
 		return this;
 
 	}
@@ -683,8 +690,6 @@ class AnimationAction {
 
 				if ( time > interpolant.parameterPositions[ 1 ] ) {
 
-					this.stopWarping();
-
 					if ( timeScale === 0 ) {
 
 						// motion has halted, pause
@@ -692,11 +697,19 @@ class AnimationAction {
 
 					} else {
 
+						if ( this._restoreTimeScale !== null ) {
+
+							timeScale = this._restoreTimeScale;
+
+						}
+
 						// warp done - apply final time scale
 						this.timeScale = timeScale;
 
 					}
 
+					this.stopWarping();
+
 				}
 
 			}

粤ICP备19079148号