Seamless transition between tweens

Godot Version

4.2.1

Question

I’m trying to create a tween animation for UI where a banner drops from the top of the screen and then does a bounce in place.

func _ready():
  banner_drop()

func banner_drop():
  var tween = create_tween()
  tween.tween_property(banner, "position:y", 400, 3).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
  tween.tween_callback(banner_bounce)

func banner_bounce():
  var tween = create_tween().set_loops()
  tween.tween_property(banner, "position:y", -30 , 2.0).as_relative().set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN_OUT)
  tween.tween_property(banner, "position:y", 30 , 2.0).as_relative().set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN_OUT)

It works for the most part but there’s a slight pause between one tween and the other. I included a video showing the ~1 second transition between the first function and the second. Is there a way to seamlessly go from one to the other?

Alternatively, is there a way to set_loops() for only a determined number of steps in the tween instead of the whole thing? This is the reason I used two different functions.

https://youtube.com/shorts/9RsKftiICxw?feature=share

just set_loops(10)
put the amount you want to loop inside it

this just basically try to change how your easing and transition type to make it seamless

1 Like

just set_loops(10)
put the amount you want to loop inside it

But I mean, if I had a tween with 3 steps, would it be possible to just loop from the second step onwards or do I always have to loop the whole tween?

then you separate the first step tween and create new tween just to loop the rest steps
it looks like what you did

1 Like

Thanks, I was just wondering if this looked like an appropriate solution or not.