Ring code: sine wipe over 60% of the interval; ringlab ?fade= and ?ease= knobs
This commit is contained in:
@@ -14,7 +14,8 @@ for (const ms of [1000, 500]) {
|
||||
let slot = 0, bits = "", prevBits = "", switchedAt = 0, idx = 0;
|
||||
// changed dashes wipe over a short time, a few frames are then unreadable, which is fine
|
||||
// ?fade=0.5 tries a longer wipe, as a share of the interval
|
||||
const FADE = params.get("fade") ? MS * +params.get("fade") : Math.min(400, MS * 0.45);
|
||||
const FADE = params.get("fade") ? MS * +params.get("fade") : Math.min(500, MS * 0.6);
|
||||
const EASE = params.get("ease") || "sine";
|
||||
function tick() {
|
||||
prevBits = bits || null;
|
||||
switchedAt = performance.now();
|
||||
@@ -35,7 +36,7 @@ function frame(t) {
|
||||
if (MODE === "ring") {
|
||||
// one full turn every 45 s
|
||||
const k = prevBits ? Math.min(1, (t - switchedAt) / FADE) : 1;
|
||||
render(ctx, w / 2, h / 2, size / (2 * DISC), (t / 1000) * (2 * Math.PI / 45), bits, t / 1000, prevBits ? { from: prevBits, k, seed: slot } : null);
|
||||
render(ctx, w / 2, h / 2, size / (2 * DISC), (t / 1000) * (2 * Math.PI / 45), bits, t / 1000, prevBits ? { from: prevBits, k, seed: slot, ease: EASE } : null);
|
||||
} else {
|
||||
const m = lab.classic[idx].modules, n = m.length, s = Math.floor(size / (n + 8));
|
||||
const x0 = (w - n * s) / 2, y0 = (h - n * s) / 2;
|
||||
|
||||
Reference in New Issue
Block a user