浏览代码

Removed loop parameter from Animation.play().

Mr.doob 11 年之前
父节点
当前提交
202c96034f

+ 3 - 2
examples/misc_animation_keys.html

@@ -127,10 +127,11 @@
 				THREE.AnimationHandler.add( sphereMesh.animation );
 				THREE.AnimationHandler.add( sphereMesh.animation );
 												
 												
 				var sphereMeshAnimation = new THREE.Animation( sphereMesh, sphereMesh.animation.name, THREE.AnimationHandler.LINEAR )
 				var sphereMeshAnimation = new THREE.Animation( sphereMesh, sphereMesh.animation.name, THREE.AnimationHandler.LINEAR )
-				sphereMeshAnimation.play( true, 0 );
+				sphereMeshAnimation.play();
 				
 				
 				scene.add( sphereMesh );
 				scene.add( sphereMesh );
-			};			
+
+			};
 			
 			
 			var ensureLoop = function( animation ) {
 			var ensureLoop = function( animation ) {
 
 

+ 1 - 1
examples/misc_controls_path.html

@@ -139,7 +139,7 @@
 
 
 				// start animation
 				// start animation
 
 
-				controls.animation.play( true, 0 );
+				controls.animation.play();
 
 
 			}
 			}
 
 

+ 2 - 2
examples/webgl_loader_collada_keyframe.html

@@ -194,8 +194,8 @@
 						}
 						}
 
 
 					}
 					}
-
-					animation.play( false, 0 );
+					animation.loop = false;
+					animation.play();
 					lastTimestamp = Date.now();
 					lastTimestamp = Date.now();
 
 
 				}
 				}

+ 3 - 8
examples/webgl_loader_collada_skinning.html

@@ -38,11 +38,7 @@
 		</div>
 		</div>
 
 
 		<script src="../build/three.min.js"></script>
 		<script src="../build/three.min.js"></script>
-		<script src="./js/loaders/ColladaLoader.js"></script>
-		<script src="../src/extras/animation/Animation.js"></script>
-		<script src="../src/extras/animation/AnimationHandler.js"></script>
-		<script src="../src/extras/animation/AnimationMorphTarget.js"></script>
-		<script src="../src/extras/animation/KeyFrameAnimation.js"></script>
+		<script src="js/loaders/ColladaLoader.js"></script>
 		<script src="js/Detector.js"></script>
 		<script src="js/Detector.js"></script>
 		<script src="js/libs/stats.min.js"></script>
 		<script src="js/libs/stats.min.js"></script>
 
 
@@ -99,10 +95,9 @@
 
 
 						var animation = new THREE.Animation(
 						var animation = new THREE.Animation(
 							skin,
 							skin,
-							skin.geometry.animation.name,
-							THREE.AnimationHandler.LINEAR
+							skin.geometry.animation.name
 						  );
 						  );
-						 
+						animation.loop = false;
 						animation.play();
 						animation.play();
 						
 						
 					}
 					}

+ 1 - 1
examples/webgldeferred_animation.html

@@ -293,7 +293,7 @@
 
 
 
 
 					animation = new THREE.Animation( mesh, "ActionFemale" );
 					animation = new THREE.Animation( mesh, "ActionFemale" );
-					animation.play( true );
+					animation.play();
 					animation.update( 0 );
 					animation.update( 0 );
 
 
 				} );
 				} );

+ 5 - 8
src/extras/animation/Animation.js

@@ -24,22 +24,19 @@ THREE.Animation = function ( root, name, interpolationType ) {
 
 
 };
 };
 
 
-THREE.Animation.prototype.play = function ( loop, startTimeMS ) {
+THREE.Animation.prototype.play = function ( startTime ) {
+
+	this.currentTime = startTime !== undefined ? startTime : 0;
 
 
 	if ( this.isPlaying === false ) {
 	if ( this.isPlaying === false ) {
 
 
 		this.isPlaying = true;
 		this.isPlaying = true;
-		this.loop = loop !== undefined ? loop : true;
-		this.currentTime = startTimeMS !== undefined ? startTimeMS : 0;
 
 
 		// reset key cache
 		// reset key cache
 
 
-		var h, hl = this.hierarchy.length,
-			object;
-
-		for ( h = 0; h < hl; h ++ ) {
+		for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
 
 
-			object = this.hierarchy[ h ];
+			var object = this.hierarchy[ h ];
 
 
 			object.matrixAutoUpdate = true;
 			object.matrixAutoUpdate = true;