Canvas Toolkit
← Class index

CVariantAnimation

Animation · extends CAbstractAnimation

Interpolates numbers or all components of a geometry value without rounding. Numbers remain the default. The first endpoint or key fixes the runtime value kind; configure a geometry value before using a geometry animation. The other endpoint defaults to all zeroes (start) or all ones (end) of the same kind. Key steps use effective progress after the easing curve is applied. Inputs, getters and signal values are copied to protect stored geometry. Elastic extrapolation is preserved, including negative size components.

import { CVariantAnimation } from "canvas-toolkit-lib";

Declared members

readonly valueChanged: CSignal<[T]>;
startValue(): T;
endValue(): T;
currentValue(): T;
setStartValue(value: T): void;
setEndValue(value: T): void;
keyValueAt(step: number): T | null;

Exact key lookup, including the implicit start (0) and end (1); null if absent.

keyValues(): CAnimationKeyValue<T>[];

A sorted, independent snapshot including start and end. Geometry is copied.

setKeyValueAt(step: number, value: T): void;

Keys refer to eased progress, not necessarily elapsed time. Replaces equal steps.

setKeyValues(values: readonly CAnimationKeyValue<T>[]): void;

Atomically replaces intermediate keys. Supplied 0/1 keys replace endpoints; omitted endpoints retain their values. [] clears intermediate keys. Input may be unsorted; the last occurrence of a duplicate step wins.

easingCurve(): CEasingCurve;
setEasingCurve(curve: CEasingCurve | CEasingCurveType): void;
applyCurrentValue(): void;

Re-emits a copy even when the current value has not changed.

protected updateCurrentTime(time: number): void;