浏览代码

Merge pull request #5052 from makc/patch-1

a method to interpolate between two morph targets
Mr.doob 11 年之前
父节点
当前提交
334288b7f6
共有 1 个文件被更改,包括 8 次插入0 次删除
  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 );