瀏覽代碼

More Animation fixes. See #4377.

Mr.doob 11 年之前
父節點
當前提交
4a80dffab7
共有 2 個文件被更改,包括 3 次插入4 次删除
  1. 2 3
      src/extras/animation/Animation.js
  2. 1 1
      src/extras/animation/KeyFrameAnimation.js

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

@@ -115,9 +115,10 @@ THREE.Animation.prototype.update = function ( delta ) {
 
 	var duration = this.data.length;
 
-	if ( this.loop === true ) {
+	if ( this.loop === true && this.currentTime > duration ) {
 
 		this.currentTime %= duration;
+		this.reset();
 
 	}
 
@@ -230,8 +231,6 @@ THREE.Animation.prototype.update = function ( delta ) {
 
 	if ( this.currentTime > duration ) {
 
-		this.reset();
-
 		if ( this.loop === false ) {
 
 			this.stop();

+ 1 - 1
src/extras/animation/KeyFrameAnimation.js

@@ -178,7 +178,7 @@ THREE.KeyFrameAnimation.prototype.update = function ( delta ) {
 
 	var duration = this.data.length;
 
-	if ( this.loop === true ) {
+	if ( this.loop === true && this.currentTime > duration ) {
 
 		this.currentTime %= duration;