Skip to content
tweens.gd

C#Beta

Cancellation

Awaiting a tween resumes however it ends, cancelled or not. Check the reason when the next step needs the motion to have arrived.

Examples use using Godot; and using tweens.gd; in a Node method, with targets inside the scene tree.

movement.Cancel() stops a tween where it is and resumes everything awaiting it. Groups and Chains cancel the same way, and sprite.CancelTweens(includeChildren: true) cancels everything a node and its descendants own.

Godot's Tween
var tween = sprite.CreateTween();
tween.TweenProperty(sprite, "position", new Vector2(400, 180), 0.6);
await ToSignal(tween, Tween.SignalName.Finished); // Not emitted if killed.
sprite.CreateTween().TweenProperty(sprite, "modulate:a", 0f, 0.3);
tweens.gd
var movement = sprite.TweenPosition((400, 180), 0.6);
if (await movement.End != Reason.Completed)
return;
sprite.TweenModulateAlpha(0, 0.3);

Godot doesn’t emit finished for a killed tween, so code awaiting it never continues. End always resumes with a reason: here, the fade runs only after the sprite arrives, and never on a sprite freed along the way.

Reason Meaning
Completed Reached the natural end
Cancelled Cancelled through a handle or CancelTweens
TargetFreed Target was queued for deletion, or found freed or disposed
OwnerExited Owner left the tree, or a separate owner was queued for deletion
RunnerDisposed Tree or scheduler shut down

Errors throw instead: a start with invalid arguments throws at the call, and awaiting End rethrows a fault from an easing, setter, or callback.

await movement.AwaitDecommissionAsync(token) stops waiting when token is cancelled, and throws OperationCanceledException. Playback and other waiters continue. Chains have the same method.

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.