All effectsPlay & loop

Animated Wave

循环波浪

Curving layers slide across a surface, like waves passing horizontally through water.

Play or pause the demo

Where to use it

Add gentle movement to an illustration, audio cover or decorative divider. Put the moving edge in an area where it can progress sideways without crossing labels or signals that carry meaning.

Practical example

An aquarium’s event page separates the opening-hours section from its exhibit list with two overlapping wave bands. The bands move sideways at different speeds while the opening hours stay easy to scan above them.

AI prompt

Add an Animated Wave to [target surface]. Clip two wide curved layers and move them laterally at different intervals. Keep the upper edge clearly readable and use a stationary wave with reduced motion.

Example code

Save the standalone HTML as a file and open it in your browser. It uses the same code as the preview.

View HTML
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Animated Wave</title>
  <style>
    :root {
      color-scheme: dark;
      --demo-bg: #171629;
      --demo-ink: #f8f5ff;
      --demo-accent: #b9a6ff;
      --demo-muted: #bfbbd3;
      font-family: system-ui, sans-serif;
      color: var(--demo-ink);
      background: var(--demo-bg);
    }

    *, *::before, *::after { box-sizing: border-box; }
    body { margin: 0; min-width: 0; }
    button, input { font: inherit; }

    .demo {
      display: grid;
      place-items: center;
      align-content: center;
      min-height: 100vh;
      padding: 14px;
      overflow: hidden;
      background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
    }

    .demo-button {
      border: 1px solid #ffffff3d;
      border-radius: 7px;
      background: #ffffff12;
      color: var(--demo-ink);
      padding: 6px 11px;
      font-size: 12px;
      cursor: pointer;
    }

    :focus-visible {
      outline: 2px solid var(--demo-accent);
      outline-offset: 3px;
    }

    .wave { position: relative; overflow: hidden; width: min(100%, 235px); height: 96px; border-radius: 14px; background: #103646; }
    .wave i {
      position: absolute; top: 38%; left: -52%; width: 181%; height: 180%;
      border-radius: 44%; background: #399aae;
      animation: wave 4.4s ease-in-out infinite alternate;
    }
    .wave i:nth-child(2) { top: 52%; left: -34%; background: #74dfcd; animation-duration: 5.9s; animation-direction: alternate-reverse; }
    @keyframes wave { to { transform: translateX(30%) translateY(-10px) rotate(12deg); } }

    .motion-example { display: grid; justify-items: center; width: 100%; gap: 10px; }
    .motion-specimen {
      display: grid;
      place-items: center;
      width: min(100%, 295px);
      height: 108px;
      position: relative;
      isolation: isolate;
    }
    .motion-example [data-motion] { animation-play-state: paused; }
    .motion-example[data-playing] [data-motion] { animation-play-state: running; }
    @media (prefers-reduced-motion: reduce) {
      .motion-example [data-motion] { animation: none; }
      .motion-example [data-loop-toggle] { display: none; }
    }
  </style>
</head>
<body>
  <main class="demo">
    <div class="motion-example">
      <div class="motion-specimen" aria-hidden="true"><div class="wave"><i data-motion></i><i data-motion></i></div></div>
      <button class="demo-button" type="button" data-loop-toggle data-testid="effect-demo-loop-toggle">Play demo</button>
    </div>
  </main>
  <script>
    const example = document.querySelector('.motion-example');
    const toggle = example.querySelector('[data-loop-toggle]');

    toggle.addEventListener('click', () => {
      const playing = example.toggleAttribute('data-playing');
      toggle.textContent = playing ? "Pause demo" : "Play demo";
    });
  </script>
</body>
</html>

Original example by UI Skills