EnvironmentAnimation

An environment's animation handlers: the engine calls in on step changes and vocabulary cues, and the environment never owns a timeline.

@internote/canvas-sdkInterface
On this page
import { EnvironmentAnimation } from '@internote/canvas-sdk';

The scene's clock belongs to the host. Presence, keyframe tracks and anchors are all resolved by the engine, and an environment reacts to them through these hooks and through ctx.animation.

#Fields

nodeAnimationMs
Returns how long one of this environment's own elements takes to act on the anchor named by anchorAttr (in, out or at), in milliseconds, or null to leave the generic rule standing.
(node: CompiledNode, anchorAttr: string) => number | null

The host measures the shared cue family off its attributes: a fade is its in-duration:, a verb's move is its duration:. A vocabulary element whose window is derived from its own content, such as text typed at a number of characters a second, has no attribute to read, and answers here instead. Called before any environment has mounted, like timeAnimationMs.

onStep
Called after every step change of the scene's timeline, with the step entered.
(index: number, ctx: EnvironmentContext) => void
timeAnimationMs
Returns how long this environment's own time-driven animation runs, in milliseconds, or 0 when it has none.
(node: CompiledNode) => number

The scene's clock is what the playback control drives, and its length is otherwise measured only from time-anchored cues. An environment whose content moves through time for its own reasons declares the length here, so the reader gets the same play control rather than a second one beside it. Called with the compiled node before any environment has mounted, so there is no session and no runtime to read.

verbs
Handlers for elements of the environment's own vocabulary that act as animation instructions, keyed by element identifier. Each is called when its element's step anchor fires, entering or leaving.
Record<string, VerbHandler<EnvironmentContext>>

Declared in packages/canvas-sdk/src/environment/types.ts:154.

Last updated