# GDScript: Functions

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

Supply your own easing as a function when a built-in family does not fit. It maps normalized progress to an interpolation weight.

Examples use the global `Tweens` class in a node script, with targets inside the scene tree.

## Use a function

```gdscript
var move := Tweens.position_2d_x(300.0, 0.6)
move.ease_function = func(t: float) -> float: return t * t

Tweens.play(sprite, move)
```

This starts slowly and accelerates. At halfway through the time, the weight is 0.25, so the sprite has travelled a quarter of the distance.

Time in, weight out

Progress runs from 0 to 1. Return 0 at the start and 1 at the end for an ordinary arrival. Weights outside that range create overshoot; a function ending at 0 returns to its starting value.

Choose one custom source

Set `ease_function` or a [`curve`](https://tweens.gd/gdscript/curves/), not both. Either overrides the built-in ease. Custom profiles keep their own pacing instead of using the In/Out split controls.

To keep the exact curve of a Godot transition, [sample it with `Tween.interpolate_value()`](https://tweens.gd/porting/#spring-and-out-in).

[Curves](https://tweens.gd/gdscript/curves/)Draw an ease in the Inspector instead.

[Effects](https://tweens.gd/gdscript/effects/)Ready-made functions for punch, shake, and breathing.

The [easing reference](https://tweens.gd/gdscript/api/easing/#custom-functions-and-curves) covers validation and failures.
