GDScriptBeta
Variations
Derive a stronger, slower, or later version of one definition. Factors multiply its values and deltas add to them, when playback starts.
Examples use the global Tweens class in a node script, with targets inside the scene tree.
Scale a motion
Section titled “Scale a motion”var recoil := Tweens.position_2d_x()recoil.by_value = -12.0recoil.duration = 0.2recoil.ease = InOut.QUADrecoil.ping_pong = true
Tweens.play(sprite1, recoil.with_factor_by(2.0)) # 24 pixels backTweens.play(sprite2, recoil.with_factor_duration(1.5)) # 0.3 seconds each wayTweens.play(sprite3, recoil.with_delta_delay(0.1)) # 0.1 seconds laterEach copy follows the original: tune recoil, and every variation changes with it. with_duration() on a copy instead replaces the duration outright.
Vary the current value
Section titled “Vary the current value”Leave the destination out, and factor_to scales the value captured at the start:
var beat := Tweens.scale_2d()beat.factor_to = 1.2beat.duration = 0.15beat.ease = InOut.SMOOTHER_STEPbeat.ping_pong = true
Tweens.play(sprite, beat)The sprite grows to 120% of its current scale and back.
Change the pacing
Section titled “Change the pacing”skew shifts the outward leg’s balance between its In and Out halves; weks does the same for the return. Both run from 0 (fast start) to 1 (fast finish), and 0.5 keeps the ease as written. Set weks to 1.0 - skew to retrace the outward curve.
Try it: change the shared recoil kick, and Hit and Crit follow it. Then move skew: the pacing changes, the distance doesn’t.
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.