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 ​
new ParallaxLayer(options): ParallaxLayer;Defined in: src/parallax/ParallaxLayer.ts:79
Parameters ​
| Parameter | Type |
|---|---|
options | ParallaxLayerOptions |
Returns ​
ParallaxLayer
Properties ​
cull ​
cull: boolean;Defined in: src/parallax/ParallaxLayer.ts:59
depth ​
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 ​
factorX: number;Defined in: src/parallax/ParallaxLayer.ts:52
factorY ​
factorY: number;Defined in: src/parallax/ParallaxLayer.ts:53
offsetX ​
offsetX: number;Defined in: src/parallax/ParallaxLayer.ts:54
offsetY ​
offsetY: number;Defined in: src/parallax/ParallaxLayer.ts:55
snap ​
snap: boolean | undefined;Defined in: src/parallax/ParallaxLayer.ts:58
speedX ​
speedX: number;Defined in: src/parallax/ParallaxLayer.ts:56
speedY ​
speedY: number;Defined in: src/parallax/ParallaxLayer.ts:57
view ​
readonly view: Container<ContainerChild>;Defined in: src/parallax/ParallaxLayer.ts:51
Methods ​
destroy() ​
destroy(): void;Defined in: src/parallax/ParallaxLayer.ts:165
Returns ​
void
remeasure() ​
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() ​
update(camera, dtMs): void;Defined in: src/parallax/ParallaxLayer.ts:122
Places the layer for this frame; dtMs advances the drift.
Parameters ​
| Parameter | Type |
|---|---|
camera | ParallaxCamera |
dtMs | number |
Returns ​
void