Animate
Drive a value smoothly over time. Animate turns a start and a target into a reactive value that moves
between them over a duration in milliseconds, shaping the motion with the same easeIn/easeOut
controls as Maths.Real.Ease. The core driver
Animate.Real yields a Maths.Real
progress that the other drivers build on to tween integers, colours and booleans, and there are timed
helpers that flip a value's lock or error state after a delay.
Contents
Functions
Functions
Animate.After
Holds a start value, then switches to an end value once a delay elapses.
Generics
| Name | Description |
|---|---|
ValueType | The type of the two values and of the result. |
Parameters
| Name | Type | Description |
|---|---|---|
durationMs | Maths.Real | The delay before switching, in milliseconds. |
startValue | ValueType | The value held until the delay elapses. |
endValue | ValueType | The value taken once the delay elapses. |
Returns
Returns ValueType — startValue until durationMs has passed, then endValue.
Example
LET Text label = Animate.After 500.0 "Loading" "Ready"Animate.Bool
Switches from a start to a target boolean at the halfway point of a duration.
Parameters
| Name | Type | Description |
|---|---|---|
startValue | Logic.Maybe | The value before the switch. |
targetValue | Logic.Maybe | The value after the switch. |
durationMs | Maths.Real | How long the animation runs, in milliseconds. |
easeIn | Maths.Real | Strength of the ease at the start. |
easeOut | Maths.Real | Strength of the ease at the end. |
Returns
Returns Logic.Maybe — startValue until the eased progress passes one half, then targetValue.
Animate.Counter
Advances an integer state by one on a fixed interval.
Parameters
| Name | Type | Description |
|---|---|---|
counter | Maths.Integer | The integer state to advance on each tick. |
intervalMs | Maths.Integer | The time between ticks, in milliseconds. |
Returns
Returns nothing — it increments counter once every intervalMs milliseconds.
Example
STATE Maths.Integer tick = 0
Animate.Counter tick 1000tick once per second.Animate.ErrorAfter
Puts a value into an error state once a delay elapses.
Generics
| Name | Description |
|---|---|
ValueType | The type of the value being guarded. |
Parameters
| Name | Type | Description |
|---|---|---|
value | ValueType | The value to hold until the delay elapses. |
errorMessage | Text | The message raised once the delay elapses. |
durationMs | Maths.Real | The delay before erroring, in milliseconds. |
Returns
Returns ValueType — the value until durationMs has passed, then an error carrying errorMessage.
Animate.ErrorAfterWithRetry
Errors a value after a delay, offering a retry that restarts the timer.
Generics
| Name | Description |
|---|---|
ValueType | The type of the value being guarded. |
Parameters
| Name | Type | Description |
|---|---|---|
value | ValueType | The value to hold until the delay elapses. |
errorMessage | Text | The message raised once the delay elapses. |
durationMs | Maths.Real | The delay before erroring, in milliseconds. |
Returns
Returns ValueType — the value until durationMs has passed, then an error carrying errorMessage with a retry that restarts the delay.
Animate.Integer
Drives a whole number from a start to a target over a duration, with easing.
Parameters
| Name | Type | Description |
|---|---|---|
startValue | Maths.Integer | The value at the start of the animation. |
targetValue | Maths.Integer | The value to reach at the end. |
durationMs | Maths.Real | How long the animation runs, in milliseconds. |
easeIn | Maths.Real | Strength of the ease at the start. |
easeOut | Maths.Real | Strength of the ease at the end. |
Returns
Returns Maths.Integer — the eased progress interpolated between startValue and targetValue and rounded to a whole number.
Example
LET Maths.Integer step = Animate.Integer 0 10 1000.0 0.0 0.0Animate.LockAfter
Locks a value once a delay elapses.
Generics
| Name | Description |
|---|---|
ValueType | The type of the value being locked. |
Parameters
| Name | Type | Description |
|---|---|---|
value | ValueType | The value to keep unlocked until the delay elapses. |
durationMs | Maths.Real | The delay before locking, in milliseconds. |
Returns
Returns ValueType — the same value, unlocked until durationMs has passed and locked thereafter.
Animate.RGBA
Blends a colour from a start to a target over a duration, with easing.
Parameters
| Name | Type | Description |
|---|---|---|
startColor | Colour.RGBA | The colour at the start of the animation. |
targetColor | Colour.RGBA | The colour to reach at the end. |
durationMs | Maths.Real | How long the animation runs, in milliseconds. |
easeIn | Maths.Real | Strength of the ease at the start. |
easeOut | Maths.Real | Strength of the ease at the end. |
Returns
Returns Colour.RGBA — the colour eased from startColor to targetColor over durationMs.
Example
LET Colour.RGBA fade = Animate.RGBA start finish 300.0 1.0 1.0Animate.Real
Drives a real number from a start to a target over a duration, with easing.
Parameters
| Name | Type | Description |
|---|---|---|
startValue | Maths.Real | The value at the start of the animation. |
targetValue | Maths.Real | The value to reach at the end. |
durationMs | Maths.Real | How long the animation runs, in milliseconds. |
easeIn | Maths.Real | Strength of the ease at the start. |
easeOut | Maths.Real | Strength of the ease at the end. |
Returns
Returns Maths.Real — a reactive value that eases from startValue to targetValue over durationMs.
Example
LET Maths.Real slide = Animate.Real 0.0 100.0 500.0 1.0 1.0Animate.UnlockAfter
Unlocks a value once a delay elapses.
Generics
| Name | Description |
|---|---|
ValueType | The type of the value being unlocked. |
Parameters
| Name | Type | Description |
|---|---|---|
value | ValueType | The value to keep locked until the delay elapses. |
durationMs | Maths.Real | The delay before unlocking, in milliseconds. |
Returns
Returns ValueType — the same value, locked until durationMs has passed and unlocked thereafter.