CanvasAttrSpec

An attribute in an environment's vocabulary: the compiler's attribute spec, plus whether and how the value animates.

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

An animatable attribute is emitted to the compiler as a plain string, because a keyframe chain cannot be parsed by the declared value type. The declared type still governs how the base value and each keyframe target are refined after the compile.

#Fields

aliases
Other names source may write the attribute under; the compiled node carries the canonical name.
string[]
animatable
How the value interpolates under !cue.to. Absent means the attribute cannot be animated.
InterpolationKind
default
Parsed through type; arrays/numbers/booleans are stringified first. Defaults for inline/record/reference types are written in SOURCE syntax as strings (e.g. '!(x: 1)').
unknown
required
Optionality is required, and nothing else — no type means "or nothing".
boolean
type
REQUIRED — there is no implicit string. A default of the most permissive type is what an unconsidered attribute receives by accident, making it indistinguishable from a deliberately textual one. The rule governs the EFFECTIVE merged attribute, so refining a primitive's attribute need not restate its type.
TypeRefSpec

#Example

attributes: {
    zoom: { type: 'float', default: 1, animatable: 'number' },
    'x-domain': { type: 'interval', default: '[-10, 10]', animatable: 'interval' },
    colour: { type: 'paint', default: 'blue' },
}

Declared in packages/canvas-sdk/src/environment/compile-spec.ts:34.

Last updated