Reference Source
import {Layer} from 'parallax/src/layer.mjs'
public class | source

Layer

Constructor Summary

Public Constructor
public

Member Summary

Private Members
private

config(horizontalSpeed: number, verticalSpeed: number, plane: number, backgrounds: Diob[] | MapObject[], instances: Set): Object

The configuration object of this layer.

Method Summary

Public Methods
public

add(pInstance: Diob, pConfig: Object)

Adds the instance to the parallax layer.

public

remove(pInstance: Diob)

Removes the instance from the parallax layer.

public

updateConfigSpeed(pConfig: Object, pUpdateLayerConfigOnly: boolean)

Updates the configuration speed of the layer.

public

updateHorizontalSpeed(pHorizontalSpeed: number, pUpdateLayerConfigOnly: boolean)

Updates the horizontal speed of this layer.

public

updateVerticalSpeed(pVerticalSpeed: number, pUpdateLayerConfigOnly: boolean)

Updates the vertical speed of the layer.

Public Constructors

public constructor() source

Private Members

private config(horizontalSpeed: number, verticalSpeed: number, plane: number, backgrounds: Diob[] | MapObject[], instances: Set): Object source

The configuration object of this layer.

Public Methods

public add(pInstance: Diob, pConfig: Object) source

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.

Params:

NameTypeAttributeDescription
pInstance Diob

The instance to add to the layer.

pConfig Object
  • optional

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

public remove(pInstance: Diob) source

Removes the instance from the parallax layer.

Params:

NameTypeAttributeDescription
pInstance Diob

The instance to remove from the layer.

public updateConfigSpeed(pConfig: Object, pUpdateLayerConfigOnly: boolean) source

Updates the configuration speed of the layer.

Params:

NameTypeAttributeDescription
pConfig Object

The speed configuration of the parallax layer.

pUpdateLayerConfigOnly boolean

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

public updateHorizontalSpeed(pHorizontalSpeed: number, pUpdateLayerConfigOnly: boolean) source

Updates the horizontal speed of this layer.

Params:

NameTypeAttributeDescription
pHorizontalSpeed number

The new horizontal speed.

pUpdateLayerConfigOnly boolean

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

public updateVerticalSpeed(pVerticalSpeed: number, pUpdateLayerConfigOnly: boolean) source

Updates the vertical speed of the layer.

Params:

NameTypeAttributeDescription
pVerticalSpeed number

The new vertical speed.

pUpdateLayerConfigOnly boolean

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