Spacetime grid / Options

Spacetime grid

Options

Every option of @abhiramkrishna/spacetime-grid, generated from the package's schema.

Pass options to the constructor, or to a wrapper as props. Options marked live can change at any time with grid.setOptions(). Options marked rebuild (cols, rows, cellSize, fill) set the size of the tile mesh, so changing them means creating a new grid; the Vue, React and Web Component wrappers do that for you.

TypeScript
const grid = new SpacetimeGrid(el, { cols: 80, waveAmplitude: 0.12, theme: { hover: "#5ee6ff" } });
grid.setOptions({ rippleSpeed: 3.5 });

These tables are generated from SPACETIME_GRID_SCHEMA, the same data the sandbox builds its controls from, so they always match the code.

Grid
colsnumber · 8–160 · rebuildsDefault64Number of tile columns.
rowsnumber · 8–160 · rebuildsDefault60Number of tile rows.
cellSizenumber · 0.1–1 · rebuildsDefault0.34Distance between tile centres, in world units.
fillnumber · 0.1–1 · rebuildsDefault0.72How much of each cell a tile covers (1 = no gap).
tileOpacitynumber · 0–1Default0.55Opacity of every tile.
Waves
waveAmplitudenumber · 0–0.4Default0.09Height of the idle waves.
waveSpeednumber · 0–4Default1Speed multiplier for the idle waves.
swaynumber · 0–0.2Default0.03How far the whole grid rocks from side to side, in radians.
Gravity well
cursorWellbooleanDefaulttrueSink the tiles under the mouse cursor.
wellRadiusnumber · 0.2–6Default2.2Radius of the cursor well, in world units.
wellDepthnumber · 0–2Default0.55How deep the cursor well sinks the tiles.
wellEasenumber · 0.01–1Default0.1How quickly tiles follow the well each frame (1 = instantly).
Ripples
ripplesbooleanDefaulttrueSend an energy ring across the grid on click or tap.
rippleSpeednumber · 0.2–8Default2.4How fast a ripple ring spreads, in world units per second.
rippleWidthnumber · 0.05–2Default0.55Thickness of the ripple ring.
rippleHeightnumber · 0–2Default0.55How high the ripple ring lifts the tiles.
rippleLifetimenumber · 0.2–8Default2.4Seconds before a ripple fades out.
Colours
theme: { base }colorDefault"#0c1f33"Resting tile colour.
theme: { hover }colorDefault"#43d9ad"Colour of tiles in a well, ripple or data glow.
theme: { fog }colorDefault"#011627"Fog colour; match it to the page background.
theme: { fresnel }colorDefault"#bfe9ff"Fresnel rim colour on tiles seen at a grazing angle.
Fog
fogNearnumber · 0–30Default5Distance where the fog begins.
fogFarnumber · 1–60Default12Distance where tiles fully fade into the fog.
Camera
fovnumber · 20–100Default50Vertical field of view, in degrees.
cameraEasenumber · 0.01–1Default0.06How quickly the camera moves toward its target each frame.
Rendering
maxPixelRationumber · 0.5–3Default2Upper limit on the device pixel ratio; lower is faster.
compactBreakpointnumber · 0–2000Default1024Below this canvas width (px) the grid drops lower and shrinks, for phones.
reducedMotion"auto" | "always" | "never"Default"auto"auto follows prefers-reduced-motion; always renders a still frame; never always animates.