Represents a distant mountain chunk with varying heights and colors.

Hierarchy (view full)

  • Layer
    • BackgroundMountainLayer

Constructors

Properties

Methods

Constructors

  • Constructor for generating a distant mountain chunk with varying heights and colors.

    Parameters

    • xOffset: number

      The x-axis offset.

    • yOffset: number

      The y-axis offset.

    • Optional seed: number = DEFAULT_SEED

      The seed for the noise function.

    • Optional width: number

      The width of the mountain.

    • Optional height: number

      The overall height of the mountain.

    Returns BackgroundMountainLayer

Properties

elements: Element[] = []

An array of Elements.

range: Range = ...

The tag for the layer.

x: number = 0

The x-coordinate.

y: number = 0

The y-coordinate.

Methods

  • Adds an object at the beginning of elements array. This way object will be rendered first, thus being a background.

    Parameters

    Returns void

  • Renders the layer asynchronously using a web worker.

    Parameters

    • frameNum: number

      The frame number.

    • layerNum: number

      The layer number.

    Returns Promise<string>

    A promise that resolves to the rendered layer as an SVG string.