admin管理员组

文章数量:1022695

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).

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).

Share Improve this question asked Apr 4, 2016 at 13:14 Treize CinqTreize Cinq 4251 gold badge5 silver badges16 bronze badges 2
  • 1 Try with the github./CreateJS/TweenJS CreateJs Tween the advantage of this normal tween library with wrapper function. I used in my project this is cool – Ajit kohir Commented Apr 4, 2016 at 17:15
  • I'm looking, Thks Stallion – Treize Cinq Commented Apr 5, 2016 at 5:47
Add a ment  | 

1 Answer 1

Reset to default 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à !

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).

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).

Share Improve this question asked Apr 4, 2016 at 13:14 Treize CinqTreize Cinq 4251 gold badge5 silver badges16 bronze badges 2
  • 1 Try with the github./CreateJS/TweenJS CreateJs Tween the advantage of this normal tween library with wrapper function. I used in my project this is cool – Ajit kohir Commented Apr 4, 2016 at 17:15
  • I'm looking, Thks Stallion – Treize Cinq Commented Apr 5, 2016 at 5:47
Add a ment  | 

1 Answer 1

Reset to default 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à !

本文标签: javascriptThreejsTween chainHow to start multiple tween39s simultaneousStack Overflow