Backgrounds · Component Template
Interactive Dot Grid
A regular grid of dots seen in perspective becomes a glowing terrain flying toward you. Contours burn brighter, a scanner sweeps to the horizon, and the ground swells under your pointer.
Live demo
Move across the terrain to read its elevation, click to ping, or switch the color ramp.
The Prompt
Build a hero whose background is a dot grid with depth: 76,000 points laid out as a regular grid on the ground and seen in perspective, so they form a glowing terrain that flies slowly toward the viewer. Points are colored by height, the ones that fall on contour lines burn brighter so a map appears inside the cloud, a scanner line sweeps away to the horizon, the ground swells up under the pointer and a click sends a ring racing outward. It is for Fieldline, an aerial LiDAR survey company, and a live readout gives the elevation under the pointer. Match my project's existing stack, conventions, and design tokens. If there are none, output a single HTML file with inline CSS and JavaScript and zero dependencies. Raw WebGL points; no Three.js, no textures, no noise library.
LOOK
- Page #050308, text #F5F1EA, secondary text at 64%, one accent #FF7A3D. ui-sans-serif, system-ui. Headline clamp(38px, 5.6vw, 96px), weight 640, line-height 0.93, letter-spacing -0.05em.
- Layout: nav across the top (a small dotted mark and "Fieldline", links Surveys, Method, Coverage, a white pill "Request a survey"); copy bottom left; a glass readout and a glass control dock bottom right.
- Copy: h1 "Every meter of ground, measured from the air." Then "Fieldline flies LiDAR over land that is hard to walk: quarries, coastlines, forest floor. What comes back is a cloud of points, like this one. Move across it. Click to ping." and the pill again.
- Readout: Elevation at pointer, Position ("2.6 km E, 0.4 km N"), Points in view. Dock: "Color by height" with a three-way switch, Thermal, Terrain, Mono, whose thumb slides on a spring using :has().
- A dark radial veil sits behind the copy (opaque at the bottom-left corner, clear by three quarters of the way out) so no dot ever fights the text. Film grain at 9%. The cursor is a crosshair.
THE GROUND
- One height function, a sum of sines after a small domain warp, returning 0 to 1:
q = p + 0.35 (sin(0.9 p.y + 1.3), sin(0.8 p.x + 2.1));
h = 0.42 sin(0.55 q.x + 0.3) sin(0.47 q.y + 1.7) + 0.26 sin(1.13 q.x - 0.71 q.y + 2.2) + 0.2 (1 - 2 |sin(0.85 q.x + 1.2 q.y + 0.7)|) + 0.12 sin(2.17 q.x + 1.63 q.y + 0.5) sin(1.31 q.y - 0.8) + 0.07 sin(4.1 q.x - 3.3 q.y + 1.1) + 0.04 sin(7.9 q.x + 6.7 q.y + 3);
height = clamp(0.5 h + 0.5, 0, 1)^1.6.
The |sin| term makes ridges; the power flattens valleys and sharpens peaks.
- Write it twice with identical numbers, once in GLSL and once in JavaScript. Because it uses no hash, both give the same answer, so the readout is true to the picture.
THE GRID
- 340 columns by 224 rows (170 columns under 820px), 0.036 apart across and 0.04 apart in depth, from z = -7.6 at the horizon to about 1.3 near the camera. The only vertex attribute is (column, row).
- Flying: a distance uFly grows at 0.16 per second. Each row sits at z = -7.6 + (row + fract(uFly / 0.04)) x 0.04 and samples the ground at (row - floor(uFly / 0.04)) x 0.04, so rows glide toward the viewer and wrap without a seam, each carrying its own patch of ground.
- Camera at (0, 1.55, 2.2), pitched down 0.5 radians, focal length 2.14, projected by hand in the vertex shader. It drifts sideways a little with the pointer.
- Height is scaled by 1.2.
EACH POINT
- Size: (1.35 + 5.6 / distance) px, so near points are large discs and far ones are dust. Grows on contours, in the scan line, under the pointer and in a ring.
- Contours: smoothstep(0.16, 0.02, |fract(11 h) - 0.5|). Points on a contour are more than twice as bright.
- Color ramps, crossfaded when the switch changes. Thermal: violet (0.2, 0.08, 0.55), magenta (0.78, 0.14, 0.6), orange (1, 0.4, 0.2), pale gold (1, 0.92, 0.6). Terrain: deep teal, sea green, sand, white. Mono: slate to ice.
- Alpha: min(1, 3.4 / distance^1.3), which keeps the dense far rows from burning out, times a fade over the last 2.5 units before the horizon. Additive blending, soft round points.
- Scanner: a Gaussian band in z that travels from the near edge to the horizon every seven seconds, whitening and enlarging points as it passes.
POINTER
- Cast a ray from the camera through the pointer and intersect it with the plane y = 0 (do this in JavaScript with the same camera numbers). Ease the hit point at 9 per second.
- The ground rises 0.4 under it with a Gaussian falloff (2.6), and those points brighten.
- Click: one ring, front = distance - 2.4 x age, drawn as exp(-5 front²) x exp(-1.1 age), which lifts the ground into a rippling crest and flashes white.
- A small DOM marker (a ring and a pill tag) follows the pointer and shows the elevation there: 180 + height x 2240 meters, from the JavaScript copy of the height function at the same ground position, including the fly offset.
- After three idle seconds an invisible hand flies a slow survey pattern so embeds are never still.
MOTION
- Load: the terrain grows out of the flat from the near edge to the horizon over 2.4 seconds; headline words rise from clipping boxes; the nav, copy and panels sharpen from a blur and settle on a CSS spring (a damped spring sampled into linear()).
ACCESSIBILITY
- The canvas and marker are aria-hidden. The readout is a definition list of real text. The ramp switch is three radio inputs in a labeled group.
- Pause when the tab is hidden.
- prefers-reduced-motion: no flying, scanner or idle pattern. The field redraws only while the pointer moves, a ring is running or the ramp is changing.
NEVER
- No lines joining the points, no triangles, no wireframe mesh.
- No random noise texture: the ground must be the same function in shader and script.
- No dots over the copy.
- No rainbow. One ramp at a time, low to high.
- CopyThe full prompt, one click.
- PasteInto Cursor, Claude Code, or any agent.
- CompareAgainst the live demo above.