Back to the library

Baton sync, standard

Variant: Standard

A loading indicator for work that moves through several parties in order, like syncing to devices, fanning out to replicas, or a multi-step publish. A baton carries the change along a track, each post lights when the baton reaches it, and the trail behind it shows how far the work has got. Each leg runs on ease-in-out and is followed by a short pause, so every post visibly receives the change before it moves on rather than the baton just sliding past.

loadersyncprogresshandoffsvg

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>Baton sync, standard</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; /* include ONLY if at least one border-radius is wrapped below */
  --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 — every duration in the document runs off --t. */
  --cycle: 3.6s; /* the authored master loop */
  --t: calc(var(--cycle) / var(--speed));

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* include only if used */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); /* include only if used */

  --_track-w: 2px;
  --_trail-w: 3px;
  --_post-w: 2px;
  --_baton-w: 5px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  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(340px, 88vw);
  padding: clamp(16px, 5vw, 24px);
  background: var(--paper);
  border: 1px solid var(--oat);
  border-radius: calc(14px * var(--round));
}

.title {
  margin: 0;
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sub {
  margin: 4px 0 0;
  font-size: clamp(12px, 3.4vw, 13px);
  opacity: 0.62;
}

.lane {
  display: block;
  width: 100%;
  height: auto;
  margin-top: clamp(12px, 4vw, 18px);
  overflow: visible;
}

.track {
  fill: none;
  stroke: var(--oat);
  stroke-width: var(--_track-w);
  stroke-linecap: round;
}

.post {
  stroke: var(--oat);
  stroke-width: var(--_post-w);
  stroke-linecap: round;
}

/* Butt caps + a gap longer than the path: a zero-length dash never paints a stray dot. */
.trail {
  fill: none;
  stroke: var(--olive);
  stroke-width: var(--_trail-w);
  stroke-dasharray: 228 300;
  stroke-dashoffset: 228;
  animation: trail var(--t) var(--ease-in-out) infinite;
}

.lit {
  stroke: var(--olive);
  opacity: 0;
  animation: var(--t) var(--ease-out) infinite;
}
.lit-a { animation-name: light-a; }
.lit-b { animation-name: light-b; }
.lit-c { animation-name: light-c; }
.lit-d { animation-name: light-d; }

.baton {
  stroke: var(--rust);
  stroke-width: var(--_baton-w);
  stroke-linecap: round;
  opacity: 0;
  transform: translate(24px, 28px);
  animation: carry var(--t) var(--ease-in-out) infinite;
}

/* Legs are 18% of the loop with a 6% dwell at each post: the dwell is the handoff. */
@keyframes carry {
  0% { transform: translate(24px, 28px); opacity: 0; animation-timing-function: var(--ease-out); }
  6%, 10% { transform: translate(24px, 28px); opacity: 1; animation-timing-function: var(--ease-in-out); }
  28%, 34% { transform: translate(100px, 28px); opacity: 1; }
  52%, 58% { transform: translate(176px, 28px); opacity: 1; }
  76%, 84% { transform: translate(252px, 28px); opacity: 1; animation-timing-function: var(--ease-out); }
  92%, 100% { transform: translate(252px, 28px); opacity: 0; }
}

@keyframes trail {
  0%, 10% { stroke-dashoffset: 228; opacity: 1; }
  28%, 34% { stroke-dashoffset: 152; }
  52%, 58% { stroke-dashoffset: 76; }
  76%, 88% { stroke-dashoffset: 0; opacity: 1; animation-timing-function: var(--ease-out); }
  98%, 100% { stroke-dashoffset: 0; opacity: 0; }
}

@keyframes light-a { 0% { opacity: 0; } 6%, 88% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes light-b { 0%, 28% { opacity: 0; } 32%, 88% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes light-c { 0%, 52% { opacity: 0; } 56%, 88% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes light-d { 0%, 76% { opacity: 0; } 80%, 88% { opacity: 1; } 98%, 100% { opacity: 0; } }

@media (max-width: 380px) {
  .card { padding: 16px; }
  .sub { margin-top: 2px; }
}

/* Reduced motion: no travelling baton or growing trail; the posts still light in turn, at half pace. */
@media (prefers-reduced-motion: reduce) {
  .baton,
  .trail { animation: none; opacity: 0; }
  .lit { animation-duration: calc(var(--t) * 2); }
}
</style>
</head>
<body>
  <div class="card" role="status" aria-label="Syncing to 4 devices">
    <p class="title">Syncing to 4 devices</p>
    <p class="sub">Each one passes it on</p>
    <svg class="lane" viewBox="0 0 276 56" aria-hidden="true">
      <path class="track" d="M24 28 H252" />
      <line class="post" x1="24" y1="19" x2="24" y2="37" />
      <line class="post" x1="100" y1="19" x2="100" y2="37" />
      <line class="post" x1="176" y1="19" x2="176" y2="37" />
      <line class="post" x1="252" y1="19" x2="252" y2="37" />
      <path class="trail" d="M24 28 H252" />
      <line class="post lit lit-a" x1="24" y1="19" x2="24" y2="37" />
      <line class="post lit lit-b" x1="100" y1="19" x2="100" y2="37" />
      <line class="post lit lit-c" x1="176" y1="19" x2="176" y2="37" />
      <line class="post lit lit-d" x1="252" y1="19" x2="252" y2="37" />
      <g class="baton"><line x1="-12" y1="0" x2="12" y2="0" /></g>
    </svg>
  </div>
</body>
</html>

The variant family

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