Back to the library

Checkpoint — restart from zero

Variant: Restart from zero

The baseline the rest of the family argues against: an upload with no checkpoints drops at 64% and gives everything back. The bar runs linear at 25%/s because throughput is a rate, not a gesture, and it stays in light, provisional clay the whole way — nothing is durable until the last byte lands, so the fill only solidifies at 100. At the drop the in-flight fill fades in 120ms to reveal the rust beneath it — exactly the work about to be lost, to the pixel — holds for 400ms so the loss can be read, then drains back on the same 300ms ease-out the resume variant uses and starts again. Up to the restart the two cards are frame-for-frame identical; after it, this one needs 2s more for the same file, and those 2s are the 50 points re-sent. That is also why its clock is 10s against the resume card’s 8s. Show the two side by side; the contrast is the case for chunked uploads.

progresserrordataloadingloop

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 — restart from zero</title>
    <style>
      @property --_p {
        syntax: '<number>';
        inherits: true;
        initial-value: 0;
      }
      @property --_n {
        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;
        --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)
        );

        /* Opaque mixes, so the rust layer under the in-flight fill never
           bleeds through it. Light clay = sent but not yet durable. */
        --_track: color-mix(in srgb, var(--oat) 62%, var(--ivory));
        --_flight: color-mix(in oklab, var(--clay) 55%, var(--ivory));
        --_muted: color-mix(in srgb, var(--slate) 58%, transparent);

        /* Clock — 10s: the same transfer, rate and drop as the resume
           variant, but every point is lost. The extra 2s on this clock is
           the argument — it is exactly the 50 points re-sent. */
        --cycle: 10s;
        --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(300px, 84vw);
        display: grid;
        gap: 10px;
        animation:
          progress var(--t) infinite,
          life var(--t) infinite;
      }

      /* A transfer is throughput, so both legs run linear at the identical
         rate. The only eased move is the retraction, which is the system
         discarding work it cannot vouch for — over in 300ms, on ease-out. */
      @keyframes progress {
        0%,
        3% {
          --_p: 0;
          --_n: 0;
          animation-timing-function: linear;
        }
        28.6%,
        32.6% {
          --_p: 64;
          --_n: 64;
          animation-timing-function: var(--ease-out);
        }
        35.6%,
        41% {
          --_p: 0;
          --_n: 0;
          animation-timing-function: linear;
        }
        81%,
        100% {
          --_p: 100;
          --_n: 100;
        }
      }
      @keyframes life {
        0% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        2.5%,
        95% {
          opacity: 1;
          animation-timing-function: ease;
        }
        98.5%,
        100% {
          opacity: 0;
        }
      }

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

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

      /* Every state shares one grid cell, so the row never reflows. */
      .state {
        display: grid;
        justify-items: end;
        font-size: 11.5px;
        font-weight: 600;
      }

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

      .run,
      .again {
        color: var(--_muted);
      }

      .lost {
        color: var(--rust);
      }

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

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

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

      .rail {
        position: relative;
        height: 8px;
        border-radius: 999px;
        background: var(--_track);
        overflow: hidden;
      }

      .rail > b {
        position: absolute;
        inset: 0;
        border-radius: 999px;
        transform: translateX(calc((var(--_p) - 100) * 1%));
      }

      /* Stacked bottom to top: rust, in-flight, kept. All three are the same
         full-width layer pushed by a number, so the fail is a reveal — the
         in-flight fill steps aside and the rust underneath is exactly the
         work about to be lost, to the pixel. */
      .gone {
        background: var(--rust);
      }

      .flight {
        background: var(--_flight);
      }

      /* Nothing is durable until the last byte lands, so the whole bar stays
         in-flight clay and solidifies only at 100. */
      .rail > .kept {
        background: var(--clay);
        transform: none;
        opacity: 0;
      }

      .foot {
        font-size: 11.5px;
        color: var(--_muted);
      }

      .pct {
        font-weight: 600;
        color: var(--slate);
        font-variant-numeric: tabular-nums;
        counter-reset: n var(--_n);
      }

      .pct::after {
        content: counter(n) '%';
      }

      .flight {
        animation: flight var(--t) infinite;
      }
      @keyframes flight {
        0%,
        28.6% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        29.8%,
        36.6% {
          opacity: 0;
          animation-timing-function: steps(1, end);
        }
        36.7%,
        100% {
          opacity: 1;
        }
      }

      /* The rust exists only for the drop; the rest of the time it would
         fringe the in-flight edge through antialiasing. */
      .gone {
        animation: gone var(--t) infinite;
      }
      @keyframes gone {
        0%,
        28.5% {
          opacity: 0;
          animation-timing-function: steps(1, end);
        }
        28.6%,
        36.6% {
          opacity: 1;
          animation-timing-function: steps(1, end);
        }
        36.7%,
        100% {
          opacity: 0;
        }
      }

      .rail > .kept {
        animation: solid var(--t) infinite;
      }
      @keyframes solid {
        0%,
        81% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        82.6%,
        100% {
          opacity: 1;
        }
      }

      /* Labels cross in 140ms on ease-out with 3px of rise; the outgoing one
         leaves in 100ms, faster than the next arrives. */
      .run {
        animation: run var(--t) infinite;
      }
      .lost {
        animation: lost var(--t) infinite;
      }
      .again {
        animation: again var(--t) infinite;
      }
      .done {
        animation: done var(--t) infinite;
      }
      .done path {
        animation: tick var(--t) infinite;
      }
      @keyframes run {
        0%,
        28.6% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        29.6%,
        47% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        48.4%,
        81% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        82%,
        100% {
          opacity: 0;
          transform: none;
        }
      }
      @keyframes lost {
        0%,
        28.8% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        30.2%,
        36.6% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        37.6%,
        100% {
          opacity: 0;
          transform: none;
        }
      }
      @keyframes again {
        0%,
        36.8% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        38.2%,
        46% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        47%,
        100% {
          opacity: 0;
          transform: none;
        }
      }
      @keyframes done {
        0%,
        81.4% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        82.8%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes tick {
        0%,
        82% {
          stroke-dashoffset: 15;
          animation-timing-function: var(--ease-accent);
        }
        85.2%,
        100% {
          stroke-dashoffset: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The numbers still advance — they are the reading, not decoration —
           but in discrete steps on one clock stretched 1.6x, and the
           retraction becomes a cut rather than travel. The labels lose their
           rise and only cross-fade; the tick appears already drawn. */
        .card,
        .rail > b,
        .rail > .kept,
        .state > span {
          animation-duration: calc(var(--t) * 1.6);
        }

        .card {
          animation-name: progress-rm, life;
        }

        .state > span {
          transform: none !important;
        }

        .done path {
          animation: none;
          stroke-dashoffset: 0;
        }

        @keyframes progress-rm {
          0%,
          3% {
            --_p: 0;
            --_n: 0;
            animation-timing-function: steps(8);
          }
          28.6%,
          32.6% {
            --_p: 64;
            --_n: 64;
            animation-timing-function: steps(1, end);
          }
          35.6%,
          41% {
            --_p: 0;
            --_n: 0;
            animation-timing-function: steps(8);
          }
          81%,
          100% {
            --_p: 100;
            --_n: 100;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="card"
      role="img"
      aria-label="An upload without checkpoints loses its connection at 64 percent, gives back everything, and restarts from zero"
    >
      <div class="row">
        <span class="name">backup.tar</span>
        <span class="state">
          <span class="run">Uploading</span>
          <span class="lost">Connection lost</span>
          <span class="again">Restarting from 0%</span>
          <span class="done">
            <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8.5 L6.5 12 L13 4.5" /></svg>
            Uploaded
          </span>
        </span>
      </div>
      <div class="rail">
        <b class="gone"></b>
        <b class="flight"></b>
        <b class="kept"></b>
      </div>
      <div class="row foot">
        <span class="pct"></span>
        <span>no checkpoints</span>
      </div>
    </div>
  </body>
</html>