VibeFX
Live preview · fully interactive

The prompt

Build a before-after compare card.

## Look
Card width min(360px, 100% - 32px), height 200px, radius 18px. Base #101018. Top layer is linear-gradient(135deg, #7c6cff, #22d3ee), clipped by width. Page #08080d.

## Behavior
A range from 8 to 92 sets the top layer width as a percent. Default 50.

## Design tokens
- Base #101018; gradient #7c6cff to #22d3ee; page #08080d.

## Motion
- Width updates on input with no extra transition.

## 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; } .card { position: relative; width: min(360px, calc(100% - 32px)); height: 200px; border-radius: 18px; overflow: hidden; background: #101018; } .top { position: absolute; inset: 0; background: linear-gradient(135deg, #7c6cff, #22d3ee); width: 50%; } input { position: absolute; inset: auto 0 12px; width: 80%; margin: 0 auto; }
  @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><div class="card"><div class="top" id="top"></div><input id="r" type="range" min="8" max="92" value="50" aria-label="Compare"></div></main>

<script>
document.getElementById("r").addEventListener("input", function (e) { document.getElementById("top").style.width = e.target.value + "%"; });
</script>
</body>
</html>

About this effect

A range input clips the top layer. The left side is a flat #101018 panel and the right is a violet gradient. No photos.

Similar effects