Class DarkMask

Defines the dark layer which hides the dark area not illuminated by a set of lights.

Hierarchy

  • DarkMask

Constructors

Properties

Methods

Constructors

  • Parameters

    • options: Partial<Pick<DarkMask, "color" | "lights">> = {}

      Options to be applied to the dark mask object.

    Returns DarkMask

Properties

color: string

The color of the dark area in RGBA format.

Default

"rgba(0,0,0,0.9)"
lights: Light[]

An array of Light objects that illuminate the rest of the scene.

Default

[]

Methods

  • Compute the dark mask.

    Parameters

    • width: number

      Width of the canvas context.

    • height: number

      Height of the canvas context.

    Returns void

  • Gives the dark mask's canvas back.

    Returns HTMLCanvasElement

    The canvas element.

  • Draws the dark mask onto the given context.

    Parameters

    • context: CanvasRenderingContext2D

      The canvas context on which to draw.

    Returns void