Skip to main content

CanvasOptions

The CanvasOptions interface represents the options for configuring the game canvas.


Definition

interface CanvasOptions {
parent?: HTMLElement;
size?: Point;
autoSize?: boolean;
imageSmoothingEnabled?: boolean;
imageSmoothingQuality?: ImageSmoothingQuality;
backgroundColor?: string;
}

Properties

parent

  • Type: HTMLElement (optional)
    • Default value: document.body

The parent element to insert the canvas.

size

  • Type: Point (optional)
    • Default value: new Point(800, 600)

The size of the canvas.

autoSize

  • Type: boolean (optional)
    • Default value: true

Determines whether the canvas should automatically resize to fit the parent element.

imageSmoothingEnabled

  • Type: boolean(optional)
    • Default value: false

Determines whether image smoothing is enabled

imageSmoothingQuality

  • Type: ImageSmoothingQuality (optional)
    • Default value: high

The quality of image smoothing.

(none effective if imageSmoothingEnable is set to false)

backgroundColor

  • Type: string (optional)
    • Default value: #000000

The background color of the canvas.