javascript - Three.js | Tween chain : How to start multiple tween's simultaneous? - Stack Overflow

My code is :function move(){var A = new TWEEN.Tween(meshA.position).to({ z: -10 }, 2000).start();

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à !

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745543678a4632241.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信