4

My code is :

function move(){

var A = new TWEEN.Tween(meshA.position).to({ z: -10 }, 2000).start();        
var B = new TWEEN.Tween(meshB.rotation).to({ z: Math.PI }, 2000);       
var C = new TWEEN.Tween(meshC.position).to({ x: 10 }, 2000);    

A.chain(B);
B.chain(C);
C.chain(A);

animate();    
}

But, how to code if I want start multiple tween's simultaneous. (A and B move together then C).

Treize Cinq
  • 417
  • 5
  • 16

1 Answers1

5

To animate A and B together, then C :

function move(){

var A = new TWEEN.Tween(meshA.position).to({ z: -10 }, 2000)
.onStart(function(){
     new TWEEN.Tween(meshB.rotation).to({ z: Math.PI }, 2000).start();
}).start();        
var C = new TWEEN.Tween(meshC.position).to({ x: 10 }, 2000);   
A.chain(C);
C.chain(A);
animate();
}

Et voilà !

Treize Cinq
  • 417
  • 5
  • 16