Class Layer

Constructors

  • Creates a new Parallax layer with the supplied configuration. When creating a layer, all instances and backgrounds should already be on the map.

    Parameters

    • pConfig: LayerConfig

      The configuration of the parallax layer.

    Returns Layer

Properties

config: {
    horizontalSpeed: number;
    verticalSpeed: number;
    plane: number;
    backgrounds: Set<unknown>;
    instances: Set<unknown>;
} = ...

The configuration object of this layer.

Type declaration

  • horizontalSpeed: number
  • verticalSpeed: number
  • plane: number
  • backgrounds: Set<unknown>
  • instances: Set<unknown>

Methods

  • Updates the configuration speed of the layer.

    Parameters

    • pConfig: LayerConfig

      The speed configuration of the parallax layer.

    • pUpdateLayerConfigOnly: boolean

      If only to update the layer config and not the instance config.

    Returns void

  • Updates the horizontal speed of this layer.

    Parameters

    • pHorizontalSpeed: undefined | number

      The new horizontal speed.

    • pUpdateLayerConfigOnly: boolean

      If only to update the layer config and not the instance config.

    Returns void

  • Updates the vertical speed of the layer.

    Parameters

    • pVerticalSpeed: undefined | number

      The new vertical speed.

    • pUpdateLayerConfigOnly: boolean

      If only to update the layer config and not the instance config.

    Returns void

  • Adds the instance to the parallax layer. When using this API the instance should already be on the map. The instance's 'plane' will be changed to match the plane of the layer.

    Parameters

    • pInstance: any

      The instance to add to the layer.

    • Optional pConfig: InstanceConfig

      The personal config of this instance. Akin to the parallax info passed via the Parallax.add API.

    Returns void

  • Gets all instances currently in this parallax layer.

    Returns any[]

    All instances currently in this parallax layer.

  • Gets all backgrounds currently in this parallax layer.

    Returns any[]

    All backgrounds currently in this parallax layer.

  • Removes the instance from the parallax layer.

    Parameters

    • pInstance: any

      The instance to remove from the layer.

    Returns void