All effectsPlay & loop

Metaball Merge

液滴融合

Two independent shapes form a soft bridge as they approach and separate into drops again as they move apart.

Play or pause the droplets

Where to use it

Animate decorative loading indicators, expressive backgrounds, or an emblem with liquid motion. Use a small number of shapes so the soft bridge has room to form and the moment of merging stays visible.

Practical example

A collaborative mood-board app plays a short illustration when a second editor joins a session. Two avatar-colored droplets pull a soft bridge between them as they approach, then separate to leave two distinct shapes.

AI prompt

Create a metaball merge for [target area]. Animate two separate circles independently and run them through a shared SVG Gaussian blur and alpha threshold so their edges join only when fields overlap. Limit the filter region to the illustration. Provide a pause control and a stable composition 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>Metaball Merge</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;
    }

    .merge-demo { display: grid; justify-items: center; gap: 8px; width: min(100%, 360px); }
    .merge-scene { display: block; width: 100%; height: clamp(92px, 50vh, 152px); border: 1px solid #c183c059; border-radius: 13px; background: radial-gradient(ellipse at 50% 52%, #51324e, #261e39 70%); }
    .drop-left { animation: approach-left 3.4s ease-in-out infinite paused; }
    .drop-right { animation: approach-right 3.4s ease-in-out infinite paused; }
    .merge-demo[data-playing] circle { animation-play-state: running; }
    @keyframes approach-left { 0%, 100% { transform: translateX(0); } 48%, 52% { transform: translateX(45px); } }
    @keyframes approach-right { 0%, 100% { transform: translateX(0); } 48%, 52% { transform: translateX(-45px); } }
    @media (prefers-reduced-motion: reduce) {
      .drop-left, .drop-right { animation: none; }
      .drop-left { transform: translateX(45px); }
      .drop-right { transform: translateX(-45px); }
      .merge-demo button { display: none; }
    }
  </style>
</head>
<body>
  <main class="demo">
    <div class="merge-demo">
      <svg class="merge-scene" viewBox="0 0 244 106" aria-hidden="true">
        <defs>
          <linearGradient id="droplet-hue" x1="0" y1="0" x2="1" y2="1">
            <stop stop-color="#ffd8ab" />
            <stop offset="1" stop-color="#fa85bf" />
          </linearGradient>
          <filter id="droplet-goo" x="-20%" y="-40%" width="140%" height="180%" color-interpolation-filters="sRGB">
            <feGaussianBlur in="SourceGraphic" stdDeviation="5.5" result="softened" />
            <feColorMatrix in="softened" type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 18 -8" />
          </filter>
        </defs>
        <path d="M 18 53 H 226 M 122 13 V 93" stroke="#75637e" stroke-dasharray="2 5" fill="none" opacity=".45" />
        <g filter="url(#droplet-goo)" fill="url(#droplet-hue)">
          <circle class="drop-left" cx="56" cy="49" r="25" />
          <circle class="drop-right" cx="188" cy="57" r="22" />
        </g>
      </svg>
      <button class="demo-button" type="button" data-testid="effect-demo-loop-toggle" aria-pressed="false">Play demo</button>
    </div>
  </main>
  <script>
    const example = document.querySelector('.merge-demo');
    const toggle = example.querySelector('button');
    toggle.addEventListener('click', () => {
      const playing = example.toggleAttribute('data-playing');
      toggle.setAttribute('aria-pressed', String(playing));
      toggle.textContent = playing ? "Pause demo" : "Play demo";
    });
  </script>
</body>
</html>

Original example by UI Skills

Further examples