VibeFX
Live preview · fully interactive

The prompt

Build a click-origin fill ripple on a button.

## Look
Button background #16161f, text #f2f2f7, radius 12px, overflow hidden. Ripple is a circle rgba(124,108,255,0.7). Page #08080d.

## Behavior
On pointer down, place a 16px circle at the local click point. Grow it to 256px and fade it out, then remove it.

## Design tokens
- Ripple rgba(124,108,255,0.7); button #16161f; page #08080d.

## Motion
- Duration 550ms, linear scale and fade.

## 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; }
  main { min-height: 100vh; display: grid; place-items: center; } button { position: relative; overflow: hidden; border: 0; background: #16161f; color: #f2f2f7; border-radius: 12px; padding: 16px 28px; font-weight: 700; cursor: pointer; } .rip { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: rgba(124,108,255,0.7); pointer-events: none; }
  @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>
<main><button id="b">Wash</button></main>

<script>

  var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
  document.getElementById("b").addEventListener("pointerdown", function (e) {
    var r = e.currentTarget.getBoundingClientRect();
    var rip = document.createElement("i");
    rip.className = "rip";
    rip.style.left = (e.clientX - r.left) + "px";
    rip.style.top = (e.clientY - r.top) + "px";
    e.currentTarget.appendChild(rip);
    var born = performance.now();
    function grow(now) {
      var t = Math.min(1, (now - born) / 550);
      var size = 16 + t * 240;
      rip.style.width = size + "px";
      rip.style.height = size + "px";
      rip.style.marginLeft = (-size / 2) + "px";
      rip.style.marginTop = (-size / 2) + "px";
      rip.style.opacity = String(1 - t);
      if (t < 1 && !reduce) requestAnimationFrame(grow);
      else rip.remove();
    }
    requestAnimationFrame(grow);
  });
</script>
</body>
</html>

About this effect

Pointer down plants a circle at the click, scaled from 0 to a size that covers the button over 0.55s, then fades. Different from the existing material ripple: this one is a full violet wash.

Similar effects