TimelineValue

Timeline values: a Live value derived from a container's scroll by ranges alone, which the browser draws with the scroll itself, on a native ScrollTimeline or ViewTimeline, so it doesn't trail a scroll the browser runs off the main thread. The gate goes on writing the key: the animation draws over it, and where the timeline can't (a container that doesn't overflow) the gate's value shows.

A binding makes one for a key whose Live value core describes (LiveValue.scrollDerivationOf), and hands it to the gate while the key shows it (FlushGate's timeline). It's built only where it draws what the gate would: make gives None for anything else, which the gate draws as ever.

import * as TimelineValue from "@wardic/dom/TimelineValue"

const derivation = Option.getOrThrow(LiveValue.scrollDerivationOf(opacity))
const timeline = yield* TimelineValue.make(derivation, element, "opacity")

Interfaces

TimelineValue

A key's Timeline value on one element: its native animation, run while its key shows it and nothing else draws its property. The gate syncs it at each flush that commits the element, before the commit.

Properties

cancel
readonly cancel: () => void;

Stop its animation, and its watch on the sizes its direction reads. A later sync starts it again.

Returns

void

key
readonly key: string;

The key it draws.

sync
readonly sync: (values) => void;

Run its animation, or stop it, for the element's values now: it runs while nothing else adds to its property (for transform, no other transform key off its identity, no projection, no Transform template; for opacity, no projection). Per flush: plain statements.

Parameters
values

Readonly<Record<string, unknown>>

Returns

void

Variables

make

const make: (derivation, element, key) => Effect.Effect<Option.Option<TimelineValue>, never, InterpolatorRegistry.InterpolatorRegistry>;

A Timeline value for key on element, as derivation derives it from a scroll: its native animation, started by its first sync. None where it can't run on a native timeline as Wardic draws it (above): a browser with no scroll timelines or ranges, an element that isn't an HTML element, a key, a source or a derivation it doesn't take.

Parameters

derivation

LiveValue.ScrollDerivation

element

Element

key

string

Returns

Effect.Effect<Option.Option<TimelineValue>, never, InterpolatorRegistry.InterpolatorRegistry>