# GDScript: Your first tween

Source: https://tweens.gd/gdscript/quickstart/

Click anywhere on the stage. The line of code at the bottom sends the Godot icon there.

Interactive preview: https://tweens.gd/gdscript/quickstart/

## 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.

click\_to\_move.gd

```gdscript
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))
```

1.  **Catch the click.** Godot passes every mouse press that no UI control used to `_unhandled_input()`.
2.  **Start the tween.** `Tweens.position_2d()` describes the move: to the click in 1.2 seconds, where `Out.BACK` overshoots, 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](https://tweens.gd/gdscript/nodes/) lists them all.

Try it

-   Swap `Out.BACK` for `Out.BOUNCE`, or `1.2` for `0.4`.
-   Add `Tweens.play(self, Tweens.rotation_2d(rotation + TAU, 1.2, InOut.SMOOTHER_STEP))` as a second line under the `if`. Tweens of different properties play together, so the icon spins on its way. Turn on **Spin too** above to preview it.
