# GDScript: Custom properties

Source: https://tweens.gd/gdscript/custom-properties/

When the catalog has no matching property, animate a callback value, a script variable, or your own storage.

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

## Callback values

```gdscript
var score := Tweens.value(10.0, 100.0, 1.0)
score.on_update = func(_handle, sample): label.text = str(roundi(sample))
Tweens.play(label, score)
```

The label counts from 10 to 100. `on_update` receives each value; the node you start on owns playback. [Callback values](https://tweens.gd/gdscript/nodes/values/) lists the other value types.

## Property bindings

health\_bar.gd

```gdscript
extends Node2D

var fill := 1.0
static var drain := Tweens.property(^"fill", null, 0.4, InOut.SMOOTHER_STEP)

func set_health(fraction: float) -> void:
    Tweens.play(self, drain.with_to(fraction))
```

1.  **Store.** Any script variable or built-in property works.
2.  **Define.** `Tweens.property()` reads and writes the path; `null` leaves the destination open.
3.  **Play.** Each call sets a new destination with `with_to()`.

For storage that no property path reaches, `Tweens.custom()` takes getter and setter Callables.

## Custom bindings

For storage independent of interpolation, extend `Tweens.Binding` and assign an instance to a definition’s `adapter`. Override `read` and `write`, with optional `prepare`, `restore`, and `release` hooks. The same binding works with ordinary endpoints or a prepared `keyframe_curve`; see [keyframes](https://tweens.gd/gdscript/keyframes/#storage-timing-and-sampling).

Extend `Tweens.Adapter` when custom endpoint interpolation is also needed, and override `interpolate`. Each start works on a shallow `copy()`, so referenced objects stay shared unless you copy them. Override `copy()` for custom mutable configuration.

Release only what your copy owns

Keep per-playback state on the playback copy, and release only resources that copy created.

[Adapters](https://tweens.gd/gdscript/api/custom/)Every hook, its order, and failed preparation.

[Manual scheduling](https://tweens.gd/gdscript/api/scheduler/)Advance tweens yourself, for plain objects and tests.
