Chaining tween properties for sequence and parallel processing

Godot Version

4.2.1

Question

I want my label to change the Y position and after that has been completed, perform the next 2 changes:

var levelLabelTween = create_tween().set_parallel(false)
levelLabelTween.tween_property($CanvasLayer/levelLabel, "position:y", 160, 2)
levelLabelTween.tween_property($CanvasLayer/levelLabel, "scale", Vector2(100, 100), 1)
levelLabelTween.tween_property($CanvasLayer/levelLabel, "position:y", -300, 1)
levelLabelTween.chain()

Per my understanding, the chain() is combining the last 2 tween_property before it so it would execute

levelLabelTween.tween_property($CanvasLayer/levelLabel, “position:y”, 160, 2)

and after that is finished execute those 2 in parallel

levelLabelTween.tween_property($CanvasLayer/levelLabel, “scale”, Vector2(100, 100), 1)
levelLabelTween.tween_property($CanvasLayer/levelLabel, “position:y”, -300, 1)

What actually happens is that the first one gets completed but then the other 2 don’t finish in parallel. The scale finishes first and then the position again.

What am I missing here?

Max

chain() is used only to make a parallel tween sequential. Tweens are already sequential (by default, and you also call set_parallel(false)), so it has no effect.

What you need is parallel() which is the exact opposite:

var levelLabelTween = create_tween()
levelLabelTween.tween_property($CanvasLayer/levelLabel, "position:y", 160, 2)
levelLabelTween.tween_property($CanvasLayer/levelLabel, "scale", Vector2(100, 100), 1)
levelLabelTween.parallel().tween_property($CanvasLayer/levelLabel, "position:y", -300, 1)

Then I must have misread the documentation or another example regarding chain() somewhere :confused:

Thanks, your example works just fine! :slight_smile:

Max

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.