Back to the library

Link — failover

Variant: Failover

The primary parts and traffic moves to a standby you could already see. The break is one frame: the line turns rust and the packets on it vanish with no fade, because a failure is an instant and a 200ms tween would read as a warning building. Each half then recoils to its own node on a 192ms overshooting curve — the one place in the family that earns a bounce, since a line under tension that snaps does not stop where it broke. Once the recoil settles, 256ms of nothing, which is detection: the health check has to miss before anything reroutes, and leaving the gap visible is what makes this a failover and not a redraw. The dashed standby path promotes in 512ms ease-in-out — it was already on screen, so it is drawn over, not introduced — and traffic resumes along it, labelled active. Use it for redundancy diagrams, multi-region status and any "we switched over" notice.

svgline-drawingerrordiagraminfrastructureloop

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>Link — failover</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;
        --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) 52%, transparent);
        --_rule: color-mix(in srgb, var(--slate) 30%, transparent);

        /* Clock — 6.4s: 1.9s of traffic on the primary, a 192ms snap, 256ms of
           detection, a 512ms promotion of the standby, then over two and a
           half seconds of traffic on the new path before the reset. */
        --cycle: 6.4s;
        --t: calc(var(--cycle) / var(--speed));
        --_flow: calc(0.24s / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
        --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
        /* The recoil. A cable under tension that parts does not stop where it
           broke; each end overshoots toward its anchor and settles. */
        --ease-accent: cubic-bezier(0.34, 1.56, 0.64, 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);
      }

      .link {
        width: min(280px, 86vw);
        height: auto;
        display: block;
      }

      /* Each half is owned by its node, so when the link parts both ends
         recoil home rather than one side vanishing. */
      .half {
        fill: none;
        stroke-width: 3;
        stroke-linecap: butt;
        stroke-dasharray: 100 200;
        animation: snap var(--t) infinite;
      }

      .packets {
        fill: none;
        stroke: var(--slate);
        stroke-width: 6;
        stroke-linecap: round;
        stroke-dasharray: 0 25;
      }

      .on-primary {
        animation:
          flow var(--_flow) linear infinite,
          primary-traffic var(--t) infinite;
      }

      .on-backup {
        animation:
          flow var(--_flow) linear infinite,
          backup-traffic var(--t) infinite;
      }

      .break {
        fill: none;
        stroke: var(--rust);
        stroke-width: 2.5;
        stroke-linecap: round;
        transform-box: fill-box;
        transform-origin: center;
        animation: break var(--t) infinite;
      }

      /* The standby is drawn in full the whole time — dashed, the family's
         word for a path that exists but carries nothing — so the failover is
         a promotion of something you could already see, not a new route. */
      .standby {
        fill: none;
        stroke: var(--_rule);
        stroke-width: 2.5;
        stroke-dasharray: 8 6;
      }

      .promoted {
        fill: none;
        stroke: var(--olive);
        stroke-width: 3;
        stroke-linecap: butt;
        stroke-dasharray: 100 200;
        animation: promote var(--t) infinite;
      }

      .node {
        fill: var(--paper);
        stroke: var(--slate);
        stroke-width: 2;
      }

      .label {
        font-family: inherit;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.14em;
      }

      .quiet {
        fill: var(--_muted);
      }

      .primary-up {
        animation: before var(--t) infinite;
      }

      .primary-down {
        fill: var(--rust);
        animation: after var(--t) infinite;
      }

      .backup-idle {
        animation: before-late var(--t) infinite;
      }

      .backup-live {
        fill: var(--olive);
        animation: after-late var(--t) infinite;
      }

      @keyframes flow {
        to {
          stroke-dashoffset: -25;
        }
      }

      /* The colour flips on the break frame itself — no fade — because the
         failure is an instant, and a 200ms tween to rust would read as a
         warning building up rather than a link that has already gone. */
      @keyframes snap {
        0%,
        29.9% {
          stroke: var(--olive);
          stroke-dashoffset: 0;
          opacity: 1;
        }
        30% {
          stroke: var(--rust);
          stroke-dashoffset: 0;
          opacity: 1;
          animation-timing-function: var(--ease-accent);
        }
        33% {
          stroke: var(--rust);
          stroke-dashoffset: 72;
          opacity: 1;
        }
        36% {
          stroke: var(--rust);
          stroke-dashoffset: 72;
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        44%,
        88% {
          stroke: var(--rust);
          stroke-dashoffset: 72;
          opacity: 0.4;
          animation-timing-function: var(--ease-out);
        }
        93% {
          stroke: var(--rust);
          stroke-dashoffset: 72;
          opacity: 0;
        }
        94% {
          stroke: var(--olive);
          stroke-dashoffset: 0;
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        100% {
          stroke: var(--olive);
          stroke-dashoffset: 0;
          opacity: 1;
        }
      }

      /* Packets in flight on the primary are lost with it — gone on the break
         frame, not faded, for the same reason the colour does not tween. */
      @keyframes primary-traffic {
        0%,
        29.9% {
          opacity: 1;
        }
        30%,
        94% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        100% {
          opacity: 1;
        }
      }

      @keyframes break {
        0%,
        30% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        33%,
        36% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        44%,
        88% {
          opacity: 0.6;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        93%,
        100% {
          opacity: 0;
          transform: scale(1);
        }
      }

      /* 256ms of nothing between the recoil settling and the promotion is
         detection — the health check has to miss before anything reroutes,
         and showing that gap is what makes this a failover, not a redraw. */
      @keyframes promote {
        0%,
        37% {
          stroke-dashoffset: 100;
          opacity: 1;
          animation-timing-function: var(--ease-in-out);
        }
        45%,
        88% {
          stroke-dashoffset: 0;
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        93% {
          stroke-dashoffset: 0;
          opacity: 0;
        }
        94%,
        100% {
          stroke-dashoffset: 100;
          opacity: 0;
        }
      }

      @keyframes backup-traffic {
        0%,
        45% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        48%,
        88% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        93%,
        100% {
          opacity: 0;
        }
      }

      @keyframes before {
        0%,
        29.9% {
          opacity: 1;
        }
        30%,
        91% {
          opacity: 0;
        }
        94%,
        100% {
          opacity: 1;
        }
      }

      @keyframes after {
        0%,
        29.9% {
          opacity: 0;
        }
        30%,
        88% {
          opacity: 1;
        }
        91%,
        100% {
          opacity: 0;
        }
      }

      /* Paired labels share a centre but are different widths, so each pair
         hands over in sequence — the old word leaves, then the new arrives. */
      @keyframes before-late {
        0%,
        43% {
          opacity: 1;
        }
        44.5%,
        91% {
          opacity: 0;
        }
        94%,
        100% {
          opacity: 1;
        }
      }

      @keyframes after-late {
        0%,
        44.5% {
          opacity: 0;
        }
        46%,
        88% {
          opacity: 1;
        }
        91%,
        100% {
          opacity: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The recoil is pure movement; the halves cut back without the
           overshoot. Everything else is state and stays, at 2x. */
        .half {
          --ease-accent: var(--ease-out);
        }

        .half,
        .break,
        .promoted,
        .primary-up,
        .primary-down,
        .backup-idle,
        .backup-live {
          animation-duration: calc(var(--t) * 2);
        }

        .on-primary,
        .on-backup {
          animation-duration: calc(var(--_flow) * 2), calc(var(--t) * 2);
        }
      }
    </style>
  </head>
  <body>
    <svg
      class="link"
      viewBox="0 0 280 156"
      role="img"
      aria-label="Packets flow over a solid primary link while a dashed standby path waits beneath it. The primary snaps: both ends recoil to their nodes in rust and the traffic on it is lost. After a short pause the standby path draws solid and traffic resumes along it, labelled active."
    >
      <text class="label quiet primary-up" x="140" y="32" text-anchor="middle">PRIMARY</text>
      <text class="label primary-down" x="140" y="32" text-anchor="middle">PRIMARY DOWN</text>

      <path class="standby" d="M 46 62 C 80 136, 200 136, 234 62" />
      <path class="promoted" pathLength="100" d="M 46 62 C 80 136, 200 136, 234 62" />
      <path class="packets on-backup" d="M 40 52 L 46 62 C 80 136, 200 136, 234 62 L 240 52" />

      <path class="half" pathLength="100" d="M 52 52 H 140" />
      <path class="half" pathLength="100" d="M 228 52 H 140" />
      <path class="packets on-primary" d="M 40 52 H 240" />
      <path class="break" d="M 135 47 L 145 57 M 145 47 L 135 57" />

      <circle class="node" cx="40" cy="52" r="12" />
      <circle class="node" cx="240" cy="52" r="12" />

      <text class="label quiet backup-idle" x="140" y="146" text-anchor="middle">STANDBY</text>
      <text class="label backup-live" x="140" y="146" text-anchor="middle">ACTIVE</text>
    </svg>
  </body>
</html>

The variant family

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