# rmp::behavior::Tween

> Moves one property of its object from `from` to `to` over `seconds`, along an Ease.

Source: https://omardev29.github.io/rmp-docs/reference/behaviors/Tween.html

behavior `#include <rmp/behavior.h>` [include/rmp/behavior.h:300](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L300-L332)

struct Tween

Moves one property of its object from `from` to `to` over `seconds`, along an Ease. With neither `loop` nor `ping_pong` it stops exactly on `to` and `finished()` turns true.

Added to an object with `add<rmp::behavior::Tween>()`; the framework calls its `_update` with the object it is on.

## Fields

| Field | Type | Default | What it is |
|---|---|---|---|
| `property` | `Property` | `Property::POSITION_Y` | The field it writes |
| `from` | `float` | `0` | The value at the start of a pass, in that field's unit |
| `to` | `float` | `0` | The value at the end of a pass |
| `seconds` | `float` | `1` | How long one pass takes; 0 = straight to `to` |
| `ease` | `Ease` | `Ease::IN_OUT` | The curve of each pass |
| `loop` | `bool` | `false` | Start again from `from` at the end of each pass |
| `ping_pong` | `bool` | `false` | Turn back at each end, forever; wins over `loop` |
| `ours` | `struct { … }` |  | What it is keeping track of. Readable, because sometimes you want it; not yours to write. It is one PUBLIC member and not a private block because a struct with a private member is not an aggregate in C++20, and then `{ .speed = 320 }` stops compiling — which is the whole design. The name is the fence. |

### `finished`

bool finished() const

function [include/rmp/behavior.h:312](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L312)

Whether it has stopped on `to`: a tween with neither `loop` nor `ping_pong` does at the end of its pass, and one of 0 seconds at once, whatever those two say.

### `restart`

void restart()

function [include/rmp/behavior.h:314](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L314-L318)

Starts it again from `from`, going forwards, as if it had just been added.
