Tween transition parallel to 2 other chained transitions

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By qwenough

Hello guys, im trying to tween something like this: 123 hosted at ImgBB — ImgBB
Two consecutive animations parallel to another animation.

I tried to achieve this result in that way, but the last animation does not play, the object immediately returns to its original size, as it should, but without animation. Can anyone suggest how to fix this? Can anyone suggest how to fix this?

var tween = get_tree().create_tween()
tween.set_parallel()

tween.tween_property($Sprite, "global_position", Vector2(1,1), 1)
tween.tween_property($Sprite, "scale", Vector2(1.5,1.5), 0.5)
tween.tween_property($Sprite, "scale", Vector2(1,1), 0.5).set_delay(0.5)

tween.play()

Thanks in advance for your help

I haven’t made a complete switch to Godot 4 yet, so I have limited experience with the new Tween object. However, seeing no other input here, I’ll take a stab…

With some playing, I was also unable to accomplish your goal with a single tween. On the surface, the combination of set_parallel() and the set_delay() you have on the 2nd scale tween seems like a plausible way to get the result you want. However, as you know, it doesn’t work. I’m not sure if that’s intended or possibly a bug in the new Tween object.

You’re probably aware, but you can get that to work with two tweens. Probably not an ideal solution, but something like this:

var tween1 = get_tree().create_tween()
var tween2 = get_tree().create_tween()

tween1.tween_property($Sprite, "global_position", Vector2(1,1), 1)
tween2.tween_property($Sprite, "scale", Vector2(1.5,1.5), 0.5)
tween2.tween_property($Sprite, "scale", Vector2(1,1), 0.5).set_delay(0.5)

Also, no need to call tween.play() as it’ll do that by default.

jgodfrey | 2022-12-14 04:02

Thank you very much!

qwenough | 2022-12-14 07:33