Progress ring fills each segment with a sweep instead of redrawing

This commit is contained in:
2026-08-16 22:44:02 +01:00
parent 13d42db0a3
commit aac778ceba
3 changed files with 48 additions and 15 deletions
+10 -3
View File
@@ -126,9 +126,16 @@ button:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.progress > div { height: 100%; background: var(--ink); border-radius: 99px; transition: width .3s; }
.ring { display: block; overflow: visible; }
.ring .seg { fill: none; stroke: var(--line); stroke-linecap: round; transition: stroke .3s; }
.ring .seg.on { stroke: var(--ink); }
.ring .seg.last { stroke: var(--mark); }
.ring .seg, .ring .fill { fill: none; stroke-linecap: round; }
.ring .seg { stroke: var(--line); }
/* empty fill sits one length ahead and hidden, so the round cap dot doesn't show */
.ring .fill {
stroke: var(--ink); stroke-dasharray: 1 1; stroke-dashoffset: 1; opacity: 0;
transition: stroke-dashoffset .5s cubic-bezier(.3, .7, .2, 1), opacity .12s, stroke .22s;
}
.ring .fill.on { stroke-dashoffset: 0; opacity: 1; }
.ring .fill.last { stroke: var(--mark); }
@media (prefers-reduced-motion: reduce) { .ring .fill { transition: opacity .2s, stroke .2s; } }
.ring text { font: 700 20px var(--round); fill: var(--ink); }
.codes-print { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }