Hello guys, i want to create event where .yoyo will be used.
I want to move something through tween position , but yoyo it back when the event is triggered.
Any ideas?
Hello guys, i want to create event where .yoyo will be used.
I want to move something through tween position , but yoyo it back when the event is triggered.
Any ideas?
Sorry, but what is the question?
To use yoyo, simply pass true
/false
to it. Please, refer to the guide:
https://developer.playcanvas.com/en/tutorials/tweening/
I simply want my object to yoyo when the button is pressed,and only once, not by checkboxing it in editor.
It sounds like you want to use .yoyo
without the yoyo. If that’s the case you maybe can use two tweens in the opposite direction?
Call the tween with yoyo and loop disabled when the button is clicked.
Adding to @yaustar’s advice,
Make sure when you disable loop that you set repeat() to 2. Here is the link to the relevant doumentation:
Thanks for advice, although i want it to tween the object back when the button is clicked again, and if clicked again, tween it to target position and so on…
Sounds like you just need two tweens as was mentioned above. One to get there on the first click, and another when it is clicked again