admin管理员组文章数量:1429064
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
1 Answer
Reset to default 5To 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
版权声明:本文标题:javascript - Three.js | Tween chain : How to start multiple tween's simultaneous? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745543677a2662607.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论