Back to the library

Fluid — pinch-off

Variant: Pinch-off

Tear-off with a threshold, drawn as a drop pulled from a pool. The hand drags at a constant 20px per slice and the drop gives it 18, then 14, then 10 — resistance written as shrinking linear segments rather than a curve, because the hand never slowed. The neck thins just before the dashed line, which is the warning; at the line it breaks, the drop closes the gap to the hand in 204ms on ease-out — stored stretch, released — and rings round once while the pool recoils and settles. The liquid is one SVG goo filter, a blur and an alpha threshold over plain circles, so the neck is never drawn: it emerges from where the circles are. Reach for it on drag-to-detach — tabs pulled into windows, cards torn off a stack, a chip lifted out of a group.

physicsgesturesvgloop

The source

A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Fluid — pinch-off</title>
    <style>
      :root {
        /* Neutrals — fixed, never remixed. */
        --ivory: #faf9f5;
        --paper: #ffffff;
        --oat: #e3dacc;
        --slate: #141413;

        /* Knobs — the remix API. A knob exists iff declared here and used below. */
        --hue: 38.8;
        --lift: 0;
        --chroma: 1;
        --speed: 1;

        /* Accents — derived from the knobs with the family's offsets baked in,
           so one hue roll moves them together. Defaults reproduce the original hex. */
        --clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
        --clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
        --olive: oklch(
          calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3)
        );
        --rust: oklch(
          calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3)
        );

        /* Clock — every duration in the document runs off --t. */
        --cycle: 3.4s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
        /* The hand's last 6px: its entry slope (2) matches the constant-speed
           drag before it, so the pointer decelerates instead of braking. */
        --ease-accent: cubic-bezier(0.25, 0.5, 0.5, 1);

        --_cue: color-mix(in oklch, var(--slate) 30%, var(--ivory));
      }

      * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
      }

      body {
        min-height: 100vh;
        display: grid;
        place-items: center;
        background: var(--ivory);
      }

      svg {
        display: block;
        width: 220px;
        height: 190px;
        overflow: visible;
      }

      .liquid {
        fill: var(--olive);
      }

      .liquid g,
      .liquid circle,
      .grip {
        transform-box: fill-box;
        transform-origin: center;
      }

      .threshold {
        fill: none;
        stroke: var(--_cue);
        stroke-width: 1.5;
        stroke-dasharray: 3 4;
        animation: threshold var(--t) infinite;
      }

      .lift {
        animation: lift var(--t) infinite;
      }

      .bead {
        animation: bead var(--t) infinite;
      }

      .n1 {
        animation: n1 var(--t) infinite;
      }
      .n2 {
        animation: n2 var(--t) infinite;
      }
      .n3 {
        animation: n3 var(--t) infinite;
      }
      .n4 {
        animation: n4 var(--t) infinite;
      }
      .base {
        animation: base var(--t) infinite;
      }

      .hand {
        animation: hand var(--t) infinite;
      }

      .grip {
        fill: var(--paper);
        stroke: var(--slate);
        stroke-width: 1.5;
        animation: grip var(--t) infinite;
      }

      /* The hand drags at constant speed, 20px per slice; the bead gives it
         18, 14, then 10px — resistance written as shrinking linear
         segments, not as a curve, because the hand never slowed. */
      @keyframes hand {
        0%,
        10% {
          transform: translateY(0);
          animation-timing-function: linear;
        }
        40% {
          transform: translateY(-60px);
          animation-timing-function: var(--ease-accent);
        }
        46%,
        100% {
          transform: translateY(-66px);
        }
      }

      @keyframes grip {
        0%,
        4% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        9%,
        76% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        82%,
        100% {
          opacity: 0;
          transform: scale(0.9);
        }
      }

      /* At 42px the neck lets go and the bead closes the gap to the hand
         in 204ms — the stored stretch, released. */
      @keyframes lift {
        0%,
        10% {
          transform: translateY(0);
          animation-timing-function: linear;
        }
        20% {
          transform: translateY(-18px);
          animation-timing-function: linear;
        }
        30% {
          transform: translateY(-32px);
          animation-timing-function: linear;
        }
        40% {
          transform: translateY(-42px);
          animation-timing-function: var(--ease-out);
        }
        46%,
        84% {
          transform: translateY(-66px);
        }
        84.1%,
        100% {
          transform: translateY(0);
        }
      }

      /* Stretched along the pull, then ringing round once free. Every
         scaleX is 1/√scaleY, so the drop keeps its volume through the wobble. */
      @keyframes bead {
        0%,
        10% {
          transform: scale(1, 1);
          opacity: 1;
          animation-timing-function: linear;
        }
        40% {
          transform: scale(0.937, 1.14);
          animation-timing-function: var(--ease-out);
        }
        43% {
          transform: scale(1.066, 0.88);
          animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
        }
        46% {
          transform: scale(0.971, 1.06);
          animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
        }
        49% {
          transform: scale(1.012, 0.977);
          animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
        }
        52%,
        76% {
          transform: scale(1, 1);
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        82%,
        84% {
          transform: scale(0.8, 0.8);
          opacity: 0;
        }
        84.1% {
          transform: scale(0.35, 0.35);
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        98%,
        100% {
          transform: scale(1, 1);
        }
      }

      /* Neck beads sit at fixed fractions of the lift, so they share its
         keyframes and stay evenly spaced; the middle two thin out just
         before the break — necking is the warning. At the break the upper
         two are drawn into the drop and the lower two fall home. */
      @keyframes n1 {
        0%,
        10% {
          transform: translateY(0) scale(1);
          animation-timing-function: linear;
        }
        20% {
          transform: translateY(-3.6px) scale(1);
          animation-timing-function: linear;
        }
        30% {
          transform: translateY(-6.4px) scale(1);
          animation-timing-function: linear;
        }
        40% {
          transform: translateY(-8.4px) scale(0.95);
          animation-timing-function: var(--ease-out);
        }
        47%,
        100% {
          transform: translateY(0) scale(0.4);
        }
      }

      @keyframes n2 {
        0%,
        10% {
          transform: translateY(0) scale(1);
          animation-timing-function: linear;
        }
        20% {
          transform: translateY(-7.2px) scale(1);
          animation-timing-function: linear;
        }
        30% {
          transform: translateY(-12.8px) scale(1);
          animation-timing-function: linear;
        }
        40% {
          transform: translateY(-16.8px) scale(0.72);
          animation-timing-function: var(--ease-out);
        }
        47%,
        100% {
          transform: translateY(0) scale(0.4);
        }
      }

      @keyframes n3 {
        0%,
        10% {
          transform: translateY(0) scale(1);
          animation-timing-function: linear;
        }
        20% {
          transform: translateY(-10.8px) scale(1);
          animation-timing-function: linear;
        }
        30% {
          transform: translateY(-19.2px) scale(1);
          animation-timing-function: linear;
        }
        40% {
          transform: translateY(-25.2px) scale(0.72);
          animation-timing-function: var(--ease-out);
        }
        44% {
          transform: translateY(-62px) scale(0.4);
        }
        44.1%,
        100% {
          transform: translateY(0) scale(0.4);
        }
      }

      @keyframes n4 {
        0%,
        10% {
          transform: translateY(0) scale(1);
          animation-timing-function: linear;
        }
        20% {
          transform: translateY(-14.4px) scale(1);
          animation-timing-function: linear;
        }
        30% {
          transform: translateY(-25.6px) scale(1);
          animation-timing-function: linear;
        }
        40% {
          transform: translateY(-33.6px) scale(0.95);
          animation-timing-function: var(--ease-out);
        }
        44% {
          transform: translateY(-64px) scale(0.4);
        }
        44.1%,
        100% {
          transform: translateY(0) scale(0.4);
        }
      }

      /* The pool is pulled up under the neck, then recoils past flat and
         sends back one small rebound. */
      @keyframes base {
        0%,
        10% {
          transform: translateY(0);
          animation-timing-function: linear;
        }
        40% {
          transform: translateY(-11px);
          animation-timing-function: var(--ease-out);
        }
        45% {
          transform: translateY(4px);
          animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
        }
        52% {
          transform: translateY(-1.5px);
          animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
        }
        60%,
        100% {
          transform: translateY(0);
        }
      }

      @keyframes threshold {
        0%,
        39.5% {
          stroke: var(--_cue);
          animation-timing-function: var(--ease-out);
        }
        40.5% {
          stroke: var(--clay);
          animation-timing-function: ease;
        }
        64%,
        100% {
          stroke: var(--_cue);
        }
      }

      .ghost {
        opacity: 0;
        fill: var(--olive);
      }

      @media (prefers-reduced-motion: reduce) {
        /* The pull is travel and goes. The piece keeps its one fact — there
           is a line, and crossing it means detached — as a crossfade: the
           bead sinks into the pool as the drop appears above the line. */
        .lift,
        .n1,
        .n2,
        .n3,
        .n4,
        .base,
        .hand {
          animation: none;
        }

        .n1,
        .n2,
        .n3,
        .n4 {
          opacity: 0;
        }

        .grip {
          animation: none;
          opacity: 0;
        }

        .bead {
          animation: sink-rm calc(var(--t) * 2) ease-in-out infinite;
        }

        .ghost {
          animation: ghost-rm calc(var(--t) * 2) ease-in-out infinite;
        }

        .threshold {
          animation: threshold-rm calc(var(--t) * 2) ease-in-out infinite;
        }

        @keyframes ghost-rm {
          0%,
          30%,
          95%,
          100% {
            opacity: 0;
          }
          45%,
          80% {
            opacity: 1;
          }
        }

        @keyframes sink-rm {
          0%,
          30%,
          95%,
          100% {
            opacity: 1;
          }
          45%,
          80% {
            opacity: 0;
          }
        }

        @keyframes threshold-rm {
          0%,
          30%,
          95%,
          100% {
            stroke: var(--_cue);
          }
          45%,
          80% {
            stroke: var(--clay);
          }
        }
      }
    </style>
  </head>
  <body>
    <svg
      viewBox="0 0 220 190"
      role="img"
      aria-label="A bead of liquid is pulled up out of a pool; the neck stretches and thins, and at the dashed line it snaps, the drop catching up to the hand and wobbling round while the pool recoils"
    >
      <defs>
        <filter
          id="goo"
          x="-20%"
          y="-40%"
          width="140%"
          height="180%"
          color-interpolation-filters="sRGB"
        >
          <feGaussianBlur in="SourceGraphic" stdDeviation="4.5" />
          <feColorMatrix values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 22 -10" />
        </filter>
      </defs>

      <line class="threshold" x1="56" y1="108" x2="164" y2="108" />

      <g class="liquid" filter="url(#goo)">
        <rect x="24" y="150" width="172" height="26" rx="13" />
        <circle class="base" cx="110" cy="162" r="10" />
        <circle class="n1" cx="110" cy="150" r="10" />
        <circle class="n2" cx="110" cy="150" r="7" />
        <circle class="n3" cx="110" cy="150" r="6.5" />
        <circle class="n4" cx="110" cy="150" r="8" />
        <g class="lift"><circle class="bead" cx="110" cy="150" r="15" /></g>
      </g>

      <circle class="ghost" cx="110" cy="84" r="15" />

      <g class="hand"><circle class="grip" cx="110" cy="150" r="6" /></g>
    </svg>
  </body>
</html>

The variant family

Same idea, one axis moved. Compare them side by side before you commit.