Back to the library

Exhibit — fan out

Variant: Fan out

A stack of four cards laid out as a row and gathered back, with the one rule a pile imposes on its own choreography: spread top-first, gather bottom-first. The top card is the only one free to move, and each card it uncovers becomes the next; gathering runs the other way because a pile is built from the table up — bring A home first and B, C and D slide in underneath a card already at rest, which no hand can do. Every card travels 364ms on an ease-in-out between two places it can rest, 78ms behind its neighbour — any tighter and the order is something you infer rather than see — and the gather is a step quicker because it is a return. The stack shows its count before anything moves — four edges at 3px of ply, four items — so the row that appears is recognisably the same set rather than a new layout. The caption keeps the count and changes only the word for how the cards are lying, and only once the last card has landed. Use it for bundles that open into their parts: attachments on a message, files in a selection, the pieces of evidence behind one claim.

transitionlayoutstaggerlistloop

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 — fan out</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.2s. Each card travels for 364ms (7%) and the next one
           leaves 78ms (1.5%) behind it — enough that the order is seen, not
           inferred. The gather runs 312ms (6%) per card. */
        --cycle: 5.2s;
        --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);

        /* Card width and gutter. The slot pitch is the only distance in the
           file: card i lands (i - 1.5) pitches from the centre of the deck. */
        --_w: clamp(50px, 16vw, 64px);
        --_g: calc(var(--_w) * 0.18);
        --_pitch: calc(var(--_w) + var(--_g));
        --_ply: 3px;
      }

      * {
        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);
      }

      .figure {
        display: grid;
        justify-items: center;
        gap: 14px;
      }

      .deck {
        position: relative;
        width: calc(4 * var(--_w) + 3 * var(--_g));
        height: calc(var(--_w) * 1.36 + 3 * var(--_ply));
      }

      .card {
        position: absolute;
        left: calc(50% - var(--_w) / 2);
        bottom: 0;
        width: var(--_w);
        aspect-ratio: 50 / 68;
        display: flex;
        flex-direction: column;
        gap: 5px;
        padding: 8px 7px;
        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) 6%, 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);
      }

      /* Ply offset: each card below the top sits a few pixels up and to the
         right, so the stack's thickness is the count — four edges, four items —
         before anything moves. */
      .a { z-index: 4; animation-name: a; }
      .b { z-index: 3; animation-name: b; transform: translate(calc(1 * var(--_ply)), calc(-1 * var(--_ply))); }
      .c { z-index: 2; animation-name: c; transform: translate(calc(2 * var(--_ply)), calc(-2 * var(--_ply))); }
      .d { z-index: 1; animation-name: d; transform: translate(calc(3 * var(--_ply)), calc(-3 * var(--_ply))); }

      .a .tab { color: var(--clay-d); }

      /* Spread runs top-first: the top card is the only one free to move, and
         each card it uncovers becomes the next one free. The gather runs the
         other way, bottom-first, because a pile is built from the table up —
         gather A first and B, C, D slide in underneath a card already resting,
         which no hand can do. */
      @keyframes a {
        0%, 12% { transform: translate(0, 0); }
        19%, 62.5% { transform: translate(calc(-1.5 * var(--_pitch)), 0); }
        68.5%, 100% { transform: translate(0, 0); }
      }

      @keyframes b {
        0%, 13.5% { transform: translate(calc(1 * var(--_ply)), calc(-1 * var(--_ply))); }
        20.5%, 61% { transform: translate(calc(-0.5 * var(--_pitch)), 0); }
        67%, 100% { transform: translate(calc(1 * var(--_ply)), calc(-1 * var(--_ply))); }
      }

      @keyframes c {
        0%, 15% { transform: translate(calc(2 * var(--_ply)), calc(-2 * var(--_ply))); }
        22%, 59.5% { transform: translate(calc(0.5 * var(--_pitch)), 0); }
        65.5%, 100% { transform: translate(calc(2 * var(--_ply)), calc(-2 * var(--_ply))); }
      }

      @keyframes d {
        0%, 16.5% { transform: translate(calc(3 * var(--_ply)), calc(-3 * var(--_ply))); }
        23.5%, 58% { transform: translate(calc(1.5 * var(--_pitch)), 0); }
        64%, 100% { transform: translate(calc(3 * var(--_ply)), calc(-3 * var(--_ply))); }
      }

      /* The caption names the arrangement, not the cards: the count never
         changes, only the word for how they are lying. It turns when the last
         card lands, not when the first one leaves. */
      .caption {
        display: grid;
        justify-items: center;
        font-size: 11.5px;
        letter-spacing: 0.01em;
        color: color-mix(in srgb, var(--slate) 55%, transparent);
        font-variant-numeric: tabular-nums;
      }

      .caption span {
        grid-area: 1 / 1;
        animation: var(--t) var(--ease-out) infinite;
      }

      .caption .closed { animation-name: closed; }
      .caption .open { opacity: 0; animation-name: open; }

      @keyframes closed {
        0%, 23.5% { opacity: 1; }
        25.5%, 68.5% { opacity: 0; }
        70.5%, 100% { opacity: 1; }
      }

      @keyframes open {
        0%, 23.5% { opacity: 0; }
        25.5%, 68.5% { opacity: 1; }
        70.5%, 100% { opacity: 0; }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The travel goes and the arrangement stays: every card jumps to its
           slot on one frame while the deck is dimmed, so the change is a soft
           swap between two layouts of the same four cards. */
        .card,
        .caption span {
          animation-duration: calc(var(--t) * 1.5);
        }

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

        .deck {
          animation: dim calc(var(--t) * 1.5) var(--ease-in-out) infinite;
        }

        @keyframes dim {
          0%, 9% { opacity: 1; }
          14%, 24% { opacity: 0.55; }
          30%, 54% { opacity: 1; }
          59%, 69% { opacity: 0.55; }
          75%, 100% { opacity: 1; }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="figure"
      role="img"
      aria-label="A stack of four exhibit cards fans out into a row, top card first, holds, then gathers back into the stack, bottom card first"
    >
      <div class="deck">
        <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"><span class="closed">4 exhibits, bundled</span><span class="open">4 exhibits, laid out</span></p>
    </div>
  </body>
</html>

The variant family

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