Ring code: changed dashes wipe from a random end instead of cross-fading
This commit is contained in:
@@ -12,8 +12,9 @@ for (const ms of [1000, 500]) {
|
||||
}
|
||||
|
||||
let slot = 0, bits = "", prevBits = "", switchedAt = 0, idx = 0;
|
||||
// changed dashes cross-fade over a short time, a few frames are then unreadable, which is fine
|
||||
const FADE = Math.min(220, MS * 0.25);
|
||||
// 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(220, MS * 0.25);
|
||||
function tick() {
|
||||
prevBits = bits || null;
|
||||
switchedAt = performance.now();
|
||||
@@ -34,7 +35,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 } : 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 } : 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