Back to the library

Metric drift alert

Variant: Standard

Two series draw as one shared line, then split at a marked point: one climbs, the other falls, and a 'Signals diverging' badge comes in. Use it on dashboards or anomaly cards to show that a headline number and the result it stands for have stopped moving together. The pen uses ease-in-out on each segment, so it slows right at the fork. The ring pulse and the badge wait until both branches are fully drawn, so the alert comes after the evidence for it.

chartalertdivergencedashboardstroke-draw

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>Metric drift alert — 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: 4.8s; /* 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 */

  --_stroke: 2;
  --_ring-w: 1.5;
  --_ring-s: 2.2;
  --_ring-o: 0.7;
  --_gap: 0.12;
  --_rise: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--ivory);
  color: var(--slate);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.card {
  width: min(360px, 92vw);
  background: var(--paper);
  border: 1px solid var(--oat);
  border-radius: calc(14px * var(--round));
  padding: clamp(14px, 4vw, 20px);
  display: grid;
  gap: clamp(8px, 2.5vw, 12px);
}
.head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.title { font-size: clamp(12px, 3.4vw, 14px); font-weight: 600; }
.legend { display: flex; gap: 10px; font-size: 11.5px; align-items: center; }
.legend span { opacity: 0.72; }
.key {
  display: inline-block;
  width: 12px;
  height: 3px;
  margin-right: 5px;
  border-radius: 999px;
  vertical-align: middle;
}
.key-a { background: var(--clay); }
.key-b { background: var(--olive); }

svg { display: block; width: 100%; height: auto; overflow: visible; }
.grid line { stroke: var(--oat); stroke-width: 1; stroke-dasharray: 2 4; }

.plot { animation: plot-out var(--t) var(--ease-out) infinite; }

/* Gap of 120 > the 104 start offset, so no second dash wraps in; 104 hides the round cap. */
.shared, .fork {
  fill: none;
  stroke-width: var(--_stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100 120;
  stroke-dashoffset: 104;
}
.shared {
  stroke: var(--slate);
  stroke-opacity: 0.7;
  animation: draw-shared var(--t) var(--ease-in-out) infinite;
}
.fork { animation: draw-fork var(--t) var(--ease-in-out) infinite; }
.proxy { stroke: var(--clay); }
.outcome { stroke: var(--olive); }

.gap {
  fill: var(--rust);
  opacity: 0;
  animation: gap-in var(--t) var(--ease-out) infinite;
}

.dot, .ring { transform-box: fill-box; transform-origin: center; }
.dot-fork { fill: var(--slate); opacity: 0; animation: dot-fork var(--t) var(--ease-out) infinite; }
.dot-a { fill: var(--clay); opacity: 0; animation: dot-end var(--t) var(--ease-out) infinite; }
.dot-b { fill: var(--olive); opacity: 0; animation: dot-end var(--t) var(--ease-out) infinite; }
.ring {
  fill: none;
  stroke: var(--rust);
  stroke-width: var(--_ring-w);
  opacity: 0;
  animation: ring var(--t) var(--ease-out) infinite;
}

.foot { min-height: 28px; display: flex; align-items: center; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  background: var(--paper);
  border: 1px solid var(--oat);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  transform-origin: left center;
  opacity: 0;
  animation: badge var(--t) var(--ease-out) infinite;
}
.bdot { width: 7px; height: 7px; border-radius: 50%; background: var(--rust); }

@keyframes draw-shared {
  0%, 6% { stroke-dashoffset: 104; }
  30%, 100% { stroke-dashoffset: 0; }
}
@keyframes draw-fork {
  0%, 32% { stroke-dashoffset: 104; }
  56%, 100% { stroke-dashoffset: 0; }
}
@keyframes dot-fork {
  0%, 29% { opacity: 0; transform: scale(0.9); }
  33%, 100% { opacity: 1; transform: scale(1); }
}
@keyframes dot-end {
  0%, 55% { opacity: 0; transform: scale(0.9); }
  59%, 100% { opacity: 1; transform: scale(1); }
}
@keyframes ring {
  0%, 56% { opacity: 0; transform: scale(0.9); }
  57% { opacity: var(--_ring-o); transform: scale(0.9); }
  76%, 100% { opacity: 0; transform: scale(var(--_ring-s)); }
}
@keyframes gap-in {
  0%, 56% { opacity: 0; }
  64%, 100% { opacity: var(--_gap); }
}
/* Enter 6% of 4.8s ≈ 290ms; exit 4% ≈ 190ms — leaving is quicker than arriving. */
@keyframes badge {
  0%, 58% { opacity: 0; transform: translateY(var(--_rise)) scale(0.96); }
  64%, 86% { opacity: 1; transform: translateY(0) scale(1); }
  90%, 100% { opacity: 0; transform: translateY(0) scale(0.98); }
}
@keyframes plot-out {
  0%, 88% { opacity: 1; }
  93%, 100% { opacity: 0; }
}

@keyframes rm-gap {
  0%, 100% { opacity: calc(var(--_gap) * 0.4); }
  50% { opacity: var(--_gap); }
}
@keyframes rm-badge {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .plot { animation: none; }
  .shared, .fork { animation: none; stroke-dashoffset: 0; }
  .dot-fork, .dot-a, .dot-b { animation: none; opacity: 1; transform: none; }
  .ring { animation: none; opacity: 0; }
  .gap { animation: rm-gap calc(var(--t) * 2) var(--ease-in-out) infinite; }
  .badge { animation: rm-badge calc(var(--t) * 2) var(--ease-in-out) infinite; transform: none; }
}

@media (max-width: 380px) {
  .card { padding: 13px; gap: 8px; }
  .legend { gap: 8px; font-size: 11px; }
  .badge { font-size: 11.5px; padding: 4px 10px 4px 8px; }
}
</style>
</head>
<body>
  <div class="card">
    <div class="head">
      <div class="title">Support · Q3</div>
      <div class="legend">
        <span><i class="key key-a"></i>Throughput</span>
        <span><i class="key key-b"></i>Quality</span>
      </div>
    </div>
    <svg viewBox="0 0 300 120" role="img" aria-label="Throughput rises while quality falls after a shared start">
      <g class="grid">
        <line x1="0" y1="24" x2="300" y2="24" />
        <line x1="0" y1="64" x2="300" y2="64" />
        <line x1="0" y1="104" x2="300" y2="104" />
      </g>
      <g class="plot">
        <path class="gap" d="M150 64 C 190 56, 230 34, 288 16 L 288 100 C 236 88, 190 70, 150 64 Z" />
        <path class="shared" pathLength="100" d="M12 72 C 40 70, 60 60, 84 64 S 128 70, 150 64" />
        <path class="fork proxy" pathLength="100" d="M150 64 C 190 56, 230 34, 288 16" />
        <path class="fork outcome" pathLength="100" d="M150 64 C 190 70, 236 88, 288 100" />
        <circle class="ring" cx="150" cy="64" r="6" />
        <circle class="dot dot-fork" cx="150" cy="64" r="3.5" />
        <circle class="dot dot-a" cx="288" cy="16" r="3.5" />
        <circle class="dot dot-b" cx="288" cy="100" r="3.5" />
      </g>
    </svg>
    <div class="foot">
      <span class="badge"><i class="bdot"></i>Signals diverging</span>
    </div>
  </div>
</body>
</html>

The variant family

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