No.197 · Backgrounds
Spotlight Grid
Faint graph-paper dots on black, with a brighter grid revealed by a soft torch that eases after your cursor.
The prompt
Written for the variant you picked above: Phosphor
Create a section background of faint dots on pure black: a 1px white dot at 5% opacity tiled every 28px. Stack a second, identical grid on top whose dots are the accent colour at 38%, and reveal it only through a 450px circular mask — solid at the centre, 50% at 38% of the radius, gone by 72% — positioned at CSS variables for x and y. The effect is a torch sweeping across graph paper. Drive the variables with a tiny rAF loop that lerps the spotlight position toward the pointer (factor 0.15) and its opacity toward 1 on enter / 0 on leave (factor 0.12). The loop runs only while there's something to animate and stops itself once the light has faded out and settled (<0.5px and <0.008 opacity). On first entry, snap the position to the pointer so the light fades in where you are instead of sliding in from a corner. On touch devices, show a resting pool of light at (50%, 40%). Under reduced motion, show a very soft (18%) fixed glow at (50%, 38%) and skip the loop. Selected variant — Phosphor (phosphor): Accent #86efac (phosphor green): the revealed dots glow terminal-green; the eyebrow label uses the same green. 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 lit grid fades in under the cursor and trails it smoothly; it fades out when the pointer leaves. Motion: Position lerp 0.15/frame, opacity lerp 0.12/frame; the rAF loop self-terminates once settled. Accessibility: Decorative layer is aria-hidden; children render above it at z-index 1. Reduced motion shows a static glow. Responsive behavior: Fills its container; grid gap and spotlight radius are props. Touch: A static pool of light at (50%, 40%) replaces cursor tracking. 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 lit grid fades in under the cursor and trails it smoothly; it fades out when the pointer leaves.
- Motion
- Position lerp 0.15/frame, opacity lerp 0.12/frame; the rAF loop self-terminates once settled.
- Accessibility
- Decorative layer is aria-hidden; children render above it at z-index 1. Reduced motion shows a static glow.
- Responsive
- Fills its container; grid gap and spotlight radius are props.
- On touch
- A static pool of light at (50%, 40%) replaces cursor tracking.