Back to the library

Exhibit — advance

Variant: Advance

Paging through a deck where "next" is a reorder, not a discard. The front card is set aside in 256ms, just clear of the deck, and filed at the back in another 256ms — its z-order flips only out there, where it overlaps nothing, because a card that changes layer while covering another pops through it; the cards it uncovered step forward in the middle of that window, overlapping both legs, so the deck is never caught empty. Back is the exact mirror — the rear card comes out from behind and returns over the top — which is only possible because nothing ever left the bundle. Both legs are ease-in-out: the card is never entering or leaving, only moving between places it could rest, and the 128ms dip on the arrow is what answers the press. The count changes when the new front card arrives, never when the old one departs. Use it for carousels of records, onboarding cards and review queues where the reader needs to go back and find the thing exactly where it was.

transitiongesturecontrollistloop

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 — advance</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 — 6.4s: next, next, back, back. A step is 512ms (8%): 256ms out
           to the side, 256ms tucking in. The cards it uncovers move in the
           middle 256ms, overlapping both legs. */
        --cycle: 6.4s;
        --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(84px, 27vw, 104px);

        /* The three deck positions and the aside. Every keyframe below is one
           of these four, so a card is only ever somewhere it could rest. The
           aside sits just clear of the deck — a card's z-order can only change
           where it overlaps nothing, or the swap is a visible pop — and 6px
           low, so it reads as set down on the table beside the deck. */
        --_p0: translate(0, 0) scale(1) rotate(0deg);
        --_p1: translate(0, -9px) scale(0.94) rotate(0deg);
        --_p2: translate(0, -18px) scale(0.88) rotate(0deg);
        --_side: translate(calc(-1.1 * var(--_w)), 6px) scale(0.97) rotate(-5deg);

        --_ink: color-mix(in srgb, var(--slate) 60%, transparent);
      }

      * {
        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: 16px;
      }

      /* The deck is one card wide and the aside hangs off its left edge, so
         the resting deck stays centred under its pager. */
      .deck {
        position: relative;
        width: var(--_w);
        height: calc(var(--_w) * 1.36 + 22px);
      }

      .card {
        position: absolute;
        left: 0;
        bottom: 0;
        width: var(--_w);
        aspect-ratio: 50 / 68;
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 11px 10px;
        border-radius: calc(6px * 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);
        transform-origin: 50% 0;
        animation-duration: var(--t);
        animation-iteration-count: infinite;
        animation-timing-function: var(--ease-in-out);
      }

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

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

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

      .a { animation-name: a; }
      .b { animation-name: b; }
      .c { animation-name: c; }

      /* Forward: the front card goes aside on top of the deck, then is filed
         behind it — z drops on the frame it reaches the aside. Back: the rear
         card comes out behind the deck and returns over it, its z rising only
         once it is clear. The paper never
         leaves the bundle in either direction; "next" is a reorder, not a
         discard, which is why "back" can exist at all.

         Steps start at 10%, 32%, 60% and 82%. Both legs are ease-in-out: the
         card is never entering or leaving, only moving between two places it
         could rest, and the arrow's dip is what answers the press. */
      @keyframes a {
        0% { transform: var(--_p0); z-index: 4; }
        10% { transform: var(--_p0); z-index: 4; }
        14% { transform: var(--_side); z-index: 4; }
        14.01% { transform: var(--_side); z-index: 1; }
        18%, 34% { transform: var(--_p2); z-index: 1; }
        38%, 62% { transform: var(--_p1); z-index: 2; }
        66%, 82% { transform: var(--_p2); z-index: 1; }
        86% { transform: var(--_side); z-index: 1; }
        86.01% { transform: var(--_side); z-index: 4; }
        90%, 100% { transform: var(--_p0); z-index: 4; }
      }

      @keyframes b {
        0%, 12% { transform: var(--_p1); z-index: 2; }
        16% { transform: var(--_p0); z-index: 3; }
        32% { transform: var(--_p0); z-index: 4; }
        36% { transform: var(--_side); z-index: 4; }
        36.01% { transform: var(--_side); z-index: 1; }
        40% { transform: var(--_p2); z-index: 1; }
        60% { transform: var(--_p2); z-index: 1; }
        64% { transform: var(--_side); z-index: 1; }
        64.01% { transform: var(--_side); z-index: 4; }
        68%, 84% { transform: var(--_p0); z-index: 4; }
        88%, 100% { transform: var(--_p1); z-index: 2; }
      }

      @keyframes c {
        0%, 12% { transform: var(--_p2); z-index: 1; }
        16%, 34% { transform: var(--_p1); z-index: 2; }
        38%, 62% { transform: var(--_p0); z-index: 3; }
        66%, 84% { transform: var(--_p1); z-index: 2; }
        88%, 100% { transform: var(--_p2); z-index: 1; }
      }

      /* Pager: the arrow that was pressed dips for 128ms — 64ms in, 64ms
         out — on the step's first frame, and the count changes when the new front card has arrived, not
         when the old one left. */
      .pager {
        display: flex;
        align-items: center;
        gap: 14px;
        font-size: 12px;
        color: var(--_ink);
      }

      .arrow {
        display: grid;
        place-items: center;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        border: 1px solid color-mix(in srgb, var(--slate) 14%, transparent);
        background: var(--paper);
        animation-duration: var(--t);
        animation-iteration-count: infinite;
        animation-timing-function: var(--ease-out);
      }

      .arrow svg {
        width: 12px;
        height: 12px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.6;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .prev { animation-name: press-prev; }
      .next { animation-name: press-next; }

      @keyframes press-next {
        0%, 9.5% { transform: scale(1); color: var(--_ink); }
        10.5% { transform: scale(0.9); color: var(--clay-d); }
        11.5%, 31.5% { transform: scale(1); color: var(--_ink); }
        32.5% { transform: scale(0.9); color: var(--clay-d); }
        33.5%, 100% { transform: scale(1); color: var(--_ink); }
      }

      @keyframes press-prev {
        0%, 59.5% { transform: scale(1); color: var(--_ink); }
        60.5% { transform: scale(0.9); color: var(--clay-d); }
        61.5%, 81.5% { transform: scale(1); color: var(--_ink); }
        82.5% { transform: scale(0.9); color: var(--clay-d); }
        83.5%, 100% { transform: scale(1); color: var(--_ink); }
      }

      .count {
        display: grid;
        font-variant-numeric: tabular-nums;
        min-width: 4.5em;
        text-align: center;
      }

      .count span {
        grid-area: 1 / 1;
        opacity: 0;
        animation-duration: var(--t);
        animation-iteration-count: infinite;
        animation-timing-function: var(--ease-out);
      }

      .n1 { animation-name: n1; }
      .n2 { animation-name: n2; }
      .n3 { animation-name: n3; }

      @keyframes n1 {
        0%, 15% { opacity: 1; }
        16%, 89% { opacity: 0; }
        90%, 100% { opacity: 1; }
      }

      @keyframes n2 {
        0%, 15% { opacity: 0; }
        16%, 37% { opacity: 1; }
        38%, 67% { opacity: 0; }
        68%, 89% { opacity: 1; }
        90%, 100% { opacity: 0; }
      }

      @keyframes n3 {
        0%, 37% { opacity: 0; }
        38%, 67% { opacity: 1; }
        68%, 100% { opacity: 0; }
      }

      @media (prefers-reduced-motion: reduce) {
        /* No travel: each card steps straight between deck positions — the
           aside is skipped entirely — on one frame while the deck is dimmed,
           so what changes is the order, never the place. The pager keeps its
           colour cue and loses the dip. */
        .card,
        .arrow,
        .count span,
        .deck {
          animation-duration: calc(var(--t) * 1.5);
        }

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

        .a { animation-name: a-still; }
        .b { animation-name: b-still; }

        @keyframes a-still {
          0%, 10% { transform: var(--_p0); z-index: 4; }
          14%, 34% { transform: var(--_p2); z-index: 1; }
          38%, 62% { transform: var(--_p1); z-index: 2; }
          66%, 86% { transform: var(--_p2); z-index: 1; }
          90%, 100% { transform: var(--_p0); z-index: 4; }
        }

        @keyframes b-still {
          0%, 12% { transform: var(--_p1); z-index: 2; }
          16%, 32% { transform: var(--_p0); z-index: 3; }
          36%, 60% { transform: var(--_p2); z-index: 1; }
          64%, 84% { transform: var(--_p0); z-index: 4; }
          88%, 100% { transform: var(--_p1); z-index: 2; }
        }

        .deck {
          animation-name: dim;
          animation-iteration-count: infinite;
          animation-timing-function: var(--ease-in-out);
        }

        .prev { animation-name: tint-prev; }
        .next { animation-name: tint-next; }

        @keyframes dim {
          0%, 8%, 21%, 30%, 43%, 58%, 71%, 80%, 93%, 100% { opacity: 1; }
          12%, 18%, 34%, 40%, 62%, 68%, 84%, 90% { opacity: 0.55; }
        }

        @keyframes tint-next {
          0%, 9.5%, 16%, 31.5%, 38%, 100% { color: var(--_ink); }
          10.5%, 14%, 32.5%, 36% { color: var(--clay-d); }
        }

        @keyframes tint-prev {
          0%, 59.5%, 66%, 81.5%, 88%, 100% { color: var(--_ink); }
          60.5%, 64%, 82.5%, 86% { color: var(--clay-d); }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="figure"
      role="img"
      aria-label="A deck of three exhibit cards paged forward twice and back twice; each card going forward is set aside and filed behind the deck, and going back brings it out again"
    >
      <div class="deck">
        <div class="card c"><span class="tab"><span>Ex.</span> C</span><i class="line" style="width: 70%"></i><i class="line" style="width: 92%"></i><i class="line" style="width: 48%"></i></div>
        <div class="card b"><span class="tab"><span>Ex.</span> B</span><i class="line" style="width: 88%"></i><i class="line" style="width: 60%"></i><i class="line" style="width: 76%"></i></div>
        <div class="card a"><span class="tab"><span>Ex.</span> A</span><i class="line" style="width: 82%"></i><i class="line" style="width: 94%"></i><i class="line" style="width: 56%"></i></div>
      </div>
      <div class="pager">
        <span class="arrow prev"><svg viewBox="0 0 12 12"><path d="M7.5 2.5 4 6l3.5 3.5" /></svg></span>
        <span class="count"><span class="n1">1 of 3</span><span class="n2">2 of 3</span><span class="n3">3 of 3</span></span>
        <span class="arrow next"><svg viewBox="0 0 12 12"><path d="M4.5 2.5 8 6 4.5 9.5" /></svg></span>
      </div>
    </div>
  </body>
</html>

The variant family

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