VibeFX
Live preview · fully interactive

The prompt

Build a button whose border draws on.

## Look
200×56 control, radius 12px, label #f2f2f7 weight 700. SVG rect stroke #c4b5fd, width 1.5, dash array 520. Page #08080d.

## Behavior
Animate stroke-dashoffset from 520 to 0. Then fade the background to #7c6cff.

## Design tokens
- Stroke #c4b5fd; fill #7c6cff; text #f2f2f7; page #08080d.

## Motion
- Draw 1.1s ease. Background fade 0.4s starting at 0.8s.

## Constraints
- Single self-contained HTML file. No libraries. CSS only.
- 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; } .btn { position: relative; width: 200px; height: 56px; display: grid; place-items: center; color: #f2f2f7; font-weight: 700; } svg { position: absolute; inset: 0; width: 100%; height: 100%; } rect { fill: transparent; stroke: #c4b5fd; stroke-width: 1.5; stroke-dasharray: 520; stroke-dashoffset: 520; animation: draw 1.1s ease forwards; } @keyframes draw { to { stroke-dashoffset: 0; } } .btn { background: transparent; animation: fill 0.4s ease 0.8s forwards; border-radius: 12px; } @keyframes fill { to { background: #7c6cff; } }
  @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="btn"><svg viewBox="0 0 200 56"><rect x="1" y="1" width="198" height="54" rx="12"/></svg>Draw me</div></main>

<script>

</script>
</body>
</html>

About this effect

An SVG rect uses stroke-dashoffset over 1.1s. At 0.8s the button background fades to #7c6cff.

Similar effects