Spaces:
Running
Running
spacebeam: grid toggle, from lightfastai/beam-entry c21191f
Browse filesFiles changed (3)
- README.md+1-1
- app.js+18-1
- index.html+1
23 unmodified lines2425262728293023 unmodified lines- **Rings.** One ring per layer, layer 3 innermost. Each token has its own spoke, at its place in the passage, so the passage sweeps round like a clock hand and fills the disc.- **Loom.** The layers are wedges round a circle in star order: each next layer is placed 20 wedges further round. The star shape comes from that layout, not from Beam. Only the points inside each wedge, and where each token's line passes through them, come from Beam.The controls are kept small: the passage, the speed, how many tokens' trails stay on screen, pause, and save the current picture as a PNG. Hover a point to see the expert's most frequent tokens and which tokens on screen picked it. Point at a layer and two guide lines cross at it, a circle at its radius and a spoke at its angle (the circle crosses every layer in Orbit and Loom, the spoke in Rings); the panel on the right then shows that layer for the token now travelling: its public picks by router weight, with each expert's most frequent tokens, and how many of its 8 picks went to withheld experts.## The five passages23 unmodified lines2425262728293023 unmodified lines- **Rings.** One ring per layer, layer 3 innermost. Each token has its own spoke, at its place in the passage, so the passage sweeps round like a clock hand and fills the disc.- **Loom.** The layers are wedges round a circle in star order: each next layer is placed 20 wedges further round. The star shape comes from that layout, not from Beam. Only the points inside each wedge, and where each token's line passes through them, come from Beam.The controls are kept small: the passage, the speed, how many tokens' trails stay on screen, pause, grid lines on or off (layer boundaries, and in Rings each word's spoke), and save the current picture as a PNG. Hover a point to see the expert's most frequent tokens and which tokens on screen picked it. Point at a layer and two guide lines cross at it, a circle at its radius and a spoke at its angle (the circle crosses every layer in Orbit and Loom, the spoke in Rings); the panel on the right then shows that layer for the token now travelling: its public picks by router weight, with each expert's most frequent tokens, and how many of its 8 picks went to withheld experts.## The five passages
17 unmodified lines18192021222324112 unmodified lines13713813914014114214314414514614714 unmodified lines16216316416516616772 unmodified lines24024124224324424517 unmodified linesconst $ = id => document.getElementById(id);const canvas = $("orbit"), ctx = canvas.getContext("2d");const S = {routes: null, cards: null, ex: 0, view: 0, p: 0, clock: 0, wps: 1, trail: 105, paused: false, last: null,g: null, bg: null, cache: new Map(), hover: null, cellPts: null, markPts: null,};112 unmodified lines$("trail").oninput = trailFromSlider;$("pause").onclick = togglePause;$("save").onclick = savePNG;function togglePause() { S.paused = !S.paused; $("pause").textContent = S.paused ? "Play" : "Pause"; $("pause").classList.toggle("on", S.paused); }window.addEventListener("keydown", ev => {if (ev.metaKey || ev.ctrlKey || ev.altKey) return;if (ev.key === " ") { ev.preventDefault(); togglePause(); }else if (ev.key === "s") savePNG();else if (/^[1-3]$/.test(ev.key) && S.routes) pickView(+ev.key - 1);});speedFromSlider();14 unmodified linesif (wasWhole || +$("trail").value > e.n) $("trail").value = e.n;trailFromSlider();caption();$("ptitle").textContent = `${LABEL[e.kind] || e.kind} · ${e.n} words`;$("psrc").textContent = `${e.source} · ${e.licence}`;$("text").innerHTML = e.tokens.map((t, k) => `<span data-k="${k}"${t.s ? ' class="s"' : ""}>${esc(t.t)}</span>`).join("");72 unmodified linesx.fillStyle = "rgba(232,232,227,0.07)";const d = Math.max(0.8, u);for (const [, , px, py] of S.cellPts) x.fillRect(px - d / 2, py - d / 2, d, d);x.lineWidth = (view().thin ? 0.6 : 2) * u; x.strokeStyle = "rgba(232,232,227,0.06)";for (const pts of S.markPts) strokePts(x, pts);x.font = `${Math.max(9, 10 * u)}px ui-monospace, Menlo, monospace`;17 unmodified lines18192021222324112 unmodified lines13713813914014114214314414514614714814915014 unmodified lines16516616716816917017172 unmodified lines24424524624724824925025125225325425525625725825926026126217 unmodified linesconst $ = id => document.getElementById(id);const canvas = $("orbit"), ctx = canvas.getContext("2d");const S = {routes: null, cards: null, grid: true, ex: 0, view: 0, p: 0, clock: 0, wps: 1, trail: 105, paused: false, last: null,g: null, bg: null, cache: new Map(), hover: null, cellPts: null, markPts: null,};112 unmodified lines$("trail").oninput = trailFromSlider;$("pause").onclick = togglePause;$("save").onclick = savePNG;function toggleGrid() { S.grid = !S.grid; $("grid").classList.toggle("on", S.grid); if (S.g) S.bg = drawBackground(); }$("grid").onclick = toggleGrid;function togglePause() { S.paused = !S.paused; $("pause").textContent = S.paused ? "Play" : "Pause"; $("pause").classList.toggle("on", S.paused); }window.addEventListener("keydown", ev => {if (ev.metaKey || ev.ctrlKey || ev.altKey) return;if (ev.key === " ") { ev.preventDefault(); togglePause(); }else if (ev.key === "s") savePNG();else if (ev.key === "g") toggleGrid();else if (/^[1-3]$/.test(ev.key) && S.routes) pickView(+ev.key - 1);});speedFromSlider();14 unmodified linesif (wasWhole || +$("trail").value > e.n) $("trail").value = e.n;trailFromSlider();caption();if (S.g) S.bg = drawBackground();$("ptitle").textContent = `${LABEL[e.kind] || e.kind} · ${e.n} words`;$("psrc").textContent = `${e.source} · ${e.licence}`;$("text").innerHTML = e.tokens.map((t, k) => `<span data-k="${k}"${t.s ? ' class="s"' : ""}>${esc(t.t)}</span>`).join("");72 unmodified linesx.fillStyle = "rgba(232,232,227,0.07)";const d = Math.max(0.8, u);for (const [, , px, py] of S.cellPts) x.fillRect(px - d / 2, py - d / 2, d, d);if (S.grid) {const g = S.g, V = view();x.strokeStyle = "rgba(232,232,227,0.09)"; x.lineWidth = 0.6 * u; x.beginPath();if (V.perWord) {const n = S.routes.excerpts[S.ex].n;for (let i = 0; i <= L; i++) { x.moveTo(g.c + g.Q0 + g.bw * i, g.c); x.arc(g.c, g.c, g.Q0 + g.bw * i, 0, 2 * Math.PI); }for (let k = 0; k < n; k++) { const th = -Math.PI / 2 + 2 * Math.PI * k / n; x.moveTo(...polar(th, g.Q0)); x.lineTo(...polar(th, g.Q1)); }} else {for (let s = 0; s < L; s++) { const th = -Math.PI / 2 + A * s; x.moveTo(...polar(th, g.R0)); x.lineTo(...polar(th, g.R1)); }for (let q = 0; q <= 4; q++) { const r = g.R0 + (g.R1 - g.R0) * q / 4; x.moveTo(g.c + r, g.c); x.arc(g.c, g.c, r, 0, 2 * Math.PI); }}x.stroke();}x.lineWidth = (view().thin ? 0.6 : 2) * u; x.strokeStyle = "rgba(232,232,227,0.06)";for (const pts of S.markPts) strokePts(x, pts);x.font = `${Math.max(9, 10 * u)}px ui-monospace, Menlo, monospace`;
12 unmodified lines13141516171812 unmodified lines<div class="ctl"><label>speed <input id="speed" type="range" min="0" max="100" step="any" value="8.139"><span id="speedv" class="v"></span></label><label>trail <input id="trail" type="range" min="1" max="105" value="5"><span id="trailv" class="v"></span></label><button id="pause" title="Pause (space)">Pause</button><button id="save" title="Save PNG (s)">Save PNG</button></div>12 unmodified lines1314151617181912 unmodified lines<div class="ctl"><label>speed <input id="speed" type="range" min="0" max="100" step="any" value="8.139"><span id="speedv" class="v"></span></label><label>trail <input id="trail" type="range" min="1" max="105" value="5"><span id="trailv" class="v"></span></label><button id="grid" class="on" title="Grid lines (g)">Grid</button><button id="pause" title="Pause (space)">Pause</button><button id="save" title="Save PNG (s)">Save PNG</button></div>
README.md+1-1
app.js+18-1
index.html+1