Undraw — collapse to the midpoint
Variant: Collapse to midpoint
Deleting an edge between two nodes, where the question is which end the line should leave from — and the answer is neither. Neither node owns the relationship, so both ends travel inward along the curve itself and meet in the midpoint handle that was clicked to select it. The retract starts on the keydown frame and runs 408ms on ease-out: Delete is a response, so it moves at once, and the slow end of the curve folds the line visibly into its own selection. The ports go hollow the moment their end departs rather than when it arrives, because the relationship ended on keydown and the line is only catching up. The handle goes last, to 0.6 rather than to a point, since a mark shrinking to nothing reads as being sucked away rather than removed. Reach for it in node editors, dependency graphs and flow builders: any deletion of a link between two things that both stay.
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>Undraw — collapse to the midpoint</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;
--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)
);
/* Clock — 4.8s, shared by the whole undraw family (1% = 48ms).
Select at 672ms, Delete at 1440ms, both ends home on the midpoint
408ms later, then 1.8s of two unconnected nodes before the connector
fades back for the next pass. */
--cycle: 4.8s;
--t: calc(var(--cycle) / var(--speed));
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
--_ink: color-mix(in srgb, var(--slate) 80%, transparent);
--_wire: color-mix(in oklch, var(--slate) 38%, var(--paper));
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
min-height: 100vh;
display: grid;
place-items: center;
padding: clamp(10px, 3vw, 28px);
background: var(--ivory);
font-family:
system-ui,
-apple-system,
'Segoe UI',
Roboto,
sans-serif;
}
.card {
width: min(380px, 92vw);
border: 1px solid var(--oat);
border-radius: calc(14px * var(--round));
background: var(--paper);
}
.card svg {
display: block;
width: 100%;
height: auto;
}
.node rect {
fill: var(--ivory);
stroke: var(--oat);
stroke-width: 1;
rx: calc(8px * var(--round));
}
.node text {
font-size: 12.5px;
font-weight: 500;
fill: var(--_ink);
text-anchor: middle;
}
/* The connector is authored as two halves, each starting at the midpoint
and running out to a port. A rising dashoffset shrinks a dash back
toward its path's start, so both ends travel inward along the curve
itself — a straight scaleX would flatten the S on the way. pathLength
normalises both halves, so they arrive together. */
.half {
fill: none;
stroke-width: 2;
stroke-linecap: round;
stroke-dasharray: 100 200;
animation: half var(--t) infinite;
}
/* Ease-out, 408ms, starting on the keydown frame. Delete is a response,
so it moves at once; the slow end of the curve lands both ends on the
handle you selected, so the line visibly folds into its own selection
and nothing is left pointing anywhere. Neither node owns the edge, so
neither end is privileged — that symmetry is the whole message. */
@keyframes half {
0%,
14% {
stroke: var(--_wire);
stroke-dashoffset: 0;
opacity: 1;
animation-timing-function: ease;
}
17.5%,
31% {
stroke: var(--clay);
stroke-dashoffset: 0;
opacity: 1;
animation-timing-function: var(--ease-out);
}
39.5% {
stroke: var(--clay);
stroke-dashoffset: 102;
opacity: 1;
}
39.6%,
80% {
stroke: var(--_wire);
stroke-dashoffset: 0;
opacity: 0;
animation-timing-function: ease;
}
86%,
100% {
stroke: var(--_wire);
stroke-dashoffset: 0;
opacity: 1;
}
}
.handle {
fill: var(--paper);
stroke: var(--clay);
stroke-width: 2;
transform-box: fill-box;
transform-origin: center;
animation: handle var(--t) infinite;
}
/* The handle is the selection, and the last thing to go: it leaves only
once both ends have arrived inside it, at 0.6 rather than 0, because a
mark shrinking to a point reads as being sucked away, not removed. */
@keyframes handle {
0%,
14% {
opacity: 0;
transform: scale(0.6);
animation-timing-function: var(--ease-out);
}
17.5%,
39.5% {
opacity: 1;
transform: scale(1);
animation-timing-function: var(--ease-out);
}
42.5%,
100% {
opacity: 0;
transform: scale(0.6);
}
}
/* The click that selects: one ring off the point that was pressed,
about 70ms ahead of the selection it causes, so the clay has a reason. */
.tap {
fill: none;
stroke: var(--clay);
stroke-width: 1.5;
transform-box: fill-box;
transform-origin: center;
opacity: 0;
animation: tap var(--t) infinite;
}
@keyframes tap {
0%,
12.5% {
opacity: 0;
transform: scale(0.5);
}
12.6% {
opacity: 0.8;
transform: scale(0.5);
animation-timing-function: var(--ease-out);
}
19%,
100% {
opacity: 0;
transform: scale(1.9);
}
}
.port {
stroke-width: 1.5;
animation: port var(--t) infinite;
}
/* Ports empty the moment their end departs, not when it arrives. The
relationship is gone on keydown; the line is only catching up. */
@keyframes port {
0%,
14% {
fill: var(--_wire);
stroke: var(--_wire);
animation-timing-function: ease;
}
17.5%,
31% {
fill: var(--clay);
stroke: var(--clay);
animation-timing-function: ease;
}
34.75%,
80% {
fill: var(--paper);
stroke: var(--oat);
animation-timing-function: ease;
}
86%,
100% {
fill: var(--_wire);
stroke: var(--_wire);
}
}
.key {
transform-box: fill-box;
transform-origin: center;
animation: key var(--t) infinite;
}
.key rect {
fill: var(--paper);
stroke: var(--oat);
stroke-width: 1;
rx: calc(6px * var(--round));
animation: key-fill var(--t) infinite;
}
.key text {
font-size: 12px;
font-weight: 500;
fill: var(--_ink);
text-anchor: middle;
}
@keyframes key {
0%,
30% {
transform: translateY(0);
animation-timing-function: var(--ease-out);
}
31% {
transform: translateY(1.5px);
animation-timing-function: var(--ease-out);
}
34%,
100% {
transform: translateY(0);
}
}
@keyframes key-fill {
0%,
30% {
fill: var(--paper);
animation-timing-function: ease;
}
31% {
fill: var(--oat);
animation-timing-function: ease;
}
37%,
100% {
fill: var(--paper);
}
}
@media (prefers-reduced-motion: reduce) {
/* The same score on a clock twice as slow: every keyframe scales
together, so the alignments the comments rely on still hold. */
:root {
--t: calc(var(--cycle) * 2 / var(--speed));
}
/* The inward travel is removed; the connector fades where it lies on
the same window, and the ports still empty on the keydown frame. */
.half {
animation-name: half-calm;
}
.handle {
animation-name: handle-calm;
}
.key,
.tap {
animation: none;
}
@keyframes half-calm {
0%,
14% {
stroke: var(--_wire);
opacity: 1;
animation-timing-function: ease;
}
17.5%,
31% {
stroke: var(--clay);
opacity: 1;
animation-timing-function: ease;
}
39.5%,
80% {
stroke: var(--clay);
opacity: 0;
animation-timing-function: ease;
}
86%,
100% {
stroke: var(--_wire);
opacity: 1;
}
}
@keyframes handle-calm {
0%,
14% {
opacity: 0;
animation-timing-function: ease;
}
17.5%,
31% {
opacity: 1;
animation-timing-function: ease;
}
39.5%,
100% {
opacity: 0;
}
}
}
</style>
</head>
<body>
<div class="card">
<svg
viewBox="0 0 300 150"
role="img"
aria-label="A connector between two workflow steps is selected and deleted; both of its ends retract along the curve into the midpoint handle, which then disappears, leaving the two steps unconnected"
>
<g class="node">
<rect x="16" y="44" width="80" height="40" />
<text x="56" y="68.5">Returns</text>
</g>
<g class="node">
<rect x="204" y="66" width="80" height="40" />
<text x="244" y="90.5">Reshelve</text>
</g>
<path class="half" pathLength="100" d="M 150 75 C 136.5 69.5, 123 64, 96 64" />
<path class="half" pathLength="100" d="M 150 75 C 163.5 80.5, 177 86, 204 86" />
<circle class="port" cx="96" cy="64" r="3.5" />
<circle class="port" cx="204" cy="86" r="3.5" />
<circle class="tap" cx="150" cy="75" r="6" />
<circle class="handle" cx="150" cy="75" r="4.5" />
<g class="key">
<rect x="122" y="116" width="56" height="22" />
<text x="150" y="131.5">Delete</text>
</g>
</svg>
</div>
</body>
</html>
The variant family
Same idea, one axis moved. Compare them side by side before you commit.