No.184 · Backgrounds
Gravity Grid
A hairline grid that bends around the content placed on it — headlines and cards act as masses and dent the field, so the background frames what matters.
The prompt
Written for the variant you picked above: Frost
Build a background whose field responds to the layout placed on it, not to decoration. Render a hairline grid (30px) on a 2D canvas behind the content. Every descendant with a data-mass attribute is measured (ResizeObserver on the wrapper and each mass, re-measured after fonts load) and treated as a rectangular mass. For each grid sample (every 6px along each line) find the nearest point on each mass rectangle (expanded 10px). Pull the sample toward it by min(0.82·d, m·strength·(14 + 0.09·√area)·e^(−d/σ)), with σ = 40 + 0.22·√area — so lines bow in toward content, strongest near it, never crossing into it. Lines brighten from 7.5% to ~28% alpha as they bend ('heat'), fade out entirely within 18px of a mass and inside it, so text always sits on clean ground. Grid intersections near a mass get tiny 1.5px dots. The pointer adds a small point mass (0.35) eased with a lerp; the canvas only animates while that mass is moving and otherwise is completely still. Cap DPR at 2. Under reduced motion the pointer is ignored — the layout-driven bend remains. Selected variant — Frost (frost): Grid colour #b9cce4 (frost blue) on #0a0c10; content ink #eef2f7, muted #8b95a3; eyebrow in the grid colour. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: The field is shaped by the content itself; moving the pointer adds a light, slow dimple that follows it. Motion: None at rest. Redraws on layout change; pointer mass eases with a 0.08 lerp and the loop stops when settled. Accessibility: Decorative canvas (aria-hidden) under real content; lines are removed beneath text for contrast. Reduced motion disables the pointer mass. Responsive behavior: Re-measures on any size change of the wrapper or of any mass, so it adapts to every breakpoint automatically. Touch: Without a hover pointer the grid simply frames the content; a drag moves the dimple. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.
Notes
- Interaction
- The field is shaped by the content itself; moving the pointer adds a light, slow dimple that follows it.
- Motion
- None at rest. Redraws on layout change; pointer mass eases with a 0.08 lerp and the loop stops when settled.
- Accessibility
- Decorative canvas (aria-hidden) under real content; lines are removed beneath text for contrast. Reduced motion disables the pointer mass.
- Responsive
- Re-measures on any size change of the wrapper or of any mass, so it adapts to every breakpoint automatically.
- On touch
- Without a hover pointer the grid simply frames the content; a drag moves the dimple.