Sfoglia il codice sorgente

Merge pull request #5052 from makc/patch-1

a method to interpolate between two morph targets
Mr.doob 11 anni fa
parent
commit
334288b7f6
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8 0
      src/objects/MorphAnimMesh.js

+ 8 - 0
src/objects/MorphAnimMesh.js

@@ -175,6 +175,14 @@ 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++ ) {
+		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 ) {
 
 	if ( object === undefined ) object = new THREE.MorphAnimMesh( this.geometry, this.material );