Skip to content
tweens.gd

GDScriptBeta

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 the global Tweens class in a node script, 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 Tweens.cancel_tweens(sprite, true) cancels everything a node and its descendants own.

Godot's Tween
var tween := sprite.create_tween()
tween.tween_property(sprite, "position", Vector2(400, 180), 0.6)
await tween.finished # Not emitted if killed.
sprite.create_tween().tween_property(sprite, "modulate:a", 0.0, 0.3)
tweens.gd
var movement := Tweens.play(sprite, Tweens.position_2d([400, 180], 0.6))
if await movement.end != Tweens.Reason.COMPLETED:
return
Tweens.play(sprite, Tweens.modulate_alpha(0.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 cancel_tweens()
TARGET_FREED Target was queued for deletion, or found freed
OWNER_EXITED Owner left the tree, or a separate owner was queued for deletion
RUNNER_DISPOSED Tree or scheduler shut down
FAILED Start or playback hit a problem; read error
WAIT_CANCELLED Only the wait was cancelled

await movement.wait(cancellation) returns WAIT_CANCELLED once the TweensGdCancellation is cancelled. Playback, other waiters, and the handle’s own reason are unaffected. Groups and 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.