Hi all, I’m utilizing Cocos creator 3.5.0. I’m making an attempt to make flip animation for which I’m altering the dimensions utilizing tween. When I exploit tween within the callback operate of contact occasion and attempt to change the dimensions of a node, contact occasion is disabled after tween execution. For instance,
begin() {
this.node.on(Node.EventType.TOUCH_START, this.func, this);
}
func() {
tween(this.node)
.to(2, {scale : new Vec3(this.node.scale.x + 1, 1, 0)})
.begin();
}
According to this, node scale ought to improve by 1 for each contact, however after the primary contact and tween is executed. The contact occasion is disabled (or could also be destroyed). I don’t know if it’s the problem within the editor or am I lacking one thing ?
A workaround would most likely be to scale an middleman baby of the node that deal with the contact occasion and never the occasion node itself.
And possibly change the ui remodel content material measurement of the contact node if you need it to correspond to the scaled baby.
@Uldraxiel Thank you a lot to your suggestion , however I obtained reply to my query.
Ans : Instead of utilizing ‘.to( )’ use ‘.by( )’ for scale modification utilizing tween.