gui: masking's flow draws whole curves in the middle's own pixels

The flow from agents through the shield to vendors drew its ribbons in a
0..100 viewBox stretched to fit, with a pathLength-1 dash left on each
after the draw-in, so at most widths they showed as broken dashes, and
the nodes stretched as wide as the card.

Now the curves are drawn in the middle's real width (again as it is
resized), wider and darker by their share, and a draw-in dashes them by
their own length and clears it after. Dots run along each curve, grey
on the way in and accent after the shield, unless motion is reduced.
The nodes are at most 200px and the flow at most 760px, centred; the
shield sits in two quiet rings. No gradient.

Run: screenshots in Chromium at 1100 and 2000px (light, dark) and
WebKit at 640 and 1100px: every curve whole, no page error.
This commit is contained in:
yetone
2026-10-21 23:28:26 +08:00
parent 4042aa4d1d
commit 083b1c8e7c
2 changed files with 46 additions and 17 deletions
+4 -2
View File
@@ -3261,7 +3261,7 @@ body:not(.side-nav) #view-settings .set-head.stuck::before { box-shadow: 0 1px 0
.mo-row.model .mo-meter i { background: var(--c6); }
.mo-dotc { flex: none; width: 7px; height: 7px; border-radius: 50%; }
.mo-spark { flex: none; display: inline-flex; justify-self: center; color: var(--c6); }
.mo-flow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(56px, 1fr) minmax(0, 1fr); }
.mo-flow { display: grid; grid-template-columns: minmax(0, 200px) minmax(96px, 1fr) minmax(0, 200px); max-width: 760px; margin: 0 auto; }
.mo-col { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; }
.mo-node { display: flex; align-items: center; gap: 7px; height: 30px; min-width: 0; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-size: 12px; cursor: default; }
.mo-node:not(:disabled):hover { background: var(--pill); }
@@ -3271,8 +3271,10 @@ body:not(.side-nav) #view-settings .set-head.stuck::before { box-shadow: 0 1px 0
.mo-mid { position: relative; min-width: 0; }
.mo-mid svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mo-rib { fill: none; stroke: var(--fg); stroke-linecap: round; }
.mo-dot { fill: var(--muted); opacity: 0; }
.mo-dot.out { fill: var(--accent); }
.mo-rib.out { stroke: var(--accent); }
.mo-hub { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent); background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2), 0 0 0 4px var(--card); }
.mo-hub { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent); background: var(--card); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), 0 0 0 5px color-mix(in srgb, var(--accent) 9%, transparent), 0 0 0 11px color-mix(in srgb, var(--accent) 4%, transparent); }
.mo-values { display: flex; flex-wrap: wrap; gap: 6px; }
.mo-val { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line); background: transparent; color: var(--fg); font: inherit; font-size: 12px; cursor: default; outline: none; }
.mo-val:hover { border-color: var(--line-2); background: var(--pill); }
+42 -15
View File
@@ -22303,32 +22303,59 @@ function maskFlow(sum, move) {
const mid = el("div", "mo-mid");
const rowH = 34;
const H = Math.max(fromRows.length, toRows.length) * rowH - 4;
const s = sv("svg", { viewBox: `0 0 100 ${H}`, preserveAspectRatio: "none", "aria-hidden": "true" });
const max = Math.max(...fromRows.map((r) => r.n), ...toRows.map((r) => r.n), 1);
const ys = (rows) => {
const off = (H - (rows.length * rowH - 4)) / 2;
return rows.map((_, i) => off + i * rowH + 15);
};
const c = H / 2;
const ribs = [];
const line = (d, n, out) => sv("path", { d, class: "mo-rib" + (out ? " out" : ""), "stroke-width": 1 + n / max, "stroke-opacity": (out ? .3 : .16) + (.5 * n) / max, "vector-effect": "non-scaling-stroke", pathLength: 1 });
ys(fromRows).forEach((y, i) => ribs.push(line(`M0,${y}C28,${y} 26,${c} 50,${c}`, fromRows[i].n)));
ys(toRows).forEach((y, i) => ribs.push(line(`M50,${c}C74,${c} 72,${y} 100,${y}`, toRows[i].n, true)));
s.append(...ribs);
const c = H / 2, hubR = 19;
const hub = el("span", "mo-hub");
hub.append(svg(SHIELD, 16, 1.6));
hub.title = t("Masked here, on this computer");
// drawn in the middle's own pixels, again as it is resized: a viewBox
// stretched to fit would bend the strokes and their dashes
const s = sv("svg", { "aria-hidden": "true" });
let drawnW = 0, first = true;
const draw = () => {
const W = Math.round(mid.clientWidth);
if (!W || W === drawnW) return;
drawnW = W;
s.setAttribute("viewBox", `0 0 ${W} ${H}`);
s.replaceChildren();
const m = W / 2, bend = Math.max(18, (m - hubR) * .55);
const ribs = [];
const rib = (d, n, out, i) => {
const w = 1.5 + 5 * n / max;
const path = sv("path", { d, class: "mo-rib" + (out ? " out" : ""), "stroke-width": w, "stroke-opacity": (out ? .34 : .14) + .36 * n / max });
s.append(path);
ribs.push(path);
// what goes along it: a value as it was on the way in, a placeholder
// after the shield; more of them on a busier ribbon
if (!stillMotion()) for (let k = 0, dots = 1 + Math.round(2 * n / max); k < dots; k++) {
const dot = sv("circle", { r: out ? 2.2 : 1.8, class: "mo-dot" + (out ? " out" : "") });
const dur = 2.4 + i * .17;
dot.append(sv("animateMotion", { path: d, dur: dur + "s", begin: (out ? 1.2 : 0) + k * dur / dots + "s", repeatCount: "indefinite", keyPoints: "0;1", keyTimes: "0;1", calcMode: "spline", keySplines: ".45 0 .55 1" }));
dot.append(sv("animate", { attributeName: "opacity", values: "0;1;1;0", keyTimes: "0;.12;.85;1", dur: dur + "s", begin: (out ? 1.2 : 0) + k * dur / dots + "s", repeatCount: "indefinite" }));
s.append(dot);
}
};
ys(fromRows).forEach((y, i) => rib(`M0,${y}C${bend},${y} ${m - hubR - bend},${c} ${m - hubR},${c}`, fromRows[i].n, false, i));
ys(toRows).forEach((y, i) => rib(`M${m + hubR},${c}C${m + hubR + bend},${c} ${W - bend},${y} ${W},${y}`, toRows[i].n, true, i));
if (move && first) ribs.forEach((r, i) => {
// drawn in once, by its own length, then left whole
const len = r.getTotalLength();
r.style.strokeDasharray = `${len} ${len}`;
const out = r.classList.contains("out");
r.animate([{ strokeDashoffset: len }, { strokeDashoffset: 0 }], { duration: 760, delay: 380 + (out ? 520 : 0) + i * 40, easing: "cubic-bezier(.65, 0, .35, 1)", fill: "backwards" })
.finished.then(() => { r.style.strokeDasharray = ""; }, () => { r.style.strokeDasharray = ""; });
});
first = false;
};
mid.append(s, hub);
flow.style.height = H + "px";
flow.append(from, mid, to);
if (move) {
ribs.forEach((r, i) => {
r.style.strokeDasharray = "1";
const out = r.classList.contains("out");
r.animate([{ strokeDashoffset: 1 }, { strokeDashoffset: 0 }], { duration: 760, delay: 380 + (out ? 520 : 0) + i * 40, easing: "cubic-bezier(.65, 0, .35, 1)", fill: "backwards" });
});
hub.animate([{ transform: "scale(.4)", opacity: 0 }, { transform: "none", opacity: 1 }], { duration: 520, delay: 760, easing: "cubic-bezier(.34, 1.56, .64, 1)", fill: "backwards" });
}
new ResizeObserver(draw).observe(mid);
if (move) hub.animate([{ transform: "scale(.4)", opacity: 0 }, { transform: "none", opacity: 1 }], { duration: 520, delay: 760, easing: "cubic-bezier(.34, 1.56, .64, 1)", fill: "backwards" });
return flow;
}