فهرست منبع

Yet more Animation fixes and improvements. See #4377.

Mr.doob 11 سال پیش
والد
کامیت
e029fcb6d0
2فایلهای تغییر یافته به همراه4 افزوده شده و 8 حذف شده
  1. 2 6
      src/extras/animation/Animation.js
  2. 2 2
      src/extras/animation/MorphAnimation.js

+ 2 - 6
src/extras/animation/Animation.js

@@ -229,13 +229,9 @@ THREE.Animation.prototype.update = function ( delta ) {
 
 	}
 
-	if ( this.currentTime > duration ) {
+	if ( this.loop === false && this.currentTime > duration ) {
 
-		if ( this.loop === false ) {
-
-			this.stop();
-
-		}
+		this.stop();
 
 	}
 

+ 2 - 2
src/extras/animation/MorphAnimation.js

@@ -38,13 +38,13 @@ THREE.MorphAnimation.prototype = {
 
 			this.currentTime += delta;
 
-			if ( this.loop === true ) {
+			if ( this.loop === true && this.currentTime > this.duration ) {
 
 				this.currentTime %= this.duration;
 
 			}
 
-			this.currentTime = Math.min( this.currentTime, duration );
+			this.currentTime = Math.min( this.currentTime, this.duration );
 
 			var interpolation = this.duration / this.frames;
 			var frame = Math.floor( this.currentTime / interpolation );