Does chaining really mean sequence?
I am new to tween.js and wonder why the following tween does not run the two animations in sequence. I assumed that x in the first animation will be set to 200 and after getting completed, the second animation will start i.e set y to 500 but they are running in parallel.
Am I missing something
var tween = new TWEEN.Tween(shape.position).to({x:200}).to({y:500}); tween.start();
//tween update code not shown for simplicity
Hey @khurramraheel , sorry I got back to you so late-I'd swear I'd answered your question.
The issue is that every time you call to it overwrites any possible value you had already specified.
If you want to do two different 'animations' sequentially you should create two tweens and chain them-that's what chaining means in our context.
So you'd do this:
var tween = new TWEEN.Tween(shape.position).to({ x: 200 })
.chain(new TWEEN.Tween(shape.position).to({ y: 500 }))
.start();
hope that makes things clearer.
I got your point, Thanks!
Hey @khurramraheel , sorry I got back to you so late-I'd swear I'd answered your question. The issue is that every time you call
toit overwrites any possible value you had already specified. If you want to do two different 'animations' sequentially you should create two tweens and chain them-that's what chaining means in our context. So you'd do this:var tween = new TWEEN.Tween(shape.position).to({ x: 200 }) .chain(new TWEEN.Tween(shape.position).to({ y: 500 })) .start();hope that makes things clearer.
it seems that if the two 'animations' has their own 'onUpdate' function call, i will lose efficacy
@mengxun1437 how so?
@mengxun1437 how so?
I'm sorry, I may have misunderstood due to my knowledge of tweenjs
When we use chain, we need to use Group's update API🙏
No prob (solved in the other issue). If any ideas, let us know. :)