Create complex animation sequences with GTweenSequenceBuilder
mainUse GTweenSequenceBuilder to chain multiple animations, delays, and callbacks together.
.Append(): Adds a tween that starts after the previous one finishes..Join(): Adds a tween that runs concurrently with the previous one..AppendTime(float): Adds a delay in the sequence..JoinCallback(Action)/.AppendCallback(Action): Executes a callback at a specific point in the timeline.
public partial class PlayTweenSequenceExample : Node
{
[Export] public Node2D Target;
public override void _Ready()
{
GTween tween = GTweenSequenceBuilder.New()
.Append(Target.TweenPositionX(100f, 0.5f))
.Join(Target.TweenScale(new Vector2(2f, 2f), 1f))
.AppendTime(0.5f)
.JoinCallback(() => GD.Print("I'm waiting some time!"))
.Append(Target.TweenPositionX(0f, 1f))
.AppendCallback(() => GD.Print("I'm finished!"))
.Build();
tween.SetEasing(Easing.InOutCubic);
tween.Play();
}
}