Ring code: wipe eases in and out (quart), less stagger

This commit is contained in:
2026-11-16 23:00:19 +01:00
parent f0cf33c806
commit 478e30b2fe
+3 -2
View File
@@ -201,8 +201,9 @@ export function render(ctx, cx, cy, unit, theta, bits, t = 0, fade = null) {
const from = alphaOf(prev[k][j]), to = alphaOf(ring[j]); const from = alphaOf(prev[k][j]), to = alphaOf(ring[j]);
const lo = a - half - cap, hi = a + half + cap; const lo = a - half - cap, hi = a + half + cap;
const dir = phase(k + 7, j + (fade.seed || 0) * 31) < 0.5 ? 1 : -1; const dir = phase(k + 7, j + (fade.seed || 0) * 31) < 0.5 ? 1 : -1;
const delay = phase(k + 3, j + (fade.seed || 0) * 17) * 0.25, x = Math.min(1, Math.max(0, (fade.k - delay) / 0.75)); const delay = phase(k + 3, j + (fade.seed || 0) * 17) * 0.15, x = Math.min(1, Math.max(0, (fade.k - delay) / 0.85));
const e = 0.5 - 0.5 * Math.cos(Math.PI * x); // quart in-out: eases in, crosses, eases out. sine read as a constant slide
const e = x < 0.5 ? 8 * x ** 4 : 1 - (-2 * x + 2) ** 4 / 2;
if (!ctx.createConicGradient) { if (!ctx.createConicGradient) {
ctx.globalAlpha = from + (to - from) * e; ctx.globalAlpha = from + (to - from) * e;
dash(); dash();