GDScriptBeta
Custom properties
When the catalog has no matching property, animate a callback value, a script variable, or your own storage.
Examples use the global Tweens class in a node script, with targets inside the scene tree.
Callback values
Section titled “Callback values”var score := Tweens.value(10.0, 100.0, 1.0)score.on_update = func(_handle, sample): label.text = str(roundi(sample))Tweens.play(label, score)The label counts from 10 to 100. on_update receives each value; the node you start on owns playback. Callback values lists the other value types.
Property bindings
Section titled “Property bindings”extends Node2D
var fill := 1.0static var drain := Tweens.property(^"fill", null, 0.4, InOut.SMOOTHER_STEP)
func set_health(fraction: float) -> void: Tweens.play(self, drain.with_to(fraction))- Store. Any script variable or built-in property works.
- Define.
Tweens.property()reads and writes the path;nullleaves the destination open. - Play. Each call sets a new destination with
with_to().
For storage that no property path reaches, Tweens.custom() takes getter and setter Callables.
Custom bindings
Section titled “Custom bindings”For storage independent of interpolation, extend Tweens.Binding and assign an instance to a definition’s adapter. Override read and write, with optional prepare, restore, and release hooks. The same binding works with ordinary endpoints or a prepared keyframe_curve; see keyframes.
Extend Tweens.Adapter when custom endpoint interpolation is also needed, and override interpolate. Each start works on a shallow copy(), so referenced objects stay shared unless you copy them. Override copy() for custom mutable configuration.
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.