VibeFX
Live preview · fully interactive

The prompt

Build a button that tilts toward the pointer and presses in.

## Look
Button background #7c6cff, white text, padding 18px 32px, radius 14px, 16px weight 700. The parent has perspective 600px. Page #08080d.

## Behavior
On pointer move, rotateY and rotateX by (offset - 0.5) * 16 degrees, so the edges reach about ±8deg. On pointer down, scale to 0.96. Reset on leave and pointer up.

## Design tokens
- Button #7c6cff; text #fff; page #08080d.

## Motion
- Press transition 120ms ease. Tilt updates every move, max 16deg before the 0.5 offset (so ±8deg).

## 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; perspective: 600px; } button { border: 0; background: #7c6cff; color: #fff; border-radius: 14px; padding: 18px 32px; font-size: 16px; font-weight: 700; cursor: pointer; transition: transform 120ms ease; }
  @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">Press in</button></main>

<script>

  var btn = document.getElementById("b");
  var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
  btn.addEventListener("pointermove", function (e) {
    if (reduce) return;
    var r = btn.getBoundingClientRect();
    var x = (e.clientX - r.left) / r.width - 0.5;
    var y = (e.clientY - r.top) / r.height - 0.5;
    btn.style.transform = "rotateY(" + (x * 16) + "deg) rotateX(" + (-y * 16) + "deg)";
  });
  btn.addEventListener("pointerleave", function () { btn.style.transform = ""; });
  btn.addEventListener("pointerdown", function () { btn.style.transform = "scale(0.96)"; });
  btn.addEventListener("pointerup", function () { btn.style.transform = ""; });
</script>
</body>
</html>

About this effect

Pointer position over the button sets a small rotateX and rotateY. Pointer down scales it to 0.96 for 120ms. A sibling of the existing magnetic button, with a press instead of a spotlight.

Similar effects