メインコンテンツまでスキップ

Interface: AnimationCanvasCommonProps

Defined in: react/src/components/AnimationCanvas/index.tsx:18

Properties​

animate?​

optional animate?: boolean;

Defined in: react/src/components/AnimationCanvas/index.tsx:39

Redraw on every animation frame. Turn it off to draw only when there is a reason to: when the canvas mounts, when it is resized, and when the component re-renders.

Default​

true

draw​

draw: CanvasDrawFunction;

Defined in: react/src/components/AnimationCanvas/index.tsx:26

Draw one frame. It is given the 2D context and the frame: the size in CSS pixels, count, deltaTime, elapsedTime and fps.

A new function replaces the old one in place, so writing it inline does not restart anything.


init?​

optional init?: CanvasInitFunction;

Defined in: react/src/components/AnimationCanvas/index.tsx:31

Called once before the first frame, with the context and the size in CSS pixels. Set up what every frame shares here.


options?​

optional options?: CanvasRenderingContext2DSettings;

Defined in: react/src/components/AnimationCanvas/index.tsx:46

Read once, when the 2D context is created, so changing it later has no effect. Passing a fresh object on every render is therefore harmless.

See​

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


reduceFlickering?​

optional reduceFlickering?: boolean;

Defined in: react/src/components/AnimationCanvas/index.tsx:54

Carry the drawing across a resize, so that the canvas does not blank for a frame while the new size is drawn. A fixed canvas is resized too, when its width or height changes.

Default​

true