Skip to content

1681-engine / index / ParallaxLayer

Class: ParallaxLayer ​

Defined in: src/parallax/ParallaxLayer.ts:50

One layer of a Parallax: a texture or a display object that scrolls at a share of the camera's speed, optionally repeated and drifting. view goes into the world layer (the parallax adds it), so the camera's zoom and pixel rounding apply to it like to any world object; the layer only moves it.

Constructors ​

Constructor ​

ts
new ParallaxLayer(options): ParallaxLayer;

Defined in: src/parallax/ParallaxLayer.ts:79

Parameters ​

ParameterType
optionsParallaxLayerOptions

Returns ​

ParallaxLayer

Properties ​

cull ​

ts
cull: boolean;

Defined in: src/parallax/ParallaxLayer.ts:59


depth ​

ts
readonly depth: number | undefined;

Defined in: src/parallax/ParallaxLayer.ts:61

The depth it was given, if any (a Parallax numbers the others in the order they were added).


factorX ​

ts
factorX: number;

Defined in: src/parallax/ParallaxLayer.ts:52


factorY ​

ts
factorY: number;

Defined in: src/parallax/ParallaxLayer.ts:53


offsetX ​

ts
offsetX: number;

Defined in: src/parallax/ParallaxLayer.ts:54


offsetY ​

ts
offsetY: number;

Defined in: src/parallax/ParallaxLayer.ts:55


snap ​

ts
snap: boolean | undefined;

Defined in: src/parallax/ParallaxLayer.ts:58


speedX ​

ts
speedX: number;

Defined in: src/parallax/ParallaxLayer.ts:56


speedY ​

ts
speedY: number;

Defined in: src/parallax/ParallaxLayer.ts:57


view ​

ts
readonly view: Container<ContainerChild>;

Defined in: src/parallax/ParallaxLayer.ts:51

Methods ​

destroy() ​

ts
destroy(): void;

Defined in: src/parallax/ParallaxLayer.ts:165

Returns ​

void


remeasure() ​

ts
remeasure(): void;

Defined in: src/parallax/ParallaxLayer.ts:106

Measures the content again, after it was redrawn larger or smaller (culling reads the measured size).

Returns ​

void


update() ​

ts
update(camera, dtMs): void;

Defined in: src/parallax/ParallaxLayer.ts:122

Places the layer for this frame; dtMs advances the drift.

Parameters ​

ParameterType
cameraParallaxCamera
dtMsnumber

Returns ​

void

Released under the MIT License.