Link — drain, then cut
Variant: Drain, then cut
Graduated friction for the most expensive thing you can do to a live link: three gates, each one a different act, and each opened only by the one before it. Cordon turns the line dashed and stops admissions — the continuous stream hands off, on the exact frame, to seven real packets at the same positions, and nothing appears behind the last. Drain is not a timer: those packets finish at the flow’s own 87.5 units a second, linear, and the gate’s segment fills on the same clock, so it completes on the frame the last one lands. Each gate lights when its act finishes, not when it starts. Cut only then, and calmly — both halves withdraw to their nodes on a 480ms ease-in-out in the line’s own colour. No rust and no recoil, on purpose: set it beside the failover and the difference between a decision and an accident is entirely in the motion. Use it to explain decommissions, deploy drains and destructive confirms that must wait for in-flight work.
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 — drain, then cut</title>
<style>
/* The drain clock. Every in-flight packet reads the same number and
clamps it to its own distance from the far node, so they all keep the
flow's exact speed and each stops, hidden, the moment it arrives. */
@property --_p {
syntax: '<number>';
initial-value: 0;
inherits: true;
}
: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);
/* Clock — 8s, exactly 25 flow periods, so the packet pattern is in the
same phase at every cordon and the hand-off below lands on real
positions. 1.12s of traffic, a 2.13s drain, a 192ms confirm, a 480ms
cut, then the link stays gone for 3.4s. */
--cycle: 8s;
--t: calc(var(--cycle) / var(--speed));
--_flow: calc(0.32s / var(--speed));
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 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;
}
.half {
fill: none;
stroke: var(--olive);
stroke-width: 3;
stroke-linecap: butt;
stroke-dasharray: 100 200;
animation: cut var(--t) infinite;
}
/* Cordoned is drawn by laying ivory gaps over the solid line rather than
dashing it, so the halves can still retract by dashoffset during the
cut; once they are gone the gaps sit on ivory and vanish with them. */
.cordon {
fill: none;
stroke: var(--ivory);
stroke-width: 5;
stroke-dasharray: 6 8;
animation: cordon var(--t) infinite;
}
.stream {
fill: none;
stroke: var(--slate);
stroke-width: 6;
stroke-linecap: round;
stroke-dasharray: 0 28;
animation:
flow var(--_flow) linear infinite,
admitting var(--t) infinite;
}
.in-flight {
animation:
drain var(--t) infinite,
draining var(--t) infinite;
}
.in-flight circle {
fill: var(--slate);
transform: translateX(calc(min(var(--_p), var(--_d)) * 1px));
}
.node {
fill: var(--paper);
stroke: var(--slate);
stroke-width: 2;
}
.detached {
animation: detach var(--t) infinite;
}
.name {
fill: var(--_muted);
font-family: inherit;
font-size: 12px;
font-weight: 500;
}
.track {
fill: none;
stroke: var(--oat);
stroke-width: 2;
}
.fill {
fill: none;
stroke: var(--slate);
stroke-width: 2;
stroke-linecap: butt;
stroke-dasharray: 100 200;
}
.seg-drain {
animation: seg-drain var(--t) infinite;
}
.seg-confirm {
animation: seg-confirm var(--t) infinite;
}
.pip {
fill: var(--paper);
stroke: var(--oat);
stroke-width: 2;
}
.done {
fill: var(--slate);
transform-box: fill-box;
transform-origin: center;
}
.gate {
fill: var(--_muted);
font-family: inherit;
font-size: 12px;
font-weight: 600;
letter-spacing: 0.14em;
}
.g1 {
animation: gate-1 var(--t) infinite;
}
.g2 {
animation: gate-2 var(--t) infinite;
}
.g3 {
animation: gate-3 var(--t) infinite;
}
.progress {
animation: progress var(--t) infinite;
}
@keyframes flow {
to {
stroke-dashoffset: -28;
}
}
/* At 14% the stream's dots sit at 54, 82 … 222. The continuous pattern
goes on that exact frame and seven real packets take over from the
same positions — the sender has stopped admitting, so nothing appears
behind the last one. */
@keyframes admitting {
0%,
13.9% {
opacity: 1;
}
14%,
94% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
100% {
opacity: 1;
}
}
@keyframes draining {
0%,
13.9% {
opacity: 0;
}
14%,
42% {
opacity: 1;
}
42.1%,
100% {
opacity: 0;
}
}
/* 200 units in 2.286s: the flow's own 87.5 units a second, linear,
because the packets are reporting progress, not performing it. */
@keyframes drain {
0%,
14% {
--_p: 0;
animation-timing-function: linear;
}
42.57%,
98% {
--_p: 200;
}
99%,
100% {
--_p: 0;
}
}
@keyframes cordon {
0%,
14% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
17%,
92% {
opacity: 1;
}
93%,
100% {
opacity: 0;
}
}
/* The cut is deliberate, so it is calm: ease-in-out over 480ms, both
halves withdrawing to their own node in the line's own colour. No
rust, no recoil — compare the failover, where nobody chose this. */
@keyframes cut {
0%,
44% {
stroke-dashoffset: 0;
opacity: 1;
animation-timing-function: var(--ease-in-out);
}
50%,
93% {
stroke-dashoffset: 100;
opacity: 1;
}
94% {
stroke-dashoffset: 0;
opacity: 0;
animation-timing-function: var(--ease-out);
}
100% {
stroke-dashoffset: 0;
opacity: 1;
}
}
@keyframes detach {
0%,
48% {
stroke: var(--slate);
animation-timing-function: var(--ease-out);
}
52%,
90% {
stroke: var(--oat);
animation-timing-function: var(--ease-out);
}
96%,
100% {
stroke: var(--slate);
}
}
/* The drain gate's segment fills on the same linear clock as the
packets, ending on the frame the last one lands at 40.6%. */
@keyframes seg-drain {
0%,
14% {
stroke-dashoffset: 100;
animation-timing-function: linear;
}
40.6%,
97% {
stroke-dashoffset: 0;
}
98%,
100% {
stroke-dashoffset: 100;
}
}
@keyframes seg-confirm {
0%,
41.6% {
stroke-dashoffset: 100;
animation-timing-function: var(--ease-in-out);
}
44%,
97% {
stroke-dashoffset: 0;
}
98%,
100% {
stroke-dashoffset: 100;
}
}
/* Each gate lights when its act has finished, never when it starts:
cordon once the dashes are fully down, drain on the last arrival,
cut once both halves are home. */
@keyframes gate-1 {
0%,
17% {
opacity: 0;
transform: scale(0.9);
animation-timing-function: var(--ease-out);
}
19.5%,
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes gate-2 {
0%,
40.6% {
opacity: 0;
transform: scale(0.9);
animation-timing-function: var(--ease-out);
}
43.1%,
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes gate-3 {
0%,
50% {
opacity: 0;
transform: scale(0.9);
animation-timing-function: var(--ease-out);
}
52.5%,
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes progress {
0%,
88% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
94%,
100% {
opacity: 0;
}
}
@keyframes gate-label-1 {
0%,
17% {
fill: var(--_muted);
}
19.5%,
88% {
fill: var(--slate);
}
94%,
100% {
fill: var(--_muted);
}
}
@keyframes gate-label-2 {
0%,
40.6% {
fill: var(--_muted);
}
43.1%,
88% {
fill: var(--slate);
}
94%,
100% {
fill: var(--_muted);
}
}
@keyframes gate-label-3 {
0%,
50% {
fill: var(--_muted);
}
52.5%,
88% {
fill: var(--slate);
}
94%,
100% {
fill: var(--_muted);
}
}
.gate.l1 {
animation: gate-label-1 var(--t) infinite;
}
.gate.l2 {
animation: gate-label-2 var(--t) infinite;
}
.gate.l3 {
animation: gate-label-3 var(--t) infinite;
}
@media (prefers-reduced-motion: reduce) {
/* Every clock slows together, flow included, so the hand-off at the
cordon still lands on real packet positions. */
.half,
.cordon,
.detached,
.seg-drain,
.seg-confirm,
.progress,
.g1,
.g2,
.g3,
.gate.l1,
.gate.l2,
.gate.l3 {
animation-duration: calc(var(--t) * 2);
}
.stream {
animation-duration: calc(var(--_flow) * 2), calc(var(--t) * 2);
}
.in-flight {
animation-duration: calc(var(--t) * 2), calc(var(--t) * 2);
}
}
</style>
</head>
<body>
<svg
class="link"
viewBox="0 0 280 146"
role="img"
aria-label="A live link from a load balancer to node-3 carrying a steady stream of packets is taken down in three gated steps. Cordon: the line turns dashed and no new packets enter. Drain: the packets already in flight finish arriving. Cut: only once the line is empty, both halves withdraw calmly to their nodes."
>
<path class="half" pathLength="100" d="M 52 52 H 140" />
<path class="half" pathLength="100" d="M 228 52 H 140" />
<path class="cordon" d="M 52 52 H 228" />
<path class="stream" d="M 40 52 H 240" />
<g class="in-flight">
<circle cx="54" cy="52" r="3" style="--_d: 186" />
<circle cx="82" cy="52" r="3" style="--_d: 158" />
<circle cx="110" cy="52" r="3" style="--_d: 130" />
<circle cx="138" cy="52" r="3" style="--_d: 102" />
<circle cx="166" cy="52" r="3" style="--_d: 74" />
<circle cx="194" cy="52" r="3" style="--_d: 46" />
<circle cx="222" cy="52" r="3" style="--_d: 18" />
</g>
<circle class="node" cx="40" cy="52" r="12" />
<circle class="node detached" cx="240" cy="52" r="12" />
<text class="name" x="40" y="84" text-anchor="middle">lb</text>
<text class="name" x="240" y="84" text-anchor="middle">node-3</text>
<path class="track" d="M 75 108 H 135 M 145 108 H 205" />
<g class="progress">
<path class="fill seg-drain" pathLength="100" d="M 75 108 H 135" />
<path class="fill seg-confirm" pathLength="100" d="M 145 108 H 205" />
</g>
<circle class="pip" cx="70" cy="108" r="5" />
<circle class="pip" cx="140" cy="108" r="5" />
<circle class="pip" cx="210" cy="108" r="5" />
<g class="progress">
<circle class="done g1" cx="70" cy="108" r="5" />
<circle class="done g2" cx="140" cy="108" r="5" />
<circle class="done g3" cx="210" cy="108" r="5" />
</g>
<text class="gate l1" x="70" y="134" text-anchor="middle">CORDON</text>
<text class="gate l2" x="140" y="134" text-anchor="middle">DRAIN</text>
<text class="gate l3" x="210" y="134" text-anchor="middle">CUT</text>
</svg>
</body>
</html>
The variant family
Same idea, one axis moved. Compare them side by side before you commit.