In this section
- Realgame Test test · kuiper-belt / learn-the-kuiper/202610050010/modules/realgame-test.html lines 1–17
- Audio Unlock interaction · kuiper-belt / learn-the-kuiper/202610050144/audio-unlock.js lines 1–71
- Fx Common render · kuiper-belt / learn-the-kuiper/202610050354/fx-common.js lines 1–161
- Fx Raw render · kuiper-belt / learn-the-kuiper/202610050354/fx-raw.js lines 1–236
- Menu render · kuiper-belt / learn-the-kuiper/202610050354/menu.html lines 1–18
- Kuiper Belt — Learn the Kuiper Page render · kuiper-belt / learn-the-kuiper/202610050501/index.html lines 1–138
- Lesson render · kuiper-belt / learn-the-kuiper/202610050609/lesson.html lines 1–5
Realgame Test
A web page in the learn the kuiper folder of Kuiper Belt. Published at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050010/modules/realgame-test.html.
testkuiper-belt / learn-the-kuiper/202610050010/modules/realgame-test.html · lines 1–17 of 17 · version 2026-10-05 00:10 · Entry point
- What it does
- It tests its inputs. Uses libraries realgame-data.js. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- Out: web page.
- Downstream impact
- It is itself an entry point, published at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050010/modules/realgame-test.html.
- What it achieves
- Real Kuiper Game test. It responds to kg events.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- kuiper-belt · learn-the-kuiper/202610050010/modules · page
- Uses
- Kuiper Law (script src), Scale Logic (script src), Realgame (script src), realgame-data.js
- Used by
- none found
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 learn-the-kuiper/202610050010/modules/realgame-test.html:1-17 · blob 952f6e144ae5ddb5528f3e85e0ce3a72235b5aac · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unknown
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Real Kuiper Game test</title>
<style>html,body{margin:0;height:100%;background:#000;color:#fff;font:bold 24px "Segoe UI",Arial,sans-serif;overflow:hidden}
#host{position:fixed;inset:0}#closed{display:none;padding:40px}</style></head><body>
<div id="host"></div><div id="closed">CLOSED. <a href="" style="color:#00ffff">OPEN AGAIN</a></div>
<script src="../kuiper-law.js"></script>
<script src="../scale-logic.js"></script>
<script src="realgame-data.js"></script>
<script src="realgame.js"></script>
<script>
var mod = (window.KGModules || []).filter(function (m) { return m.id === 'realgame'; })[0];
var host = document.getElementById('host');
host.addEventListener('kg-close', function () { host.remove(); document.getElementById('closed').style.display = 'block'; });
mod.open(host);
</script>
</body></html>Audio Unlock
A JavaScript file in the learn the kuiper folder of Kuiper Belt that works with silent wav (`silentWav`) and silent start (`silentStart`).
interactionkuiper-belt / learn-the-kuiper/202610050144/audio-unlock.js · lines 1–71 of 71 · version 2026-10-05 01:44 · Entry point · pattern session (shared by 2 files)
- What it does
- It draws its content. Defines 13 functions or classes, including live, track, wrap, silentWav, s. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Downstream impact
- Used directly by 4 files: Lesson (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/lesson.html); Modes (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/modes.html); Play (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/play.html); Solid (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/solid.html). Reached from 1 other entry point, including Menu (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050354/menu.html).
- What it achieves
- It is built from the live step (`live`), the track step (`track`) and the wrap step (`wrap`). LEARN THE KUIPER: `audio-unlock.js` (loaded before `start-here.js` and every module). It responds to visibilitychange events.
- Why it matters
- Loaded by the Lesson page at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/lesson.html and 3 other pages.
- Application
- kuiper-belt · learn-the-kuiper/202610050144 · script
- Uses
- none found
- Used by
- loaded by Lesson (script src), loaded by Modes (script src), loaded by Play (script src), loaded by Solid (script src)
- Produces
- live, track, wrap, silentWav, s, u32, u16, silentStart, silentStop, session, resumeAll, gesture
- Defines here
- live, track, wrap, silentWav, s, u32, u16, silentStart, silentStop, session, resumeAll, gesture, suspendAll
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 learn-the-kuiper/202610050144/audio-unlock.js:1-71 · blob 77c4f4a07aa266f02e78d2d8ec9f64a13ce88788 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unknown
// LEARN THE KUIPER: audio-unlock.js (loaded before start-here.js and every module). One job: make sound work on phones.
// - Every AudioContext any script creates (window.AudioContext or window.webkitAudioContext) is tracked in one list.
// - On every user gesture (touchend, pointerup, click, keydown on document; bubble phase, passive, never stopping
// propagation; no capture-phase window listener) every tracked context that is not running is resumed, inside the gesture.
// - iOS 17 and later: navigator.audioSession.type = 'playback', so Web Audio plays with the silent switch on.
// Older iOS: one looping silent HTML audio element (a tiny WAV built here, no network) is started in the same gesture,
// which moves the page to the playback category. It stops when the page is hidden and when the player mutes.
// - The page hidden: every context is suspended; the next gesture resumes them.
// - window.KGAudio = { state(), contexts(), muted, setMuted(bool) }. setMuted(true) suspends every tracked context.
// What cannot be proven off a real iPhone: the silent-switch behaviour. Chrome can only prove tracking, resume and mute.
(function (root) {
'use strict';
if (root.KGAudio) return;
var list = [], muted = false, silentEl = null, hidden = false;
var IOS = /iPhone|iPad|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
function live() { list = list.filter(function (c) { return c.state !== 'closed'; }); return list; }
function track(c) { list.push(c); if (muted || hidden) { try { c.suspend(); } catch (e) {} } return c; }
function wrap(name) {
var Orig = root[name]; if (typeof Orig !== 'function' || Orig.__kgWrapped) return;
var W = class extends Orig { constructor(o) { if (o === undefined) super(); else super(o); track(this); } };
W.__kgWrapped = true;
try { root[name] = W; } catch (e) {}
}
wrap('AudioContext'); wrap('webkitAudioContext');
// a tiny silent WAV: 8 kHz, 8-bit mono, 0.1 s of the mid value (128); built here so nothing is fetched
function silentWav() {
var n = 800, b = [], i;
function s(t) { for (var j = 0; j < t.length; j++) b.push(t.charCodeAt(j)); }
function u32(v) { b.push(v & 255, (v >>> 8) & 255, (v >>> 16) & 255, (v >>> 24) & 255); }
function u16(v) { b.push(v & 255, (v >>> 8) & 255); }
s('RIFF'); u32(36 + n); s('WAVE'); s('fmt '); u32(16); u16(1); u16(1); u32(8000); u32(8000); u16(1); u16(8); s('data'); u32(n);
for (i = 0; i < n; i++) b.push(128);
var str = ''; for (i = 0; i < b.length; i++) str += String.fromCharCode(b[i]);
return 'data:audio/wav;base64,' + btoa(str);
}
function silentStart() {
if (!IOS || muted || hidden) return;
try {
if (!silentEl) { silentEl = document.createElement('audio'); silentEl.src = silentWav(); silentEl.loop = true; silentEl.setAttribute('playsinline', ''); silentEl.setAttribute('x-webkit-airplay', 'deny'); silentEl.preload = 'auto'; silentEl.volume = 0.01; }
if (silentEl.paused) { var p = silentEl.play(); if (p && p.catch) p.catch(function () {}); }
} catch (e) {}
}
function silentStop() { try { if (silentEl && !silentEl.paused) silentEl.pause(); } catch (e) {} }
function session() { try { if (navigator.audioSession && navigator.audioSession.type !== 'playback') navigator.audioSession.type = 'playback'; } catch (e) {} }
function resumeAll() {
live().forEach(function (c) {
if (c.state !== 'running') { try { var p = c.resume(); if (p && p.catch) p.catch(function () {}); } catch (e) {} }
// iOS: a one-sample silent buffer started inside the gesture finishes the unlock
try { var src = c.createBufferSource(); src.buffer = c.createBuffer(1, 1, c.sampleRate || 44100); src.connect(c.destination); src.start(0); } catch (e) {}
});
}
function gesture() {
if (hidden || document.hidden) return;
if (muted) return;
session();
if (!navigator.audioSession) silentStart();
resumeAll();
}
function suspendAll() { live().forEach(function (c) { if (c.state === 'running') { try { var p = c.suspend(); if (p && p.catch) p.catch(function () {}); } catch (e) {} } }); }
['touchend', 'pointerup', 'click', 'keydown'].forEach(function (t) { document.addEventListener(t, gesture, { passive: true }); });
document.addEventListener('visibilitychange', function () {
if (document.hidden) { hidden = true; suspendAll(); silentStop(); }
else hidden = false; // resumed by the next gesture
});
root.KGAudio = {
state: function () { var l = live(), s = 'none'; for (var i = 0; i < l.length; i++) { if (l[i].state === 'running') return 'running'; s = l[i].state; } return s; },
contexts: function () { return live().slice(); },
get muted() { return muted; },
setMuted: function (b) { muted = !!b; if (muted) { suspendAll(); silentStop(); } else gesture(); return muted; }
};
})(window);Fx Common
A JavaScript file in the learn the kuiper folder of Kuiper Belt that works with heat RGB (`heatRGB`) and nova RGB (`novaRGB`) and draws on a canvas.
renderkuiper-belt / learn-the-kuiper/202610050354/fx-common.js · lines 1–161 of 161 · version 2026-10-05 03:54 · Not reached from any entry point (candidate for review) · pattern smooth (shared by 4 files)
- What it does
- It draws its content. Defines 11 functions or classes, including rng, clamp, mix, smooth, heatRGB. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- Out: canvas drawing.
- What it achieves
- It is built from the rng step (`rng`), the clamp step (`clamp`) and the mix step (`mix`). `fx-common.js` Shared, engine-free pieces of the light layer: seeded random, the colour ramps, the star sizing rule, the supernova timeline and its spark simulation.
- Why it matters
- No other file in the estate was found to import it.
- Application
- kuiper-belt · learn-the-kuiper/202610050354 · script
- Uses
- none found
- Used by
- none found
- Produces
- rng, clamp, mix, smooth, heatRGB, novaRGB, starStyle, Nova, reducedMotion, skyStars, glowCanvas
- Defines here
- rng, clamp, mix, smooth, heatRGB, novaRGB, starStyle, Nova, reducedMotion, skyStars, glowCanvas
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 learn-the-kuiper/202610050354/fx-common.js:1-161 · blob 9e89b32511fba6a11dd54de8a352ea01d60b7db4 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, network · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
// fx-common.js Shared, engine-free pieces of the light layer: seeded random, the colour ramps, the star sizing rule,
// the supernova timeline and its spark simulation. Every engine draws from the same numbers so the scene is identical.
// Classic script. Sets window.KGFXCommon and creates window.KGFXEngines.
(function (root) {
'use strict';
root.KGFXEngines = root.KGFXEngines || {};
function rng(seed) { // mulberry32
var a = (seed >>> 0) || 1;
return function () {
a = (a + 0x6D2B79F5) >>> 0; var t = a;
t = Math.imul(t ^ (t >>> 15), t | 1);
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
function clamp(v, a, b) { return v < a ? a : v > b ? b : v; }
function mix(a, b, t) { return a + (b - a) * t; }
function smooth(e0, e1, x) { var t = clamp((x - e0) / (e1 - e0), 0, 1); return t * t * (3 - 2 * t); }
// Halo colour of a dot by heat: cold cyan, through pale gold, to hot amber-white.
var COLD = [0.30, 0.82, 1.00], WARM = [1.00, 0.78, 0.38], HOT = [1.00, 0.93, 0.78];
function heatRGB(h, out) {
out = out || [0, 0, 0]; h = clamp(h, 0, 1);
var a, b, t;
if (h < 0.7) { a = COLD; b = WARM; t = smooth(0, 0.7, h); } else { a = WARM; b = HOT; t = smooth(0.7, 1, h); }
out[0] = mix(a[0], b[0], t); out[1] = mix(a[1], b[1], t); out[2] = mix(a[2], b[2], t);
return out;
}
// Supernova colour by age 0..1: white, amber, deep red.
function novaRGB(t, out) {
out = out || [0, 0, 0]; t = clamp(t, 0, 1);
if (t < 0.35) { var u = t / 0.35; out[0] = 1; out[1] = mix(0.97, 0.72, u); out[2] = mix(0.90, 0.30, u); }
else { var v = (t - 0.35) / 0.65; out[0] = mix(1, 0.62, v); out[1] = mix(0.72, 0.10, v); out[2] = mix(0.30, 0.05, v); }
return out;
}
var AMBER = [1.0, 0.70, 0.25];
// Star sizing: a dot keeps a readable core when the spiral is sparse and dims as dots pack closer than a pixel
// or two, so 200,000 stars become a glowing disc instead of a white blob. ppu = CSS pixels per circle unit.
// Keys are about sqrt(pi) = 1.77 units apart on the Kuiper spiral.
function starStyle(ppu, dpr) {
var gap = 1.77 * ppu; // CSS px between neighbours
var core = clamp(gap * 0.16, 0.55, 2.4); // core radius, CSS px
var halo = clamp(gap * 0.55, 1.6, 9.0); // halo radius, CSS px
var gain = clamp(gap / 6.0, 0.12, 1.0); // brightness so dense fields do not saturate
return { core: core, halo: halo, gain: gain, sizePx: Math.max(2, Math.ceil(2 * halo * dpr + 2)) };
}
// The supernova. Sizes are in CSS pixels, scaled by the shorter side of the view so it reads the same on any screen.
// Time constants: flash peaks at 0.06 s, ring reaches 90 percent by 0.55 s, sparks gone by 1.2 s.
function Nova(seed) { this.rand = rng(seed || 7); this.active = false; this.t = 0; this.sparks = null; this.n = 0; }
Nova.prototype.start = function (xUnits, yUnits, strength, minDim, reduced) {
this.x = xUnits; this.y = yUnits; this.s = clamp(strength == null ? 1 : strength, 0, 1);
this.minDim = minDim; this.reduced = !!reduced; this.t = 0; this.active = this.s > 0;
var R = minDim; var n = this.reduced ? 0 : Math.round(90 + 290 * this.s);
var sp = this.sparks = new Float32Array(n * 10); // ox, oy, vx, vy, life, heatBias, width, curl, birth, brightness
for (var i = 0; i < n; i++) {
var a = this.rand() * Math.PI * 2;
var r = this.rand();
var speed = R * (0.20 + 1.05 * Math.pow(r, 2.2)) * (0.55 + 0.45 * this.s); // CSS px / s
var o = i * 10, r0 = 3 + 9 * this.rand();
sp[o] = Math.cos(a) * r0; sp[o + 1] = Math.sin(a) * r0;
sp[o + 2] = Math.cos(a) * speed; sp[o + 3] = Math.sin(a) * speed;
sp[o + 4] = 0.65 + 0.60 * this.rand(); // life in s
sp[o + 5] = this.rand() * 0.20; // colour bias
sp[o + 6] = 0.6 + 0.7 * this.rand(); // width
sp[o + 7] = (this.rand() - 0.5) * 0.9; // slight curl
sp[o + 8] = Math.pow(this.rand(), 2) * 0.07; // birth delay, s
var br = this.rand(); sp[o + 9] = 0.45 + 0.55 * br * br; // a few bright sparks, many faint
if (br > 0.9) { sp[o + 6] *= 1.6; sp[o + 4] += 0.25; }
}
this.n = n;
};
var DRAG = 2.0;
Nova.prototype.step = function (dt) {
if (!this.active) return;
this.t += dt;
var sp = this.sparks, n = this.n, k = Math.exp(-DRAG * dt);
for (var i = 0; i < n; i++) {
var o = i * 10; if (this.t < sp[o + 8]) continue;
var vx = sp[o + 2], vy = sp[o + 3], c = sp[o + 7] * dt;
sp[o] += vx * dt; sp[o + 1] += vy * dt;
var nvx = (vx - vy * c) * k, nvy = (vy + vx * c) * k;
sp[o + 2] = nvx; sp[o + 3] = nvy;
}
if (this.t > 1.6) this.active = false;
};
// Envelope values at the current time. All smooth: no frame jumps from dark to white.
Nova.prototype.look = function () {
var t = this.t, s = this.s, R = this.minDim;
if (this.reduced) { // gentle swell: rise 0.45 s, fall to 1.4 s
var sw = t < 0.45 ? smooth(0, 0.45, t) : 1 - smooth(0.45, 1.4, t);
return { flash: 0.55 * sw * s, coreR: R * (0.05 + 0.03 * sw), haloR: R * 0.30, lens: 0.15 * sw * s,
ringR: R * 0.18, ringW: R * 0.05, ringA: 0.25 * sw * s, ringAge: 0.3, streak: 0 };
}
var rise = smooth(0, 0.06, t), fall = Math.exp(-Math.max(0, t - 0.06) / 0.20);
var flash = s * rise * fall; // core brightness 0..1
var ringP = 1 - Math.exp(-t / 0.30);
var ringA = s * smooth(0, 0.04, t) * Math.pow(Math.max(0, 1 - t / 1.1), 1.8);
return {
flash: 0.75 * flash,
coreR: R * (0.020 + 0.030 * flash),
haloR: R * (0.20 + 0.20 * smooth(0, 0.5, t)),
lens: s * 0.55 * rise * Math.exp(-Math.max(0, t - 0.06) / 0.33),
ringR: R * (0.03 + 0.42 * ringP),
ringW: R * (0.008 + 0.030 * ringP),
ringA: 0.85 * ringA,
ringAge: clamp(t / 1.0, 0, 1),
streak: s * 0.7 * rise * Math.exp(-Math.max(0, t - 0.06) / 0.16)
};
};
// Calls fn(x, y, tx, ty, r, g, b, a, widthCss) for every live spark: head at (x,y) CSS px offset from the nova,
// tail at (tx,ty). Shared so every engine draws the same sparks.
var tmp = [0, 0, 0];
Nova.prototype.eachSpark = function (fn) {
var sp = this.sparks, n = this.n, t = this.t;
for (var i = 0; i < n; i++) {
var o = i * 10, life = sp[o + 4], tb = t - sp[o + 8], age = tb / life;
if (tb <= 0 || age >= 1) continue;
var vx = sp[o + 2], vy = sp[o + 3], trail = 0.06 + 0.08 * age;
novaRGB(clamp(age * 1.25 + sp[o + 5], 0, 1), tmp);
var a = smooth(0, 0.05, tb) * Math.pow(1 - age, 0.8) * (0.6 + 0.4 * this.s) * sp[o + 9];
fn(sp[o], sp[o + 1], sp[o] - vx * trail, sp[o + 1] - vy * trail, tmp[0], tmp[1], tmp[2], a, sp[o + 6] * (1.3 - 0.6 * age));
}
};
function reducedMotion() {
try { return !!(root.matchMedia && root.matchMedia('(prefers-reduced-motion: reduce)').matches); } catch (e) { return false; }
}
// Sky: n faint stars in normalised screen space 0..1 with brightness and size.
function skyStars(seed, n) {
var r = rng(seed || 1), out = new Float32Array(n * 4);
for (var i = 0; i < n; i++) {
out[i * 4] = r(); out[i * 4 + 1] = r();
var b = Math.pow(r(), 3.0);
out[i * 4 + 2] = 0.10 + 0.55 * b; // brightness
out[i * 4 + 3] = 0.5 + 1.1 * b; // radius CSS px
}
return out;
}
// Soft-disc textures for engines that draw with sprites. Dithered so 8-bit gradients do not band.
function glowCanvas(size, fn) {
var c = document.createElement('canvas'); c.width = c.height = size;
var g = c.getContext('2d'), img = g.createImageData(size, size), d = img.data, r = rng(size * 31 + 7);
for (var y = 0; y < size; y++) for (var x = 0; x < size; x++) {
var u = (x + 0.5) / size * 2 - 1, v = (y + 0.5) / size * 2 - 1;
var a = fn(u, v); // returns 0..1 (intensity, premultiplied white)
var q = clamp(a * 255 + (r() - 0.5), 0, 255);
var o = (y * size + x) * 4; d[o] = d[o + 1] = d[o + 2] = 255; d[o + 3] = q;
}
g.putImageData(img, 0, 0); return c;
}
root.KGFXCommon = {
rng: rng, clamp: clamp, mix: mix, smooth: smooth, heatRGB: heatRGB, novaRGB: novaRGB, AMBER: AMBER,
starStyle: starStyle, Nova: Nova, reducedMotion: reducedMotion, skyStars: skyStars, glowCanvas: glowCanvas
};
})(typeof window !== 'undefined' ? window : globalThis);Fx Raw
A JavaScript file in the learn the kuiper folder of Kuiper Belt that converts to dev (`toDev`), calculates planar distances and renders with WebGL.
renderkuiper-belt / learn-the-kuiper/202610050354/fx-raw.js · lines 1–236 of 236 · version 2026-10-05 03:54 · Not reached from any entry point (candidate for review) · pattern shape (shared by 4 files)
- What it does
- It draws its content. Defines 9 functions or classes, including compile, sh, create, U, toDev. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- Out: WebGL/WebGPU drawing.
- What it achieves
- It is built from the compile step (`compile`), the create step (`create`) and the to dev helper (`toDev`). `fx-raw.js` The dependency-free light layer: plain WebGL1, three small shader programs, no library.
- Why it matters
- No other file in the estate was found to import it.
- Application
- kuiper-belt · learn-the-kuiper/202610050354 · script
- Uses
- none found
- Used by
- none found
- Produces
- compile, sh, create, U, toDev, points, shape, sparks, draw
- Defines here
- compile, sh, create, U, toDev, points, shape, sparks, draw
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 learn-the-kuiper/202610050354/fx-raw.js:1-236 · blob 70a37901d884dae11ec676821a56bded7777774f · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
// fx-raw.js The dependency-free light layer: plain WebGL1, three small shader programs, no library.
// Classic script. Needs fx-common.js first. Registers window.KGFXEngines.raw = { create(host) -> fx }.
(function (root) {
'use strict';
var C = root.KGFXCommon;
var DITHER = 'float dn(){return fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453)-0.5;}';
// Points: stars, ghosts, sky. Position goes through px = a + v*b on each axis (device pixels, y down).
var PT_VS =
'attribute vec2 a_xy;attribute float a_h;attribute float a_k;' +
'uniform vec4 u_xf;uniform vec2 u_res;uniform float u_size;uniform float u_maxp;uniform float u_mode;uniform float u_gain;uniform float u_time;' +
'uniform vec3 u_c0;uniform vec3 u_c1;uniform vec3 u_c2;' +
'varying vec3 v_col;varying float v_a;varying float v_core;' +
'vec3 heat(float h){vec3 a=mix(u_c0,u_c1,smoothstep(0.0,0.7,h));return mix(a,u_c2,smoothstep(0.7,1.0,h));}' +
'void main(){vec2 p=vec2(u_xf.x+a_xy.x*u_xf.y,u_xf.z+a_xy.y*u_xf.w);' +
'gl_Position=vec4(p/u_res*2.0-1.0,0.0,1.0);gl_Position.y=-gl_Position.y;' +
'float s=u_size;' +
'if(u_mode<0.5){float h=clamp(a_h,0.0,1.0);s*=1.0+0.7*h*h;v_col=heat(h);v_a=u_gain*(0.85+0.9*h*h);v_core=0.30/(1.0+0.5*h);}' +
'else if(u_mode<1.5){v_col=vec3(0.55,0.75,0.95);v_a=u_gain;v_core=0.35;}' +
'else{float tw=0.8+0.2*sin(u_time*(0.7+a_h*2.0)+a_xy.x*91.0+a_xy.y*57.0);s=max(2.0,u_size*a_k);v_col=vec3(0.75,0.85,1.0);v_a=a_h*tw*u_gain;v_core=0.55;}' +
'gl_PointSize=min(s,u_maxp);' +
'v_a*=min(1.0,s/2.5);}';
var PT_FS =
'precision mediump float;varying vec3 v_col;varying float v_a;varying float v_core;' + DITHER +
'void main(){vec2 q=gl_PointCoord*2.0-1.0;float d=length(q);if(d>1.0)discard;' +
'float core=exp(-d*d/(v_core*v_core)*2.2);' +
'float halo=(1.0-d)*(1.0-d)*exp(-d*2.2);' +
'vec3 c=(v_col*halo*0.85+mix(v_col,vec3(1.0),0.85)*core)*v_a;' +
'gl_FragColor=vec4(c+dn()/255.0,1.0);}';
// Shapes: one quad per shape, the fragment shader draws glow discs, rings with a filling arc, wedges,
// the target cell and the lens streak, all analytic, so edges are soft at any size.
var SH_VS =
'attribute vec2 a_q;uniform vec2 u_c;uniform vec2 u_hs;uniform vec2 u_res;varying vec2 v_p;' +
'void main(){vec2 p=u_c+a_q*u_hs;v_p=vec2(a_q.x*u_hs.x,-a_q.y*u_hs.y);' + // v_p: local px, y up
'gl_Position=vec4(p/u_res*2.0-1.0,0.0,1.0);gl_Position.y=-gl_Position.y;}';
var SH_FS =
'precision highp float;varying vec2 v_p;uniform float u_mode;uniform vec4 u_p0;uniform vec4 u_p1;uniform vec4 u_c0;uniform vec4 u_c1;uniform vec2 u_hs;' + DITHER +
'const float TAU=6.28318530718;' +
'float arcIn(vec2 p,float s,float w,float soft){if(w>=TAU-0.0001)return 1.0;if(w<=0.0)return 0.0;' +
' float a=atan(p.y,p.x);float rc=mod(a-s-0.5*w+3.14159265,TAU)-3.14159265;' +
' float L=length(p);float e=soft/max(L,1.0);return smoothstep(-e,e,0.5*w-abs(rc));}' +
'float segD(vec2 p,vec2 b){float t=clamp(dot(p,b)/dot(b,b),0.0,1.0);return length(p-b*t);}' +
'void main(){vec3 col=vec3(0.0);float L=length(v_p);' +
'if(u_mode<0.5){' + // glow: core radius p0.x, halo radius p0.y
' float edge=1.0-smoothstep(0.6,1.0,L/min(u_hs.x,u_hs.y));' +
' float core=exp(-L*L/(u_p0.x*u_p0.x));float halo=1.0/(1.0+L*L/(u_p0.y*u_p0.y)*6.0)*edge;' +
' col=u_c0.rgb*u_c0.a*core+u_c1.rgb*u_c1.a*halo;' +
'}else if(u_mode<1.5){' + // ring: radius p0.x, width p0.y, glow p0.z, lit p0.w; arc start p1.x, sweep p1.y, base alpha p1.z
' float d=L-u_p0.x;float line=exp(-d*d/(u_p0.y*u_p0.y));float glow=exp(-d*d/(u_p0.z*u_p0.z));' +
' float edge=1.0-smoothstep(0.85,1.0,L/u_hs.x);' +
' float fill=arcIn(v_p,u_p1.x,u_p1.y,1.5);float fillG=arcIn(v_p,u_p1.x,u_p1.y,u_p0.z*1.5);' +
' col=(u_c0.rgb*u_p1.z*line+u_c1.rgb*u_c1.a*(line*fill+glow*fillG*0.35)+u_c1.rgb*u_p0.w*(glow*0.6+line*0.8))*edge;' +
'}else if(u_mode<2.5){' + // wedge: radius p0.x, edge width p0.y; start p1.x, sweep p1.y; alpha c0.a
' float inA=arcIn(v_p,u_p1.x,u_p1.y,1.2);float inR=1.0-smoothstep(u_p0.x-1.0,u_p0.x+1.0,L);' +
' vec2 b0=vec2(cos(u_p1.x),sin(u_p1.x))*u_p0.x;vec2 b1=vec2(cos(u_p1.x+u_p1.y),sin(u_p1.x+u_p1.y))*u_p0.x;' +
' float de=min(segD(v_p,b0),segD(v_p,b1));float da=abs(L-u_p0.x)+(1.0-inA)*1e4;de=min(de,da);' +
' float line=exp(-de*de/(u_p0.y*u_p0.y))+0.35*exp(-de*de/(16.0*u_p0.y*u_p0.y));' +
' float fill=inA*inR*(0.10+0.30*pow(L/u_p0.x,2.0));' +
' col=u_c0.rgb*u_c0.a*(fill+line*0.9);' +
'}else if(u_mode<3.5){' + // target cell: half side p0.x, line p0.y, glow p0.z, pulse p0.w
' vec2 q=abs(v_p)-vec2(u_p0.x);float sd=length(max(q,0.0))+min(max(q.x,q.y),0.0);' +
' float line=exp(-sd*sd/(u_p0.y*u_p0.y));float glow=exp(-max(sd,0.0)/u_p0.z)*(1.0-smoothstep(0.7,1.0,L/u_hs.x));' +
' float inside=1.0-smoothstep(-1.0,1.0,sd);' +
' col=u_c0.rgb*u_c0.a*(line*(0.7+0.3*u_p0.w)+glow*(0.25+0.35*u_p0.w)+inside*(0.06+0.08*u_p0.w));' +
'}else{' + // lens streak: half length hs.x, half height p0.x
' float x=abs(v_p.x)/u_hs.x;float y=v_p.y/u_p0.x;float k=pow(max(0.0,1.0-x),2.5)*exp(-y*y);' +
' col=u_c0.rgb*u_c0.a*k;' +
'}' +
'gl_FragColor=vec4(col+dn()/255.0,1.0);}';
// Sparks: streak quads built on the CPU; u runs tail 0 to head 1, v across -1..1.
var SP_VS =
'attribute vec2 a_p;attribute vec2 a_uv;attribute vec4 a_c;uniform vec2 u_res;varying vec2 v_uv;varying vec4 v_c;' +
'void main(){v_uv=a_uv;v_c=a_c;gl_Position=vec4(a_p/u_res*2.0-1.0,0.0,1.0);gl_Position.y=-gl_Position.y;}';
var SP_FS =
'precision mediump float;varying vec2 v_uv;varying vec4 v_c;' + DITHER +
'void main(){float u=v_uv.x;float w=0.30+0.70*u;float a=exp(-v_uv.y*v_uv.y/(w*w)*3.5)*pow(u,2.2);' +
'float g=exp(-(1.0-u)*(1.0-u)*30.0)*exp(-v_uv.y*v_uv.y*2.2);' +
'vec3 c=(v_c.rgb*a*0.95+mix(v_c.rgb,vec3(1.0),0.3)*g*1.2)*v_c.a;gl_FragColor=vec4(c+dn()/255.0,1.0);}';
function compile(gl, vs, fs) {
function sh(t, s) { var o = gl.createShader(t); gl.shaderSource(o, s); gl.compileShader(o);
if (!gl.getShaderParameter(o, gl.COMPILE_STATUS)) throw new Error(gl.getShaderInfoLog(o)); return o; }
var p = gl.createProgram(); gl.attachShader(p, sh(gl.VERTEX_SHADER, vs)); gl.attachShader(p, sh(gl.FRAGMENT_SHADER, fs));
gl.linkProgram(p); if (!gl.getProgramParameter(p, gl.LINK_STATUS)) throw new Error(gl.getProgramInfoLog(p));
var u = {}, n = gl.getProgramParameter(p, gl.ACTIVE_UNIFORMS), i;
for (i = 0; i < n; i++) { var nm = gl.getActiveUniform(p, i).name; u[nm] = gl.getUniformLocation(p, nm); }
var a = {}; n = gl.getProgramParameter(p, gl.ACTIVE_ATTRIBUTES);
for (i = 0; i < n; i++) { var an = gl.getActiveAttrib(p, i).name; a[an] = gl.getAttribLocation(p, an); }
return { p: p, u: u, a: a };
}
function create(host) {
var canvas = document.createElement('canvas');
canvas.style.cssText = 'position:absolute;left:0;top:0;width:100%;height:100%;display:block';
host.appendChild(canvas);
var attrs = { alpha: false, antialias: false, depth: false, stencil: false, premultipliedAlpha: true, preserveDrawingBuffer: false, powerPreference: 'high-performance' };
var gl = canvas.getContext('webgl', attrs) || canvas.getContext('experimental-webgl', attrs);
if (!gl) { host.removeChild(canvas); return null; }
var PT = compile(gl, PT_VS, PT_FS), SH = compile(gl, SH_VS, SH_FS), SP = compile(gl, SP_VS, SP_FS);
var maxPoint = gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE)[1] || 64;
var quad = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, quad);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);
var starXY = gl.createBuffer(), starH = gl.createBuffer(), ghostXY = gl.createBuffer(), skyXY = gl.createBuffer(), skyHK = gl.createBuffer();
var sparkBuf = gl.createBuffer(), sparkData = new Float32Array(0);
var starCap = 0, nStars = 0, nGhosts = 0, nSky = 0, ghostCap = 0;
var W = 1, H = 1, dpr = 1, cssW = 1, cssH = 1, cx = 0, cy = 0, ppu = 10, time = 0;
var sel = null, tgt = null, rings = [], wedgeS = null, novas = [], reduced = C.reducedMotion();
var nova = new C.Nova(11);
var fx = {
engine: 'raw', canvas: canvas, gl: gl,
resize: function (w, h, r) { cssW = w; cssH = h; dpr = r || 1; W = canvas.width = Math.max(1, Math.round(w * dpr)); H = canvas.height = Math.max(1, Math.round(h * dpr)); },
setView: function (x, y, s) { cx = x; cy = y; ppu = s; },
stars: function (xy, count, heat) {
nStars = count;
gl.bindBuffer(gl.ARRAY_BUFFER, starXY);
if (count > starCap) { starCap = count; gl.bufferData(gl.ARRAY_BUFFER, xy.subarray(0, count * 2), gl.DYNAMIC_DRAW);
gl.bindBuffer(gl.ARRAY_BUFFER, starH); gl.bufferData(gl.ARRAY_BUFFER, heat.subarray(0, count), gl.DYNAMIC_DRAW); }
else { gl.bufferSubData(gl.ARRAY_BUFFER, 0, xy.subarray(0, count * 2));
gl.bindBuffer(gl.ARRAY_BUFFER, starH); gl.bufferSubData(gl.ARRAY_BUFFER, 0, heat.subarray(0, count)); }
},
select: function (x, y) { sel = (x == null) ? null : [x, y]; },
ghosts: function (xy, count) {
nGhosts = count; if (!count) return;
gl.bindBuffer(gl.ARRAY_BUFFER, ghostXY);
if (count > ghostCap) { ghostCap = count; gl.bufferData(gl.ARRAY_BUFFER, xy.subarray(0, count * 2), gl.DYNAMIC_DRAW); }
else gl.bufferSubData(gl.ARRAY_BUFFER, 0, xy.subarray(0, count * 2));
},
target: function (x, y, hw, pulse) { tgt = (x == null) ? null : [x, y, hw, pulse || 0]; },
ring: function (r, fill, lit) { rings.push([r, fill, lit]); },
wedge: function (s, w, r, a) { wedgeS = (s == null) ? null : [s, w, r, a == null ? 1 : a]; },
supernova: function (x, y, s) { nova.start(x, y, s, Math.min(cssW, cssH), reduced); },
sky: function (seed) {
var n = Math.round(Math.min(900, cssW * cssH / 900)), st = C.skyStars(seed, n), xy = new Float32Array(n * 2), hk = new Float32Array(n * 2);
for (var i = 0; i < n; i++) { xy[i * 2] = st[i * 4]; xy[i * 2 + 1] = st[i * 4 + 1]; hk[i * 2] = st[i * 4 + 2]; hk[i * 2 + 1] = st[i * 4 + 3]; }
nSky = n; gl.bindBuffer(gl.ARRAY_BUFFER, skyXY); gl.bufferData(gl.ARRAY_BUFFER, xy, gl.STATIC_DRAW);
gl.bindBuffer(gl.ARRAY_BUFFER, skyHK); gl.bufferData(gl.ARRAY_BUFFER, hk, gl.STATIC_DRAW);
},
frame: function (dt) { time += reduced ? 0 : dt; nova.step(dt); draw(); rings.length = 0; },
destroy: function () { var e = gl.getExtension('WEBGL_lose_context'); if (e) e.loseContext(); if (canvas.parentNode) canvas.parentNode.removeChild(canvas); }
};
function U(prog, name) { return prog.u[name]; }
function toDev(x, y) { return [(cx + x * ppu) * dpr, (cy - y * ppu) * dpr]; }
function points(buf, hbuf, kbuf, n, mode, xf, size, gain) {
gl.useProgram(PT.p);
gl.uniform4fv(U(PT, 'u_xf'), xf); gl.uniform2f(U(PT, 'u_res'), W, H); gl.uniform1f(U(PT, 'u_size'), size);
gl.uniform1f(U(PT, 'u_maxp'), maxPoint); gl.uniform1f(U(PT, 'u_mode'), mode); gl.uniform1f(U(PT, 'u_gain'), gain);
gl.uniform1f(U(PT, 'u_time'), time);
gl.uniform3f(U(PT, 'u_c0'), 0.30, 0.82, 1.0); gl.uniform3f(U(PT, 'u_c1'), 1.0, 0.78, 0.38); gl.uniform3f(U(PT, 'u_c2'), 1.0, 0.93, 0.78);
gl.bindBuffer(gl.ARRAY_BUFFER, buf); gl.enableVertexAttribArray(PT.a.a_xy); gl.vertexAttribPointer(PT.a.a_xy, 2, gl.FLOAT, false, 0, 0);
if (hbuf && PT.a.a_h >= 0) { gl.bindBuffer(gl.ARRAY_BUFFER, hbuf); gl.enableVertexAttribArray(PT.a.a_h);
gl.vertexAttribPointer(PT.a.a_h, 1, gl.FLOAT, false, kbuf === hbuf ? 8 : 0, 0); }
else if (PT.a.a_h >= 0) { gl.disableVertexAttribArray(PT.a.a_h); gl.vertexAttrib1f(PT.a.a_h, 0); }
if (kbuf && PT.a.a_k >= 0) { gl.bindBuffer(gl.ARRAY_BUFFER, kbuf); gl.enableVertexAttribArray(PT.a.a_k); gl.vertexAttribPointer(PT.a.a_k, 1, gl.FLOAT, false, 8, 4); }
else if (PT.a.a_k >= 0) { gl.disableVertexAttribArray(PT.a.a_k); gl.vertexAttrib1f(PT.a.a_k, 1); }
gl.drawArrays(gl.POINTS, 0, n);
if (PT.a.a_h >= 0) gl.disableVertexAttribArray(PT.a.a_h); if (PT.a.a_k >= 0) gl.disableVertexAttribArray(PT.a.a_k);
}
function shape(mode, cxd, cyd, hx, hy, p0, p1, c0, c1) {
gl.useProgram(SH.p);
gl.bindBuffer(gl.ARRAY_BUFFER, quad); gl.enableVertexAttribArray(SH.a.a_q); gl.vertexAttribPointer(SH.a.a_q, 2, gl.FLOAT, false, 0, 0);
gl.uniform2f(U(SH, 'u_res'), W, H); gl.uniform2f(U(SH, 'u_c'), cxd, cyd); gl.uniform2f(U(SH, 'u_hs'), hx, hy);
gl.uniform1f(U(SH, 'u_mode'), mode); gl.uniform4fv(U(SH, 'u_p0'), p0); gl.uniform4fv(U(SH, 'u_p1'), p1 || Z4);
gl.uniform4fv(U(SH, 'u_c0'), c0); gl.uniform4fv(U(SH, 'u_c1'), c1 || Z4);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
}
var Z4 = [0, 0, 0, 0], D2R = Math.PI / 180;
function sparks(nx, ny) {
var n = nova.n; if (!n) return;
if (sparkData.length < n * 48) sparkData = new Float32Array(n * 48);
var d = sparkData, k = 0;
nova.eachSpark(function (hx, hy, tx, ty, r, g, b, a, w) {
var x1 = nx + hx * dpr, y1 = ny + hy * dpr, x0 = nx + tx * dpr, y0 = ny + ty * dpr;
var dx = x1 - x0, dy = y1 - y0, L = Math.sqrt(dx * dx + dy * dy) || 1, wd = Math.max(1.2, w * dpr * 0.75);
if (w * dpr < 1.4) a *= w * dpr / 1.4;
var px = -dy / L * wd, py = dx / L * wd;
x1 += dx / L * wd * 1.5; y1 += dy / L * wd * 1.5; wd *= 1.25; // round the head a little
var v = [x0 + px, y0 + py, 0, -1, x0 - px, y0 - py, 0, 1, x1 + px, y1 + py, 1, -1, x1 - px, y1 - py, 1, 1];
var order = [0, 1, 2, 2, 1, 3];
for (var j = 0; j < 6; j++) { var o = order[j] * 4; d[k++] = v[o]; d[k++] = v[o + 1]; d[k++] = v[o + 2]; d[k++] = v[o + 3]; d[k++] = r; d[k++] = g; d[k++] = b; d[k++] = a; }
});
if (!k) return;
gl.useProgram(SP.p); gl.uniform2f(U(SP, 'u_res'), W, H);
gl.bindBuffer(gl.ARRAY_BUFFER, sparkBuf); gl.bufferData(gl.ARRAY_BUFFER, d.subarray(0, k), gl.STREAM_DRAW);
gl.enableVertexAttribArray(SP.a.a_p); gl.vertexAttribPointer(SP.a.a_p, 2, gl.FLOAT, false, 32, 0);
gl.enableVertexAttribArray(SP.a.a_uv); gl.vertexAttribPointer(SP.a.a_uv, 2, gl.FLOAT, false, 32, 8);
gl.enableVertexAttribArray(SP.a.a_c); gl.vertexAttribPointer(SP.a.a_c, 4, gl.FLOAT, false, 32, 16);
gl.drawArrays(gl.TRIANGLES, 0, k / 8);
gl.disableVertexAttribArray(SP.a.a_uv); gl.disableVertexAttribArray(SP.a.a_c);
}
function draw() {
gl.viewport(0, 0, W, H); gl.clearColor(0, 0, 0, 1); gl.clear(gl.COLOR_BUFFER_BIT);
gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE);
var st = C.starStyle(ppu, dpr), m = Math.min(cssW, cssH) * dpr;
if (nSky) points(skyXY, skyHK, skyHK, nSky, 2, [0, W, 0, H], 2.2 * dpr, 1);
var c = toDev(0, 0);
if (wedgeS) { var R = wedgeS[2] * ppu * dpr;
shape(2, c[0], c[1], R + 12 * dpr, R + 12 * dpr, [R, 1.1 * dpr, 0, 0], [wedgeS[0] * D2R, Math.max(0, wedgeS[1]) * D2R, 0, 0], [1.0, 0.68, 0.22, 0.9 * wedgeS[3]]); }
for (var i = 0; i < rings.length; i++) { var rr = rings[i], Rr = rr[0] * ppu * dpr, lit = C.clamp(rr[2], 0, 1);
shape(1, c[0], c[1], Rr + 24 * dpr, Rr + 24 * dpr, [Rr, 0.9 * dpr, 7 * dpr, lit * 0.9],
[Math.PI / 2, C.clamp(rr[1], 0, 1) * Math.PI * 2, 0.22, 0],
[0.45, 0.70, 0.90, 1], [0.70 + 0.3 * lit, 0.90, 1.0 - 0.25 * lit, 0.9]); }
if (tgt) { var t = toDev(tgt[0], tgt[1]), hw = Math.max(4 * dpr, tgt[2] * ppu * dpr);
shape(3, t[0], t[1], hw + 22 * dpr, hw + 22 * dpr, [hw, 1.2 * dpr, 7 * dpr, tgt[3]], null, [1.0, 0.80, 0.42, 0.9]); }
if (nGhosts) points(ghostXY, null, null, nGhosts, 1, [cx * dpr, ppu * dpr, cy * dpr, -ppu * dpr], Math.max(10, st.halo * 2.6 * dpr), 0.45);
if (nStars) points(starXY, starH, null, nStars, 0, [cx * dpr, ppu * dpr, cy * dpr, -ppu * dpr], st.sizePx, st.gain);
if (sel) { var s = toDev(sel[0], sel[1]);
shape(0, s[0], s[1], 30 * dpr, 30 * dpr, [2.6 * dpr, 9 * dpr, 0, 0], null, [1, 0.97, 0.88, 1.0], [1.0, 0.66, 0.22, 0.75]);
shape(1, s[0], s[1], 16 * dpr, 16 * dpr, [9 * dpr, 0.8 * dpr, 2.5 * dpr, 0], [0, Math.PI * 2, 0, 0], [0, 0, 0, 0], [1.0, 0.72, 0.30, 0.8]); }
if (nova.active) {
var L = nova.look(), n = toDev(nova.x, nova.y), col = C.novaRGB(L.ringAge), dd = dpr;
// wide lens glow first, then the shock ring, sparks, the core and the streak on top
shape(0, n[0], n[1], L.haloR * 2.2 * dd, L.haloR * 2.2 * dd, [L.coreR * dd, L.haloR * dd, 0, 0], null, [0, 0, 0, 0], [1.0, 0.62, 0.30, 0.55 * L.lens]);
if (L.ringA > 0.002) shape(1, n[0], n[1], (L.ringR + L.ringW * 3) * dd, (L.ringR + L.ringW * 3) * dd,
[L.ringR * dd, L.ringW * 0.30 * dd, L.ringW * 0.8 * dd, 0], [0, Math.PI * 2, 0, 0], [0, 0, 0, 0], [col[0], col[1], col[2], L.ringA]);
sparks(n[0], n[1]);
var cr = L.coreR * dd;
shape(0, n[0], n[1], cr * 9, cr * 9, [cr * 0.5, cr * 1.5, 0, 0], null, [1, 0.97, 0.90, 0.85 * L.flash], [1.0, 0.70, 0.36, 0.8 * L.flash]);
if (L.streak > 0.003) shape(4, n[0], n[1], m * 0.45, 10 * dd, [3.5 * dd, 0, 0, 0], null, [1.0, 0.82, 0.62, 0.55 * L.streak]);
}
}
return fx;
}
root.KGFXEngines.raw = { create: create, files: ['fx-common.js', 'fx-raw.js'] };
})(window);Menu
A web page in the learn the kuiper folder of Kuiper Belt. Published at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050354/menu.html.
renderkuiper-belt / learn-the-kuiper/202610050354/menu.html · lines 1–18 of 18 · version 2026-10-05 03:54 · Entry point
- What it does
- It draws its content. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- Out: web page.
- Downstream impact
- Used directly by 3 files: Lesson (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/lesson.html); Play (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/play.html); Solid (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/solid.html). It is itself an entry point, published at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050354/menu.html.
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Loaded by the Lesson page at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/lesson.html and 2 other pages.
- Application
- kuiper-belt · learn-the-kuiper/202610050354 · page
- Uses
- Kuiper Belt — Learn the Kuiper Page (link), Play (link), Lesson (link), Solid (link), Modes (link)
- Used by
- linked from Lesson (link), linked from Play (link), linked from Solid (link)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 learn-the-kuiper/202610050354/menu.html:1-18 · blob 7f151a7eaaf2936e2723a046926e1700006b9e30 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unknown
<!doctype html>
<html lang="en"><head><meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<meta name="color-scheme" content="dark">
<title>Learn the Kuiper</title>
<style>
html,body{margin:0;min-height:100%;background:#000;color:#fff;font:400 28px/1.2 "Segoe UI",system-ui,-apple-system,Arial,sans-serif}
main{box-sizing:border-box;min-height:100vh;display:flex;flex-direction:column;justify-content:center;gap:14px;padding:24px;max-width:520px;margin:0 auto}
a{display:block;color:#fff;text-decoration:none;border:1px solid rgba(255,255,255,.55);padding:18px 20px;letter-spacing:.04em}
a:focus,a:hover{background:#fff;color:#000;outline:none}
</style></head>
<body><main>
<a href="index.html">ONE DOT</a>
<a href="play.html">ANGLE AND DISTANCE</a>
<a href="lesson.html">THE FOUR FORMULAS</a>
<a href="solid.html">SPHERE</a>
<a href="modes.html">MORE</a>
</main></body></html>Kuiper Belt — Learn the Kuiper Page
A web page. Published at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050501/.
renderkuiper-belt / learn-the-kuiper/202610050501/index.html · lines 1–138 of 138 · version 2026-10-05 05:01 · Entry point
- What it does
- It draws its content. Defines next. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- Out: web page.
- Downstream impact
- Used directly by 1 file: Menu (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050354/menu.html). Reached from 3 other entry points, including Lesson (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/lesson.html); Play (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/play.html); Solid (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/solid.html). It is itself an entry point, published at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050501/.
- What it achieves
- Defines `next`.
- Why it matters
- Loaded by the Menu page at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050354/menu.html.
- Application
- kuiper-belt · learn-the-kuiper/202610050501 · page
- Uses
- none found
- Used by
- linked from Menu (link)
- Produces
- next
- Defines here
- next
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 learn-the-kuiper/202610050501/index.html:1-138 · blob 9d6026d6ac4d982abd8dbb43bf0c48c7b9eb0b47 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unknown
<!doctype html>
<html lang="en"><head><meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover,user-scalable=no">
<meta name="color-scheme" content="dark">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="icon" href="data:,">
<title>Learn the Kuiper</title>
<style>
html,body{margin:0;height:100%;background:#000;overflow:hidden;overscroll-behavior:none}
body{position:fixed;left:0;top:0;right:0;bottom:0;touch-action:none}
/* all text: white on black, one typeface, regular weight, tabular digits. Colour is in the drawing only. */
.k1{position:fixed;left:0;top:0;right:0;bottom:0;box-sizing:border-box;background:#000;color:#fff;display:grid;
grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto auto;
grid-template-areas:"tl tr" "stage stage" "ra rb" "pad pad";
padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
font-family:-apple-system,system-ui,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:400;font-variant-numeric:tabular-nums lining-nums;
-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;touch-action:none;cursor:default}
.k1-tl{grid-area:tl;display:flex;align-items:center;padding:4px 0 0 8px;min-width:0}
.k1-tr{grid-area:tr;display:flex;align-items:center;justify-content:flex-end;padding:4px 14px 0 0;min-width:0}
.k1-pips{display:flex;align-items:center}
.k1-pip{width:27px;height:44px;display:flex;align-items:center;justify-content:center;cursor:pointer}
.k1-pip i{display:block;box-sizing:border-box;width:11px;height:11px;border-radius:50%;border:1.5px solid rgba(255,255,255,.85)}
.k1-pip.k1-on i{background:#fff}
.k1-tool{height:44px;display:flex;align-items:center;justify-content:center;color:rgba(255,255,255,.7);cursor:pointer}
.k1-mute{width:48px;margin-left:6px}
.k1-copy{display:none;position:absolute;left:4px;bottom:0;z-index:2;height:44px;padding:0 8px;align-items:center;font-size:24px;color:rgba(255,255,255,.7);cursor:pointer}
.k1-padopen .k1-copy{display:flex}
.k1-copy.k1-go{animation:k1copy .9s ease-out}
@keyframes k1copy{0%{color:#000;background:#fff}100%{color:rgba(255,255,255,.7);background:rgba(255,255,255,0)}}
.k1-score{font-size:24px;line-height:44px;color:#fff;white-space:nowrap;text-align:right;pointer-events:none}
.k1-add{color:rgba(255,255,255,.7);opacity:0;margin-right:12px}
.k1-add.k1-go{animation:k1add 1.8s ease-out}
@keyframes k1add{0%{opacity:0}12%{opacity:1}70%{opacity:1}100%{opacity:0}}
.k1-stage{grid-area:stage;position:relative;min-height:0;min-width:0;overflow:hidden}
.k1-fx{position:absolute;left:0;top:0;width:100%;height:100%;z-index:0;pointer-events:none}
.k1-cv{position:absolute;left:0;top:0;width:100%;height:100%;display:block;touch-action:none;z-index:1}
.k1-msg{display:none;position:absolute;left:10px;right:10px;top:6px;z-index:3;font-size:24px;line-height:30px;color:#fff;text-align:center;background:#000;padding:6px 8px 10px 8px;pointer-events:none}
/* a roller: the word, the number in a thin box with what it gives beside it, the working under it */
.k1-rl{grid-area:ra;min-width:0;padding:0 4px 6px 4px;display:flex;flex-direction:column;align-items:center;touch-action:none;cursor:ns-resize}
.k1-rl-b{grid-area:rb}
.k1-h{font-size:28px;line-height:34px;color:rgba(255,255,255,.62);white-space:nowrap;display:flex}
.k1-f{cursor:pointer;position:relative}
.k1-f::after{content:"";position:absolute;left:-8px;right:-8px;top:-6px;bottom:-6px}
.k1-f.k1-on{color:#fff;box-shadow:0 3px 0 #fff}
.k1-row{display:flex;align-items:center;white-space:nowrap;margin:17px 0 17px 0}
.k1-box{position:relative;flex:none;box-sizing:border-box;min-width:60px;height:50px;padding:0 11px;border:1px solid rgba(255,255,255,.9);display:flex;align-items:center;justify-content:center}
.k1-box.k1-on{box-shadow:inset 0 -4px 0 #fff}
.k1-n{display:block;font-size:34px;font-weight:400;line-height:1;white-space:nowrap}
.k1-n.k1-n2{font-size:30px}.k1-n.k1-n3{font-size:26px}.k1-n.k1-n4{font-size:24px}
.k1-n.k1-typing{color:rgba(255,255,255,.78)}
.k1-n.k1-up1{animation:k1up .12s ease-out}.k1-n.k1-dn1{animation:k1dn .12s ease-out}
@keyframes k1up{0%{transform:translateY(11px);opacity:.25}100%{transform:none;opacity:1}}
@keyframes k1dn{0%{transform:translateY(-11px);opacity:.25}100%{transform:none;opacity:1}}
.k1-up,.k1-dn{position:absolute;left:50%;width:9px;height:9px;margin-left:-5px;box-sizing:border-box;border-left:1.5px solid rgba(255,255,255,.55);border-top:1.5px solid rgba(255,255,255,.55)}
.k1-up{top:-12px;transform:rotate(45deg)}
.k1-dn{bottom:-12px;transform:rotate(225deg)}
.k1-res{flex:none;display:flex;align-items:center;font-size:30px;line-height:1;color:rgba(255,255,255,.82);margin-left:10px;min-height:34px}
.k1-ar{display:inline-block;position:relative;width:20px;height:0;border-top:1.5px solid rgba(255,255,255,.6);margin-right:10px}
.k1-ar::after{content:"";position:absolute;right:0;top:-5px;width:7px;height:7px;box-sizing:border-box;border-top:1.5px solid rgba(255,255,255,.6);border-right:1.5px solid rgba(255,255,255,.6);transform:rotate(45deg)}
.k1-w{font-size:24px;line-height:30px;min-height:60px;color:rgba(255,255,255,.58);display:flex;flex-wrap:wrap;justify-content:center;align-content:flex-start;max-width:100%}
.k1-sg{white-space:pre;flex:none}
.k1-br{flex-basis:100%;height:0}
.k1-more{cursor:pointer}
.k1-ct{display:inline-block;width:2px;height:.82em;margin-left:2px;vertical-align:-.08em;background:#fff;animation:k1ct 1.1s steps(1) infinite}
@keyframes k1ct{0%{opacity:1}55%{opacity:0}}
.k1-link{grid-row:3;grid-column:1 / 3;z-index:2;align-self:start;justify-self:center;margin-top:-5px;width:48px;height:44px;display:flex;align-items:center;justify-content:center;color:rgba(255,255,255,.5);cursor:pointer}
.k1-link.k1-on{color:#fff}
.k1-link.k1-ask{color:#fff;animation:k1ask 1.6s ease-in-out infinite}
@keyframes k1ask{0%,100%{opacity:1}50%{opacity:.35}}
/* a number too long for half the width: the two rollers go one above the other, each on one line */
.k1.k1-stack{grid-template-rows:auto minmax(0,1fr) auto auto auto;grid-template-areas:"tl tr" "stage stage" "ra ra" "rb rb" "pad pad"}
.k1.k1-stack .k1-rl{flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:flex-start;padding:0 12px 2px 12px}
.k1.k1-stack .k1-h{margin-right:12px;flex-wrap:wrap;max-width:100%}
.k1.k1-stack .k1-row{margin:15px 0}
.k1.k1-stack .k1-w{flex-basis:100%;justify-content:flex-start;min-height:30px}
.k1.k1-stack .k1-deg{margin-left:auto}
.k1.k1-stack.k1-padopen .k1-row{margin:12px 0}
.k1.k1-stack.k1-padopen .k1-rl-a .k1-w{display:none}
.k1.k1-stack .k1-link{grid-row:3;grid-column:2;justify-self:end;margin:-2px 8px 0 0}
/* the keypad: white outlines, white digits; it opens when a number is tapped */
.k1-pad{grid-area:pad;display:none;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;padding:4px 8px 8px 8px}
.k1-padopen .k1-pad{display:grid}
.k1-key{height:clamp(56px,7vh,64px);box-sizing:border-box;border:1px solid rgba(255,255,255,.5);border-radius:2px;color:#fff;font-size:28px;font-weight:400;display:flex;align-items:center;justify-content:center;cursor:pointer;touch-action:none}
.k1-key.k1-hit{background:rgba(255,255,255,.2)}
.k1-key.k1-off{opacity:.22}
/* landscape and a computer: the rollers at the left and right edges, the circle between them */
.k1.k1-side{grid-template-columns:var(--col,220px) minmax(0,1fr) var(--col,220px);grid-template-rows:auto minmax(0,1fr);
grid-template-areas:"tl stage tr" "ra stage rb";}
.k1.k1-side .k1-link{grid-area:tr;justify-self:start;align-self:center;margin:4px 0 0 6px}
.k1.k1-side .k1-rl{align-self:center}
.k1.k1-side .k1-h,.k1.k1-side .k1-row{flex-wrap:wrap;justify-content:center;max-width:100%}
.k1.k1-side .k1-row{row-gap:16px}
.k1.k1-side .k1-res{margin:0 5px}
.k1.k1-side .k1-pad{grid-template-columns:repeat(3,minmax(0,1fr));align-self:start;padding:4px 10px 6px 6px}
.k1.k1-side .k1-key{height:56px}
.k1.k1-side .k1-key-dot{order:2}.k1.k1-side .k1-key-0{order:3}.k1.k1-side .k1-key-sign{order:4}.k1.k1-side .k1-key-clear{order:5}.k1.k1-side .k1-key-back{order:6}.k1.k1-side .k1-key-enter{order:7}
.k1.k1-side.k1-padopen{grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:"tl stage tr" "ra stage rb" ". stage pad"}
.k1.k1-side.k1-padopen .k1-rl{align-self:start}
.k1.k1-side.k1-padopen.k1-short{grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:"tl stage tr" "ra stage pad" "rb stage pad"}
.k1.k1-side.k1-padopen.k1-short .k1-w{min-height:30px}
.k1.k1-side.k1-padopen.k1-short .k1-row{margin:15px 0 14px 0}
/* the real constants on a phone on its side with the keypad open: the least that still reads */
.k1.k1-side.k1-padopen.k1-short.k1-bigc .k1-rl-a{flex-direction:row;flex-wrap:wrap;justify-content:center}
.k1.k1-side.k1-padopen.k1-short.k1-bigc .k1-rl-a .k1-h{margin-right:10px}
.k1.k1-side.k1-padopen.k1-short.k1-bigc .k1-rl-a .k1-w,.k1.k1-side.k1-padopen.k1-short.k1-bigc .k1-wq{display:none}
.k1.k1-side.k1-padopen.k1-short.k1-bigc .k1-row{margin:12px 0 11px 0}
.k1.k1-side.k1-padopen.k1-short.k1-bigc .k1-h{line-height:31px}
/* a short phone screen (a browser with its bars showing) with the keypad open: tighter, so the circle stays as large as it can */
@media (max-height:760px){
.k1.k1-padopen:not(.k1-side) .k1-w{min-height:30px}
.k1.k1-padopen:not(.k1-side) .k1-row{margin:13px 0}
.k1.k1-stack.k1-padopen.k1-bigc .k1-rl-b .k1-h,.k1.k1-stack.k1-padopen.k1-bigc .k1-wq{display:none}
}
@media (prefers-reduced-motion:reduce){.k1-ct{animation:none}.k1-add.k1-go{animation-duration:2.6s}.k1-copy.k1-go{animation:none}.k1-link.k1-ask{animation:none}.k1-n.k1-up1,.k1-n.k1-dn1{animation:none}}
/* Accepted FIX-one landscape keypad: four complete rows. */
.k1.k1-side.k1-padopen.k1-short .k1-pad{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;padding:4px;align-self:start}
.k1.k1-side.k1-padopen.k1-short .k1-key{height:56px;min-width:0;order:0}
</style>
</head>
<body><div id="one"></div>
<script>
// Every file sits beside this page; nothing comes from the network. A file that is not there is skipped
// (without the two fx files the burst is drawn by one.js itself).
(function (list) {
var i = 0;
function next() {
if (i >= list.length) return;
var s = document.createElement('script'); s.src = list[i++]; s.onload = next; s.onerror = function () { s.remove(); next(); }; document.body.appendChild(s);
}
next();
})(['audio-unlock.js', 'fx-common.js', 'fx-raw.js', 'one.js']);
</script>
<style>.k1-menu{position:absolute;left:4px;bottom:0;z-index:2;height:44px;padding:0 8px;display:flex;align-items:center;font-size:24px;color:rgba(255,255,255,.7);text-decoration:none}.k1-padopen .k1-menu{display:none}</style>
<script>(function t(n){var c=document.querySelector(".k1-copy");if(!c){if(n<100)setTimeout(function(){t(n+1)},200);return;}var a=document.createElement("a");a.className="k1-menu";a.href="menu.html";a.textContent="MENU";c.parentNode.appendChild(a);})(0);</script>
</body></html>Lesson
A web page in the learn the kuiper folder of Kuiper Belt. Published at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/lesson.html.
renderkuiper-belt / learn-the-kuiper/202610050609/lesson.html · lines 1–5 of 5 · version 2026-10-05 06:09 · Entry point
- What it does
- It draws its content. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- Out: web page.
- Downstream impact
- Used directly by 1 file: Menu (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050354/menu.html). Reached from 2 other entry points, including Play (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/play.html); Solid (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/solid.html). It is itself an entry point, published at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/lesson.html.
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Loaded by the Menu page at https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050354/menu.html.
- Application
- kuiper-belt · learn-the-kuiper/202610050609 · page
- Uses
- Audio Unlock (script src), Kuiper Law (script src), Scale Logic (script src), Lesson (script src), Menu (link)
- Used by
- linked from Menu (link)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 learn-the-kuiper/202610050609/lesson.html:1-5 · blob f7887d3aa4fa18077a73789e01b684f583ae65fd · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unknown
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><title>Learn the Kuiper</title><style>html,body{margin:0;height:100%;background:#000;overflow:hidden;overscroll-behavior:none}#host{position:fixed;inset:0}</style></head><body><div id="host"></div>
<script src="audio-unlock.js"></script><script src="kuiper-law.js"></script><script src="scale-logic.js"></script><script src="lesson.js"></script><script>KGLesson.open(document.getElementById('host'),{standalone:true});</script><style>#host{top:40px!important}.kgm{position:fixed;left:0;top:0;height:40px;display:flex;align-items:center;padding:0 12px;z-index:60;font:400 24px/1 "Segoe UI",system-ui … [line shortened here: 510 characters; full line on GitHub]
<a class="kgm" href="menu.html">MENU</a>
</body></html>