tuan243
September 18, 2023, 2:36pm
#1
Hi, I think I have found a bug of Cocos Creator 3.8.0, I write a simple code like this
onLoad() {
this.testNode.on(Node.EventType.TOUCH_END, () => {
console.log("touch end");
});
tween(this.testNode)
.to(2, { scale: v3(1.2, 1.2) })
.to(2, { scale: v3(1, 1) })
.start();
}
The touch end callback is not fired when I click on the node since in is scaling down.
Here is the demo.
Test-touch-tween.zip (6.4 MB)
zzf520
September 19, 2023, 2:32am
#2
Hello, this problem is because the scale does not set the z value caused, if the 2D UI implementation scale tween , then you need to set z to 1.
1 Like
scale needs 3 vectors, x, y, and z? With 2D games, you don’t need the z, but still need it there as v3 needs a vec3. So just add (?, ?, 1) to it and should run. Check my video on Tween on YouTube. You can download the project in the store.
tuan243
September 19, 2023, 2:47pm
#4
Thanks, I have used setScale wrong for a long time