Skip to main content

Interface: AnimationCanvasOptions

Defined in: dom/src/canvas/animation.ts:42

Properties​

animate?​

optional animate?: boolean;

Defined in: dom/src/canvas/animation.ts:55

Keep drawing on every animation frame. When off, a frame is drawn only on a resize or an explicit AnimationCanvasInstance.redraw.

Default​

true

contextAttributes?​

optional contextAttributes?: CanvasRenderingContext2DSettings;

Defined in: dom/src/canvas/animation.ts:88

Passed to getContext('2d', …). Read once when the context is created, so it is fixed for the lifetime of the instance.

See​

https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/getContext#contextattributes


draw​

draw: CanvasDrawFunction;

Defined in: dom/src/canvas/animation.ts:44

Called for every frame.


init?​

optional init?: CanvasInitFunction;

Defined in: dom/src/canvas/animation.ts:47

Called once, after the first size is known and before the first frame.


reduceFlickering?​

optional reduceFlickering?: boolean;

Defined in: dom/src/canvas/animation.ts:80

Carry the drawing across a resize, so that the canvas does not blank for a frame while the new size is drawn.

Default​

true

resizable?​

optional resizable?: boolean;

Defined in: dom/src/canvas/animation.ts:72

Follow the size of the canvas's parent element instead of size.

Fixed for the lifetime of the instance: it decides whether a ResizeObserver is attached.

Default​

false

size?​

optional size?: object;

Defined in: dom/src/canvas/animation.ts:62

Size in CSS pixels. Ignored when resizable is on.

height​

height: number;

width​

width: number;

Default​

{ width: 100, height: 100 }