Back to the library

Checkpoint — resume from last checkpoint

Variant: Resume from checkpoint

The same upload, the same rate, the same drop at 64% — but with a checkpoint every 25%, cut into the rail as slits so the boundaries read over track and fill alike. Two fills share the bar: light clay for bytes sent, solid clay for bytes the server has vouched for, and each checkpoint flushes the 25 points behind the head in a 160ms ease-out sweep the moment the head crosses the notch. When the connection drops, the rust revealed is only the 14 points past the last flush; they retract to the 50% notch in 300ms, and the label says where the transfer will pick up before it does, then hands back to a plain "Uploading" once it has. It resumes at exactly the rate it left with, because a recovered connection is not a faster one. Reach for it on any long transfer, sync or export where the honest answer to "did I lose it all?" is a number.

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 — resume from last checkpoint</title>
    <style>
      @property --_p {
        syntax: '<number>';
        inherits: true;
        initial-value: 0;
      }
      @property --_n {
        syntax: '<integer>';
        inherits: true;
        initial-value: 0;
      }
      @property --_c {
        syntax: '<number>';
        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 — 8s: one transfer at a fixed 25%/s, a drop at 64%, the
           uncommitted 14 points rolled back to the 50% checkpoint, and the
           same rate again from there. */
        --cycle: 8s;
        --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,
          kept 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.75% {
          --_p: 0;
          --_n: 0;
          animation-timing-function: linear;
        }
        35.75%,
        40.75% {
          --_p: 64;
          --_n: 64;
          animation-timing-function: var(--ease-out);
        }
        44.5%,
        51.25% {
          --_p: 50;
          --_n: 50;
          animation-timing-function: linear;
        }
        76.25%,
        100% {
          --_p: 100;
          --_n: 100;
        }
      }

      /* A checkpoint is a flush, not a fill: each one solidifies the 25
         points behind the head in a 160ms ease-out sweep, the moment the
         head crosses the notch. */
      @keyframes kept {
        0%,
        16.25% {
          --_c: 0;
          animation-timing-function: var(--ease-out);
        }
        18.25%,
        28.75% {
          --_c: 25;
          animation-timing-function: var(--ease-out);
        }
        30.75%,
        63.75% {
          --_c: 50;
          animation-timing-function: var(--ease-out);
        }
        65.75%,
        76.25% {
          --_c: 75;
          animation-timing-function: var(--ease-out);
        }
        78.25%,
        100% {
          --_c: 100;
        }
      }
      @keyframes life {
        0% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        3.12%,
        93.75% {
          opacity: 1;
          animation-timing-function: ease;
        }
        98.12%,
        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);
      }

      /* Square-ended: a flush is a hard boundary, and the rail's own clip
         already rounds the outer ends. */
      .rail > .kept {
        background: var(--clay);
        border-radius: 0;
        transform: translateX(calc((var(--_c) - 100) * 1%));
      }

      /* Checkpoints are slits cut through every layer, so a notch reads the
         same over track, in-flight and kept fill. */
      .notch {
        position: absolute;
        top: 0;
        bottom: 0;
        left: calc(var(--_at) * 1% - 1px);
        width: 2px;
        background: var(--ivory);
      }

      .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%,
        35.75% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        37.25%,
        45.75% {
          opacity: 0;
          animation-timing-function: steps(1, end);
        }
        45.87%,
        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%,
        35.62% {
          opacity: 0;
          animation-timing-function: steps(1, end);
        }
        35.75%,
        45.75% {
          opacity: 1;
          animation-timing-function: steps(1, end);
        }
        45.87%,
        100% {
          opacity: 0;
        }
      }

      /* 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%,
        35.75% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        37%,
        58.75% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        60.5%,
        76.25% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        77.5%,
        100% {
          opacity: 0;
          transform: none;
        }
      }
      @keyframes lost {
        0%,
        36% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        37.75%,
        45.75% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        47%,
        100% {
          opacity: 0;
          transform: none;
        }
      }
      @keyframes again {
        0%,
        46% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        47.75%,
        57.5% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        58.75%,
        100% {
          opacity: 0;
          transform: none;
        }
      }
      @keyframes done {
        0%,
        76.75% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        78.5%,
        100% {
          opacity: 1;
          transform: none;
        }
      }
      @keyframes tick {
        0%,
        77.5% {
          stroke-dashoffset: 15;
          animation-timing-function: var(--ease-accent);
        }
        81.5%,
        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, kept, life;
        }

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

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

        @keyframes progress-rm {
          0%,
          3.75% {
            --_p: 0;
            --_n: 0;
            animation-timing-function: steps(8);
          }
          35.75%,
          40.75% {
            --_p: 64;
            --_n: 64;
            animation-timing-function: steps(1, end);
          }
          44.5%,
          51.25% {
            --_p: 50;
            --_n: 50;
            animation-timing-function: steps(8);
          }
          76.25%,
          100% {
            --_p: 100;
            --_n: 100;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="card"
      role="img"
      aria-label="An upload with checkpoints every 25 percent loses its connection at 64 percent, gives back only the 14 points past the last checkpoint, and resumes from 50"
    >
      <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">Resuming from 50%</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>
        <i class="notch" style="--_at: 25"></i>
        <i class="notch" style="--_at: 50"></i>
        <i class="notch" style="--_at: 75"></i>
      </div>
      <div class="row foot">
        <span class="pct"></span>
        <span>checkpoint every 25%</span>
      </div>
    </div>
  </body>
</html>