Browse Source

a method to interpolate between two morph targets

(actually we could do better without switch)
makc 11 years ago
parent
commit
c7c3e501d7
1 changed files with 3 additions and 11 deletions
  1. 3 11
      src/objects/MorphAnimMesh.js

+ 3 - 11
src/objects/MorphAnimMesh.js

@@ -177,18 +177,10 @@ THREE.MorphAnimMesh.prototype.updateAnimation = function ( delta ) {
 
 THREE.MorphAnimMesh.prototype.interpolateTargets = function ( a, b, t ) {
 	for ( var i = 0, n = this.morphTargetInfluences.length; i < n; i++ ) {
-		switch ( i ) {
-			case a:
-				this.morphTargetInfluences[ i ] = 1 - t;
-				break;
-			case b:
-				this.morphTargetInfluences[ i ] = t;
-				break;
-			default:
-				this.morphTargetInfluences[ i ] = 0;
-				break;
-		}
+		this.morphTargetInfluences[ i ] = 0;
 	}
+	if ( a > -1 ) this.morphTargetInfluences[ a ] = 1 - t;
+	if ( b > -1 ) this.morphTargetInfluences[ b ] = t;
 };
 
 THREE.MorphAnimMesh.prototype.clone = function ( object ) {