Skip to main content

Function: createCanvas()

createCanvas(container, id?, width?, height?): HTMLCanvasElement

Defined in: rendering/utilities/create-canvas.ts:10

Creates a canvas element with the specified ID, dimensions, and appends it to the given container.

Parameters​

container​

HTMLElement

The HTML element to which the canvas will be appended.

id?​

string

The ID to assign to the canvas element.

width?​

number

The width of the canvas (default: container.clientWidth).

height?​

number

The height of the canvas (default: container.clientHeight).

Returns​

HTMLCanvasElement

The created canvas element.