Skip to content
tweens.gd

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.

var recoil := Tweens.position_2d_x()
recoil.by_value = -12.0
recoil.duration = 0.2
recoil.ease = InOut.QUAD
recoil.ping_pong = true
Tweens.play(sprite1, recoil.with_factor_by(2.0)) # 24 pixels back
Tweens.play(sprite2, recoil.with_factor_duration(1.5)) # 0.3 seconds each way
Tweens.play(sprite3, recoil.with_delta_delay(0.1)) # 0.1 seconds later

Each copy follows the original: tune recoil, and every variation changes with it. with_duration() on a copy instead replaces the duration outright.

Leave the destination out, and factor_to scales the value captured at the start:

var beat := Tweens.scale_2d()
beat.factor_to = 1.2
beat.duration = 0.15
beat.ease = InOut.SMOOTHER_STEP
beat.ping_pong = true
Tweens.play(sprite, beat)

The sprite grows to 120% of its current scale and back.

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.

Animations are paused

Reduce Motion is on, or Animation Effects are off.
(e.g. in your accessibility settings)

Applies to this demo until you reload.
Offset over time, outward then return: InOut.Quad skew weks

The shared definition

var recoil := Tweens.position_2d_x()
recoil.by_value = -12.0
recoil.duration = 0.2
recoil.ease = InOut.QUAD
recoil.ping_pong = true

This start

Tweens.play(self, recoil \
    .with_factor_by(2.0) \
    .with_factor_duration(1.2) \
    .with_skew(0.5) \
    .with_weks(0.5))

Kicks 24 px, 0.24 s each way

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.