Hello everyone!
I used example and Tween.js finished a morph cube.
var tTC = new THREE.BoxGeometry(1,0.1,1);
var tTMa = new THREE.MeshBasicMaterial({color: 0x22ffff,morphTargets: true,transparent: true,opacity: 0.4});
var vertices = [],len = tTC.vertices.length;
for ( var v = 0; v < len; v ++) {
vertices.push( tTC.vertices[ v ].clone() );
if ( v%4 < 2 ) {
vertices[ v ].y += 0.5;
}
tTC.morphTargets.push( { name: "target" + v, vertices: vertices } );
}
tTC = new THREE.BufferGeometry().fromGeometry( tTC );
var tTM = new THREE.Mesh( tTC, tTMa );
tTM.position.set(0,0,0);
scene.add(tTM);
var nOpacity = tTM.material.opacity;
var t;
var testTween = new TWEEN.Tween({nOpacity: 0.4,t: 0}).to({nOpacity: 1,t: 1},3000).easing(TWEEN.Easing.Bounce.Out).onUpdate(
function(){
tTM.material.opacity = this.nOpacity;
for(var i = 0;i < len;i++){
if( i%4 < 2){
tTM.morphTargetInfluences[i] = this.t;
}
}
}
).onComplete(function(){
console.log("finished");
});
testTween.start();
If the morph cube is from DAE, how could i do? Thx:slightly_smiling_face: