ParallaxLayer

new ParallaxLayer()

Parallax layer for scrolling backgrounds.

Extends

Classes

ParallaxLayer

Members

(readonly) properties

The entity that this component is attached to.

Inherited From

Methods

deserialize(props)

Populates the component properties from a data object. Override this method for custom property handling.

Parameters:
NameTypeDescription
propsobject

The properties object (usually from JSON).

Inherited From

draw(ctx, viewWidth, viewHeight)

Draw the parallax layer.

Parameters:
NameTypeDescription
ctxCanvasRenderingContext2D
viewWidthnumber

Viewport width.

viewHeightnumber

Viewport height.

updateOffset(cameraX, cameraY)

Update parallax offset based on camera position.

Parameters:
NameTypeDescription
cameraXnumber
cameraYnumber