Button TweenScale UI

Greetings,
i have an issue, a strange issue:
i assigned a tweenscale to a 2d UI panel, wich is enabled on button press.
The problem is the tweenScale apply only the first time i press the button, then it doesn’t work anymore. The ui is enabled, but the tweenscale work only the first time.

Any advices?
thank u

You should clone the original scale and use it for tweening, instead of using the scale of an item directly. When you use it directly, it will originally work, since “from” and “to” value will be different. After that the “from” value will be same as “to”, so you won’t see any visual changes.

var from = entity.getLocalScale().clone();
entity.tween(from).to(new pc.Vec3(3, 3, 3), 1.0, pc.SineOut)
1 Like

Sadly i’m not a professional scripter. It doesn’t work to me.
thanks anyway.

Here is a sample project. the first time the tween on button press happens. then, no more.
any advice?
https://playcanvas.com/editor/scene/1354770

thank you

Fixed:

1 Like

WOOOOOA! thank you!!!