VibeFX
Live preview · fully interactive

The prompt

Build a pointer spotlight that reveals a headline.

## Look
Centered headline, clamp(32px, 6vw, 72px), tracking -0.04em, max 12ch, color #f2f2f7 on #08080d. A full-screen overlay uses a radial gradient.

## Behavior
Set CSS variables --x and --y from the pointer each frame. The gradient is a 180px circle: transparent at the center, rgba(8,8,13,0.2) at 28%, solid #08080d at 68%.

## Design tokens
- Page and mask edge #08080d; text #f2f2f7; hint #8a8a99.

## Motion
- Variable updates every frame. Idle orbit period about 700ms on x and 900ms on y until the user moves.

## Constraints
- Single self-contained HTML file. No libraries.
- Honor prefers-reduced-motion: reduce by skipping the loop and leaving a readable static frame
- Readable at 390px width with no horizontal page scroll

The code

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html, body { min-height: 100%; }
  body {
    background: #08080d; color: #f2f2f7; font-family: Inter, system-ui, sans-serif;
    min-height: 100vh; overflow: hidden;
  }
  .hint { position: absolute; left: 16px; top: 16px; z-index: 5; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a8a99; }
  .copy { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; } h1 { font-size: clamp(32px, 6vw, 72px); letter-spacing: -0.04em; max-width: 12ch; } #light { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(180px circle at var(--x) var(--y), transparent 0%, rgba(8,8,13,0.2) 28%, #08080d 68%); }
  @media (max-width: 420px) {
    .hint { font-size: 10px; letter-spacing: 0.08em; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  }
</style>
</head>
<body>
<p class="hint">Find the sentence</p><div class="copy"><h1>Motion you can paste into the build.</h1></div><div id="light"></div>

<script>

  var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
  var pointer = { x: window.innerWidth / 2, y: window.innerHeight / 2 };
  var userMoved = false;
  window.addEventListener("pointermove", function (e) {
    userMoved = true;
    pointer.x = e.clientX;
    pointer.y = e.clientY;
  });
  function idlePointer(now) {
    if (userMoved || reduce) return;
    pointer.x = window.innerWidth * (0.5 + Math.cos(now / 700) * 0.28);
    pointer.y = window.innerHeight * (0.5 + Math.sin(now / 900) * 0.2);
  }

  var light = document.getElementById("light");
  function frame(now) {
    idlePointer(now);
    light.style.setProperty("--x", pointer.x + "px");
    light.style.setProperty("--y", pointer.y + "px");
    if (!reduce) requestAnimationFrame(frame);
  }
  requestAnimationFrame(frame);
</script>
</body>
</html>

About this effect

A radial spotlight in violet-white follows the pointer across a dim headline, so the sentence is only readable inside the beam. Idle motion sweeps the light until the user takes over.

Similar effects