useFollowGlide

Returns a state that follows the reader's hands: when key changes while the timeline stands still, it glides there from wherever it is drawn.

@internote/canvas-sdk/reactHook
On this page
import { useFollowGlide } from '@internote/canvas-sdk/react';

For what the reader moves, not the timeline: a slider's slice. Any move on the timeline — a step entered either way, a replay — snaps, so the rule that only a step entered forwards animates holds here too; what the timeline moves glides through useGlide. The glide runs on the page's frames, since the reader's hands are not on the scene clock. At rest to comes back by identity.

#Signature

<T, Ctx>(
    runtime: EnvironmentAnimationRuntime<Ctx>,
    to: T,
    key: unknown,
    options: FollowGlideOptions<T>,
): {
    value: T;
    gliding: boolean;
}

#Parameters

runtime
The environment's runtime, ctx.animation.
to
The state to stand at.
key
What to was derived from, as a value compared by identity: a new key is a move.
options
How long the glide takes, how two states blend, and whether to glide at all.

Declared in packages/canvas-sdk/src/react/use-glide.ts:99.

Last updated