Skip to content
tweens.gd

C#Beta

Await Completion

Every start returns a handle. Await it to continue once the tween ends, or use it to pause and cancel the tween on the way.

Animations are paused

Reduce Motion is on, or Animation Effects are off.
(e.g. in your accessibility settings)

Applies to this demo until you reload.

The remote’s buttons call this script’s methods. To build your own, attach it to a scene’s root Node2D, pick a Sprite2D for Sprite in the Inspector, and connect each button’s pressed signal to its method.

PlaybackRemote.cs
using Godot;
using tweens.gd;
// The remote's buttons call these methods; Ended reports how the movement ended.
public partial class PlaybackRemote : Node2D
{
[Signal]
public delegate void EndedEventHandler(Reason reason);
[Export] private Sprite2D sprite = null!;
[Export] private Vector2 to = new(1024, 128);
private TweenInstance? movement;
public async void Start()
{
movement = sprite.TweenPosition(to, 2.4, InOut.SmootherStep);
EmitSignalEnded(await movement.End);
}
public void Pause() => movement?.Pause();
public void Resume() => movement?.Resume();
public void Cancel() => movement?.Cancel();
}
  1. Keep the handle. TweenPosition returns it at once, and Start keeps it in movement.
  2. Await the end. await movement.End resumes once playback ends, with the reason: Completed, Cancelled, or OwnerExited when the scene closes first.
  3. Control it. Pause holds the current value until Resume. Cancel stops for good and keeps the latest value.

To stop every tween a node owns without keeping their handles, call sprite.CancelTweens().

Await the handle to continue in the same method. End resumes however playback ended, so check the reason when the next step needs an arrival.

Await
var movement = sprite.TweenPosition((400, 180), 0.6, Out.Cubic);
if (await movement.End == Reason.Completed)
GD.Print("Arrived");

A callback on the definition suits a small synchronous reaction. OnEnd runs only on natural completion.

Callback
var arrive = new Tweens.Position2D((400, 180), 0.6, Out.Cubic)
{
OnEnd = _ => GD.Print("Arrived"),
};
sprite.Tween(arrive);

OnFinally also runs when playback stops early or fails; callback order shows the whole lifecycle.

tweens.gd is made with math & ferrets, copyright © 2026 its contributors.

Godot logo by Andrea Calabró, licensed under CC BY 4.0.

"Easy, the Ferret" illustrations drawn by foxy_maria.

tweens.gd is released under the MIT License.

Godot is licensed under the MIT License.
tweens.gd is not affiliated with or endorsed by the Godot Foundation.