Primitives / foldkit-primitives/motion
Tween
const · packages/primitives/src/motion/tween.ts:25
| Args | { from: number, to: number, ms: number } |
|---|---|
| Model | { value: number, running: boolean } |
| Messages | Stopped, Started, Ticked { value: number }, Finished { value: number } |
Its full type
const Tween: Bundle.Bundle<
'Tween',
{ readonly from: number; readonly to: number; readonly ms: number },
{ readonly value: number; readonly running: boolean },
| { readonly _tag: 'Stopped' }
| { readonly _tag: 'Started' }
| { readonly _tag: 'Ticked'; readonly value: number }
| { readonly _tag: 'Finished'; readonly value: number },
never,
never,
never,
NoView,
{},
{},
undefined
>A tween as a bundle: a number animated from one value to another over a
duration, in the Model. Progress comes from Effect's clock, so tests drive
it with TestClock; the stream ends with Finished, and the value rests at
to. Linear interpolation only: easing curves stay the application's job.
In the guides
- Find a primitive by taskPrimitives / foldkit-primitives
- Subpaths by concernPrimitives / foldkit-primitives
- foldkit-primitives/motionPrimitives / Motion
- Start with one: a tweenPrimitives / Motion
- Presence: let content leavePrimitives / Motion