GDScriptBeta
Callbacks
Callbacks are definition fields holding Callables that run synchronously at fixed points of each playback. Await Completion shows one in use.
Members
Section titled “Members”Each callback receives the playback’s TweensGdHandle; on_update receives (handle, value). All default to an empty Callable(), and each has a with_*() copy method, such as with_on_end().
| Field | Runs |
|---|---|
on_add |
At activation, after the start value is captured |
on_start |
Once, when the delay ends and playback begins |
on_update |
After each write |
on_end |
On natural completion |
on_cancel |
When playback stops early: cancelled, target freed, owner exited, or runner disposed |
on_finally |
Last, in every case, including failures |
Suppressing callbacks
Section titled “Suppressing callbacks”When ending callbacks touch the target, skip them once it’s gone:
| Field | Type | Default | Meaning |
|---|---|---|---|
suppress_callbacks_when_target_invalid |
bool |
false |
Skip on_end, on_cancel, and on_finally when the target or owner is gone, or playback ended with TARGET_FREED or OWNER_EXITED |
Callback order
Section titled “Callback order”on_add(handle), at activation after capture.on_update(handle, value)withfrom_value, only when the fill mode applies it during the delay.on_start(handle), once, when the delay ends and playback begins.on_update(handle, value)at each sampled timeline boundary and eligible update, plus once more when completion restores the initial value.on_end(handle)on natural completion, oron_cancel(handle)when playback stops early.on_finally(handle), in every case.
- The handle’s terminal state is visible inside the terminal callbacks, each runs at most once, and awaiting
endresumes after them. - A tween cancelled before activation, or whose preparation failed, runs no callbacks.
- A long frame doesn’t replay the callbacks of the cycles it skipped.
- Stale Callables fail the tween;
on_finallystill runs. Other errors inside a callback stay Godot script errors. - Tweens started in a callback or after an await are independent: they begin on the next eligible update, with no inherited frame time. A Chain links timing instead.
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.