useGlide

Returns where a derived state is gliding: from the live step's latest change to now.

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

deriveAt is evaluated once per change, against a runtime read just before it fired, and memoised on that moment and deps; the environment blends from and to by t however its state blends. The host's frame loop runs while t is under 1.

#Signature

<T, Ctx>(
    runtime: EnvironmentAnimationRuntime<Ctx>,
    to: T,
    deriveAt: (runtime: EnvironmentAnimationRuntime<Ctx>) => T,
    deps: DependencyList,
    options: GlideOptions,
): Glide<T>

#Parameters

runtime
The environment's runtime, ctx.animation.
to
The state now, as the environment derives it at this render.
deriveAt
The same derivation, against a runtime read at another moment. Pure.
deps
What else the derivation reads, which re-derives the start when it changes.
options
How long the glide takes, and whether to glide at all.

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

Last updated