Back to the library

Checkpoint — retry only what failed

Variant: Retry only failures

Twelve imports land 130ms apart in a grid, ten fill and two fail, and the piece is what the retry does not touch. Failures are hollow rust rings with a cross rather than a darker fill — clay and rust sit close in hue, so shape carries the difference and colour only confirms it. A "Retry failed" button enters on ease-out and takes a 100ms press; the two rings clear on the release, so the press visibly causes it, and the two cells refill in place while the other ten stay exactly where they were: not re-queued, not re-counted, not even re-animated. The tally is a registered integer that flips on the frame each cell lands, because the count is the outcome of an import rather than the intention. Reach for it on bulk uploads, imports and batch actions where restarting the whole batch would punish the user for the two that broke.

progresserrorcounterdataloop

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>Checkpoint — retry only what failed</title>
    <style>
      @property --_k {
        syntax: '<integer>';
        inherits: true;
        initial-value: 0;
      }
      @property --_f {
        syntax: '<integer>';
        inherits: true;
        initial-value: 0;
      }
      :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. */
        --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)
        );

        --_muted: color-mix(in srgb, var(--slate) 58%, transparent);

        /* Clock — 7.6s: twelve imports land 130ms apart, two fail, one press
           re-runs exactly those two in place, and the batch closes at 12. */
        --cycle: 7.6s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
        --ease-accent: cubic-bezier(0.32, 0.72, 0, 1);
      }

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

      .card {
        width: min(264px, 82vw);
        display: grid;
        gap: 12px;
        animation:
          count var(--t) infinite,
          life var(--t) infinite;
      }
      @keyframes life {
        0% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        3.29%,
        92.11% {
          opacity: 1;
          animation-timing-function: ease;
        }
        96.71%,
        100% {
          opacity: 0;
        }
      }

      /* Integers, flipped on the frame each cell lands: the count is the
         outcome of an import, never the intention. */
      @keyframes count {
        0%,
        5.92% {
          --_k: 0;
          --_f: 0;
        }
        6.05%,
        7.63% {
          --_k: 1;
          --_f: 0;
        }
        7.76%,
        9.34% {
          --_k: 2;
          --_f: 0;
        }
        9.47%,
        11.05% {
          --_k: 3;
          --_f: 0;
        }
        11.18%,
        12.76% {
          --_k: 4;
          --_f: 0;
        }
        12.89%,
        14.47% {
          --_k: 4;
          --_f: 1;
        }
        14.61%,
        16.18% {
          --_k: 5;
          --_f: 1;
        }
        16.32%,
        17.89% {
          --_k: 6;
          --_f: 1;
        }
        18.03%,
        19.61% {
          --_k: 7;
          --_f: 1;
        }
        19.74%,
        21.32% {
          --_k: 8;
          --_f: 1;
        }
        21.45%,
        23.03% {
          --_k: 8;
          --_f: 2;
        }
        23.16%,
        24.74% {
          --_k: 9;
          --_f: 2;
        }
        24.87%,
        49.34% {
          --_k: 10;
          --_f: 2;
        }
        49.47%,
        51.05% {
          --_k: 11;
          --_f: 2;
        }
        51.18%,
        100% {
          --_k: 12;
          --_f: 2;
        }
      }

      .row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        white-space: nowrap;
      }

      .name {
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.01em;
      }

      .tally {
        font-size: 12px;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        color: var(--_muted);
        counter-reset: k var(--_k);
      }

      .tally b {
        color: var(--slate);
      }

      .tally b::before {
        content: counter(k);
      }

      .grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
      }

      .cell {
        position: relative;
        aspect-ratio: 1;
        border-radius: calc(6px * var(--round));
        box-shadow: inset 0 0 0 1.5px var(--oat);
      }

      .cell > i {
        position: absolute;
        inset: 0;
        border-radius: inherit;
        opacity: 0;
      }

      .ok {
        background: var(--clay);
      }

      /* A failure is hollow, not just a darker fill: clay and rust sit close
         in hue, so shape carries the difference and colour only confirms it. */
      .bad {
        box-shadow: inset 0 0 0 2px var(--rust);
      }

      .bad::before,
      .bad::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 38%;
        height: 2px;
        border-radius: 999px;
        background: var(--rust);
        transform: translate(-50%, -50%) rotate(45deg);
      }

      .bad::after {
        transform: translate(-50%, -50%) rotate(-45deg);
      }

      .foot {
        height: 28px;
      }

      .msg {
        display: grid;
        font-size: 11.5px;
        font-weight: 600;
        counter-reset: f var(--_f);
      }

      .msg > span {
        grid-area: 1 / 1;
        display: flex;
        align-items: center;
        gap: 5px;
        opacity: 0;
      }

      .failed {
        color: var(--rust);
        font-variant-numeric: tabular-nums;
      }

      .failed::before {
        content: counter(f) ' failed';
      }

      .retrying {
        color: var(--_muted);
      }

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

      .all svg {
        width: 12px;
        height: 12px;
        overflow: visible;
      }

      .all path {
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        stroke-dasharray: 15;
        stroke-dashoffset: 15;
      }

      .btn {
        font: inherit;
        font-size: 11.5px;
        font-weight: 600;
        color: var(--slate);
        background: var(--paper);
        border: 1px solid var(--oat);
        border-radius: calc(7px * var(--round));
        padding: 5px 10px;
        opacity: 0;
        animation: btn var(--t) infinite;
      }
      .cell:nth-child(1) .ok {
        animation: ok0 var(--t) infinite;
      }
      .cell:nth-child(2) .ok {
        animation: ok1 var(--t) infinite;
      }
      .cell:nth-child(3) .ok {
        animation: ok2 var(--t) infinite;
      }
      .cell:nth-child(4) .ok {
        animation: ok3 var(--t) infinite;
      }
      .cell:nth-child(5) .ok {
        animation: ok4 var(--t) infinite;
      }
      .cell:nth-child(6) .ok {
        animation: ok5 var(--t) infinite;
      }
      .cell:nth-child(7) .ok {
        animation: ok6 var(--t) infinite;
      }
      .cell:nth-child(8) .ok {
        animation: ok7 var(--t) infinite;
      }
      .cell:nth-child(9) .ok {
        animation: ok8 var(--t) infinite;
      }
      .cell:nth-child(10) .ok {
        animation: ok9 var(--t) infinite;
      }
      .cell:nth-child(11) .ok {
        animation: ok10 var(--t) infinite;
      }
      .cell:nth-child(12) .ok {
        animation: ok11 var(--t) infinite;
      }
      .cell:nth-child(5) .bad {
        animation: bad4 var(--t) infinite;
      }
      .cell:nth-child(10) .bad {
        animation: bad9 var(--t) infinite;
      }

      /* Each landing is a 180ms ease-out pop from 0.9 — the cell was already
         there as an outline, so it fills rather than appears. */
      @keyframes ok0 {
        0%,
        5.92% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        8.29%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok1 {
        0%,
        7.63% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        10%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok2 {
        0%,
        9.34% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        11.71%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok3 {
        0%,
        11.05% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        13.42%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok4 {
        0%,
        49.34% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        51.71%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok5 {
        0%,
        14.47% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        16.84%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok6 {
        0%,
        16.18% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        18.55%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok7 {
        0%,
        17.89% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        20.26%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok8 {
        0%,
        19.61% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        21.97%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok9 {
        0%,
        51.05% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        53.42%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok10 {
        0%,
        23.03% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        25.39%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes ok11 {
        0%,
        24.74% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        27.11%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes bad4 {
        0%,
        12.76% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        15.13%,
        39.47% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        41.58%,
        100% {
          opacity: 0;
          transform: none;
        }
      }
      @keyframes bad9 {
        0%,
        21.32% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        23.68%,
        39.47% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        41.58%,
        100% {
          opacity: 0;
          transform: none;
        }
      }

      /* The button enters on ease-out, takes a 100ms press to 0.96 and a
         140ms release, and leaves in 160ms — exit faster than entry. The
         two failures clear on the release, so the press visibly causes it,
         and nothing else in the grid moves: the ten that landed are not
         touched, re-queued, or re-counted. */
      @keyframes btn {
        0%,
        28.95% {
          opacity: 0;
          transform: translateY(4px);
          animation-timing-function: var(--ease-out);
        }
        31.84%,
        38.16% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        39.47% {
          opacity: 1;
          transform: scale(0.96);
          animation-timing-function: var(--ease-out);
        }
        41.32% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        43.42%,
        100% {
          opacity: 0;
          transform: none;
        }
      }

      .failed {
        animation: failed var(--t) infinite;
      }
      .retrying {
        animation: retrying var(--t) infinite;
      }
      .all {
        animation: all var(--t) infinite;
      }
      .all path {
        animation: tick var(--t) infinite;
      }
      @keyframes failed {
        0%,
        12.76% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        14.61%,
        39.47% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        40.79%,
        100% {
          opacity: 0;
          transform: none;
        }
      }
      @keyframes retrying {
        0%,
        41.05% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        42.89%,
        52.63% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        53.95%,
        100% {
          opacity: 0;
          transform: none;
        }
      }
      @keyframes all {
        0%,
        53.16% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        55%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes tick {
        0%,
        53.95% {
          stroke-dashoffset: 15;
          animation-timing-function: var(--ease-accent);
        }
        58.16%,
        100% {
          stroke-dashoffset: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* Cells still fill and fail and refill — that is the content — on a
           clock stretched 1.6x, but they fade rather than pop, the button
           fades without travel or press, and the tick is already drawn. */
        .card,
        .grid .cell:nth-child(n) > i,
        .btn,
        .msg > span {
          animation-duration: calc(var(--t) * 1.6);
        }

        .grid .cell:nth-child(n) > i,
        .btn,
        .msg > span {
          transform: none !important;
        }

        .all path {
          animation: none;
          stroke-dashoffset: 0;
        }
      }
    </style>
  </head>
  <body>
    <div
      class="card"
      role="img"
      aria-label="A batch of twelve imports: ten land and two fail; a retry re-runs only the two failed items in place, and the batch completes at twelve of twelve"
    >
      <div class="row">
        <span class="name">Import · 12 files</span>
        <span class="tally"><b></b> / 12</span>
      </div>
      <div class="grid">
        <span class="cell"><i class="ok"></i></span>
        <span class="cell"><i class="ok"></i></span>
        <span class="cell"><i class="ok"></i></span>
        <span class="cell"><i class="ok"></i></span>
        <span class="cell"><i class="ok"></i><i class="bad"></i></span>
        <span class="cell"><i class="ok"></i></span>
        <span class="cell"><i class="ok"></i></span>
        <span class="cell"><i class="ok"></i></span>
        <span class="cell"><i class="ok"></i></span>
        <span class="cell"><i class="ok"></i><i class="bad"></i></span>
        <span class="cell"><i class="ok"></i></span>
        <span class="cell"><i class="ok"></i></span>
      </div>
      <div class="row foot">
        <span class="msg">
          <span class="failed"></span>
          <span class="retrying">Retrying 2</span>
          <span class="all">
            <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8.5 L6.5 12 L13 4.5" /></svg>
            All imported
          </span>
        </span>
        <button class="btn" type="button" tabindex="-1">Retry failed</button>
      </div>
    </div>
  </body>
</html>