Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

ParallaxLayerProps

What ParallaxLayer takes.

Property Type Default value Description
children? ReactNode undefined What the layer draws, written within one period of origin: meshes, never an Entity, which the loop places in the world wherever its parent stands. Each repeat is a copy of them.
origin? readonly [number, number] [0, 0] Where on the plane the children stand as written: while the camera’s frame is centred here, they draw where they are written. Godot’s scroll_offset.
repeatSize? readonly [number, number] [0, 0] Metres on the plane after which the children repeat, right and up, 0 for no repeat on that axis. Under an orthographic Camera2D the copies cover the frame however far the camera goes; a perspective one draws a deep layer wider than the plane, which they may not cover. Whole texels under a pixel-perfect camera, or a seam shows where two copies meet. Godot’s repeat_size.
scrollFactor number | readonly [number, number] undefined The share of the camera’s movement the layer moves by on the screen: 0 stays with the camera, a sky; 1 moves with the world; a share between is a distance, and above 1 a foreground. One number for both axes, or right and up on the plane. Phaser’s scrollFactor and Godot’s scroll_scale, both 1 unless set; required here, since a layer with no factor has no parallax.