Back to the library

Exhibit — collate

Variant: Collate

Four loose cards, dropped on the table out of order, squared into one stack that reads A to D. The scatter is jumbled on purpose — the letters lie out of sequence and the rotations differ in sign and size, so no two cards read as already aligned — and what the motion delivers is the sort, not just the tidy. Each card slides and turns true in 336ms on an ease-in-out, 112ms after the one that will lie beneath it, and paint order never changes: the stack is built in the order a hand would build it, so no card ever has to pass under one at rest. Then the jog — the whole pile knocked once on the table, 2px down in 84ms and back in 140ms, the only motion the stack makes as a single object — and only after it does the check fade in beside the pile. The stack is done, then it is declared done. The loop resets behind a fade, the exit quicker than the entrance, since un-collating in view would read as the pile being undone. Use it when a set of things becomes one ordered thing — sorting a batch, merging selections, filing a bundle.

transitionstaggerlayoutphysicsloop

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>Exhibit — collate</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;
        --round: 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
           (#d97757 / #b85c3e / #788c5d / #b04a3f). */
        --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 — 5.6s. Each card squares up in 336ms (6%), 112ms (2%) after
           the one beneath it; the jog is 84ms down and 140ms back. */
        --cycle: 5.6s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
        --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

        --_w: clamp(54px, 18vw, 72px);
        --_ply: 1.5px;
      }

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

      body {
        min-height: 100vh;
        display: grid;
        place-items: center;
        background: var(--ivory);
        font-family:
          system-ui,
          -apple-system,
          'Segoe UI',
          Roboto,
          sans-serif;
        color: var(--slate);
      }

      /* Sized to the scatter, not the stack: the loose cards are the widest
         this figure ever gets, so they set the box and nothing reaches past it. */
      .table {
        position: relative;
        width: calc(var(--_w) * 3.1);
        height: calc(var(--_w) * 2.3);
        animation: scene var(--t) var(--ease-out) infinite;
      }

      .pile {
        position: absolute;
        inset: 0;
        z-index: 1;
        animation: jog var(--t) infinite;
      }

      .card {
        position: absolute;
        left: calc(50% - var(--_w) / 2);
        top: calc(50% - var(--_w) * 0.68);
        width: var(--_w);
        aspect-ratio: 50 / 68;
        display: flex;
        flex-direction: column;
        gap: 5px;
        padding: 9px 8px;
        border-radius: calc(5px * var(--round));
        background: var(--paper);
        border: 1px solid color-mix(in srgb, var(--slate) 13%, transparent);
        box-shadow: 0 1px 2px color-mix(in srgb, var(--slate) 7%, transparent);
        animation-duration: var(--t);
        animation-iteration-count: infinite;
        animation-timing-function: var(--ease-in-out);
      }

      .tab {
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.02em;
        color: color-mix(in srgb, var(--slate) 82%, transparent);
        margin-bottom: 3px;
      }

      .tab span {
        font-weight: 500;
        color: color-mix(in srgb, var(--slate) 45%, transparent);
      }

      .line {
        height: 4px;
        border-radius: 2px;
        background: var(--oat);
      }

      /* Painted A on top, D at the bottom, for the whole loop — z-index never
         changes. That is only coherent because the landings run D, C, B, A:
         each card arrives on top of everything already squared, never under
         it. Land A first and three cards slide beneath a card at rest. */
      .a { z-index: 4; animation-name: a; }
      .b { z-index: 3; animation-name: b; }
      .c { z-index: 2; animation-name: c; }
      .d { z-index: 1; animation-name: d; }

      /* Scattered positions in card widths. The rotations differ in sign and
         size so no two cards read as already aligned. */
      @keyframes a {
        0%, 20% { transform: translate(calc(var(--_w) * -0.95), calc(var(--_w) * 0.3)) rotate(-8deg); }
        26%, 90% { transform: translate(0, 0) rotate(0deg); }
        90.01%, 100% { transform: translate(calc(var(--_w) * -0.95), calc(var(--_w) * 0.3)) rotate(-8deg); }
      }

      @keyframes b {
        0%, 18% { transform: translate(calc(var(--_w) * 0.85), calc(var(--_w) * -0.24)) rotate(6deg); }
        24%, 90% { transform: translate(var(--_ply), var(--_ply)) rotate(0deg); }
        90.01%, 100% { transform: translate(calc(var(--_w) * 0.85), calc(var(--_w) * -0.24)) rotate(6deg); }
      }

      @keyframes c {
        0%, 16% { transform: translate(calc(var(--_w) * 0.2), calc(var(--_w) * 0.4)) rotate(-3deg); }
        22%, 90% { transform: translate(calc(2 * var(--_ply)), calc(2 * var(--_ply))) rotate(0deg); }
        90.01%, 100% { transform: translate(calc(var(--_w) * 0.2), calc(var(--_w) * 0.4)) rotate(-3deg); }
      }

      @keyframes d {
        0%, 14% { transform: translate(calc(var(--_w) * -0.3), calc(var(--_w) * -0.34)) rotate(11deg); }
        20%, 90% { transform: translate(calc(3 * var(--_ply)), calc(3 * var(--_ply))) rotate(0deg); }
        90.01%, 100% { transform: translate(calc(var(--_w) * -0.3), calc(var(--_w) * -0.34)) rotate(11deg); }
      }

      /* The jog: the squared pile is knocked once on the table, 2px down and
         back. It is the only motion the pile makes as a single object, and it
         starts 56ms after A lands — the stack is done, then it is declared done. */
      @keyframes jog {
        0%, 27% { transform: translateY(0); animation-timing-function: var(--ease-out); }
        28.5% { transform: translateY(2px); animation-timing-function: var(--ease-out); }
        31%, 100% { transform: translateY(0); }
      }

      /* Parked just under where the pile will be, inside the scatter's box:
         the loose cards cover the spot until the stack exists, and the verdict
         lands next to the thing it is about. */
      .caption {
        position: absolute;
        z-index: 0;
        left: 0;
        right: 0;
        top: calc(50% + var(--_w) * 0.68 + 12px);
        justify-content: center;
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 11.5px;
        letter-spacing: 0.01em;
        color: color-mix(in srgb, var(--slate) 55%, transparent);
        opacity: 0;
        transform: translateY(3px);
        animation: caption var(--t) var(--ease-out) infinite;
      }

      .caption svg {
        width: 11px;
        height: 11px;
        fill: none;
        stroke: var(--olive);
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      @keyframes caption {
        0%, 31% { opacity: 0; transform: translateY(3px); }
        36%, 100% { opacity: 1; transform: translateY(0); }
      }

      /* The loop resets out of sight: everything fades — the exit in 224ms,
         quicker than the 336ms entrance — the cards are thrown back once the
         fade bottoms out, and the table returns. Un-collating on screen would
         read as the pile being undone. */
      @keyframes scene {
        0% { opacity: 0; }
        6%, 84% { opacity: 1; }
        88%, 100% { opacity: 0; }
      }

      @media (prefers-reduced-motion: reduce) {
        /* No sliding or turning: each card lands in the pile on one frame, in
           the same D-to-A order, and the jog goes. The order is the content,
           so it survives; the travel was only how it got there. */
        .card,
        .caption {
          animation-duration: calc(var(--t) * 1.5);
        }

        /* The table dims across the landings so no card jumps at full
           strength, and the scene fade rides on the same layer. */
        .table {
          animation: scene-still calc(var(--t) * 1.5) var(--ease-in-out) infinite;
        }

        @keyframes scene-still {
          0% { opacity: 0; }
          6%, 14% { opacity: 1; }
          18%, 27% { opacity: 0.55; }
          32%, 84% { opacity: 1; }
          88%, 100% { opacity: 0; }
        }

        .card {
          animation-timing-function: steps(1, end);
        }

        .pile {
          animation: none;
        }

        .caption {
          transform: none;
          animation-name: caption-fade;
        }

        @keyframes caption-fade {
          0%, 31% { opacity: 0; }
          38%, 100% { opacity: 1; }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="figure"
      role="img"
      aria-label="Four exhibit cards scattered at angles square up into one stack, bottom card first and the top card last, then the pile is knocked square once and marked in order"
    >
      <div class="table">
        <div class="pile">
          <div class="card d"><span class="tab"><span>Ex.</span> D</span><i class="line" style="width: 86%"></i><i class="line" style="width: 58%"></i></div>
          <div class="card c"><span class="tab"><span>Ex.</span> C</span><i class="line" style="width: 72%"></i><i class="line" style="width: 90%"></i></div>
          <div class="card b"><span class="tab"><span>Ex.</span> B</span><i class="line" style="width: 92%"></i><i class="line" style="width: 64%"></i></div>
          <div class="card a"><span class="tab"><span>Ex.</span> A</span><i class="line" style="width: 80%"></i><i class="line" style="width: 54%"></i></div>
        </div>
        <p class="caption">
          <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M2.5 6.4 5 8.8l4.5-5.6" /></svg>
          Collated, A on top
        </p>
      </div>
    </div>
  </body>
</html>

The variant family

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