GDScriptBeta
Your first tween
Click anywhere on the stage. The line of code at the bottom sends the Godot icon there.
Scripting it
Section titled “Scripting it”Create a 2D scene and drag icon.svg from the FileSystem dock into it. Attach this script to the new Icon node, then run the scene and click around.
extends Sprite2D
func _unhandled_input(event: InputEvent) -> void: if event is InputEventMouseButton and event.pressed: Tweens.play(self, Tweens.position_2d(event.position, 1.2, Out.BACK))- Catch the click. Godot passes every mouse press that no UI control used to
_unhandled_input(). - Start the tween.
Tweens.position_2d()describes the move: to the click in 1.2 seconds, whereOut.BACKovershoots, then settles.Tweens.play()starts it on this node and returns at once; the tween plays over the next frames.
Other properties work the same way, such as Tweens.scale_2d(), Tweens.rotation_2d(), and Tweens.modulate(). The catalog lists them all.
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.