Skip to content
tweens.gd

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.

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.

health_bar.gd
extends Node2D
var fill := 1.0
static var drain := Tweens.property(^"fill", null, 0.4, InOut.SMOOTHER_STEP)
func set_health(fraction: float) -> void:
Tweens.play(self, drain.with_to(fraction))
  1. Store. Any script variable or built-in property works.
  2. Define. Tweens.property() reads and writes the path; null leaves the destination open.
  3. Play. Each call sets a new destination with with_to().

For storage that no property path reaches, Tweens.custom() takes getter and setter Callables.

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.