1681-engine / index / parallaxOrigin
Function: parallaxOrigin() ​
ts
function parallaxOrigin(
scroll,
factor,
offset?
): number;Defined in: src/parallax/parallaxMath.ts:11
The world position a layer is drawn at so that, on screen, it moves factor times as far as the camera: 0 stays fixed to the screen (a sky at infinity), 1 moves with the world, 0.5 at half speed, above 1 faster (a foreground). The layer lives in the world layer, so the camera's zoom scales it like everything else.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
scroll | number | undefined |
factor | number | undefined |
offset | number | 0 |
Returns ​
number