Class representing a water chunk with undulating waves.

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

  • Creates an instance of WaterChunk.

    Parameters

    • xOffset: number

      X-coordinate offset for the chunk.

    • yOffset: number

      Y-coordinate offset for the chunk.

    • Optional width: number

      Width of the waves.

    • Optional height: number

      Height of the waves.

    • Optional waveClusters: number = DEFAULT_WAVECLUSTERS

      Number of clusters of waves.

    Returns WaterLayer

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.