@jossuealcala/madre 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.en.md +40 -1
- package/CHANGELOG.md +40 -1
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/SECURITY.md +11 -6
- package/TRADEMARKS.md +6 -2
- package/bin/madre.mjs +76 -11
- package/docs/REFERENCE.md +16 -10
- package/docs/SDK.md +36 -9
- package/docs/en/REFERENCE.md +12 -8
- package/docs/en/SDK.md +34 -8
- package/docs/en/training/README.md +1 -1
- package/docs/sdk/connector-module.mjs +1 -1
- package/docs/sdk/hello-module.mjs +39 -4
- package/docs/training/README.md +1 -1
- package/docs/training/train.sh +3 -0
- package/habilidades/explicamelo-facil/HABILIDAD.md +19 -0
- package/habilidades/hojas-de-calculo/HABILIDAD.md +18 -0
- package/habilidades/mensajes-a-clientes/HABILIDAD.md +19 -0
- package/habilidades/publicaciones-para-redes/HABILIDAD.md +19 -0
- package/habilidades/resumen-y-pendientes/HABILIDAD.md +18 -0
- package/habilidades/tu-pagina-paso-a-paso/HABILIDAD.md +19 -0
- package/package.json +7 -4
- package/public/activity.js +66 -22
- package/public/app.js +4947 -894
- package/public/assets/brand/OFL-SpaceGrotesk.txt +93 -0
- package/public/assets/brand/SpaceGrotesk-latin-ext.woff2 +0 -0
- package/public/assets/brand/SpaceGrotesk-latin.woff2 +0 -0
- package/public/assets/brand/madre-app-180.png +0 -0
- package/public/assets/brand/madre-app-192.png +0 -0
- package/public/assets/brand/madre-app-512.png +0 -0
- package/public/assets/brand/madre-app.svg +1 -1
- package/public/assets/brand/madre-favicon.svg +1 -1
- package/public/attribution.js +29 -19
- package/public/auto-open.js +102 -0
- package/public/brands.js +36 -19
- package/public/changes.js +63 -0
- package/public/en.js +1085 -102
- package/public/es.js +2940 -1656
- package/public/i18n.js +11 -0
- package/public/index.html +31 -27
- package/public/loader.js +322 -117
- package/public/macroverso.js +57 -355
- package/public/manual-content.js +69 -9
- package/public/manual.js +21 -6
- package/public/market-view.js +298 -84
- package/public/market.js +25 -2
- package/public/mcp-catalog.js +7 -2
- package/public/missions.js +169 -0
- package/public/news-scenes.js +292 -0
- package/public/nostromo-engine.js +935 -654
- package/public/notices.js +78 -0
- package/public/notifications.js +119 -0
- package/public/power.js +1 -1
- package/public/provider-marks.js +170 -0
- package/public/provider-pick.js +147 -0
- package/public/resay.js +4 -0
- package/public/review-ask.js +16 -13
- package/public/routing.js +29 -3
- package/public/salas-mac.css +467 -47
- package/public/salas-mac.html +8 -5
- package/public/salas-mac.js +805 -109
- package/public/salas.css +2 -2
- package/public/salas.html +2 -2
- package/public/salas.js +1 -1
- package/public/starters.js +128 -0
- package/public/styles.css +3036 -340
- package/public/subscription.js +303 -0
- package/public/terms-field.js +170 -0
- package/public/terms.js +117 -19
- package/public/tips.js +158 -0
- package/public/tour-chapters.js +88 -88
- package/public/tour.js +364 -46
- package/public/troubleshooting.js +313 -27
- package/public/welcome-scene.js +446 -0
- package/public/welcome.js +827 -282
- package/src/adapters/claude.mjs +2 -1
- package/src/adapters/codex.mjs +2 -1
- package/src/adapters/cursor.mjs +9 -6
- package/src/adapters/gemini-rest.mjs +236 -0
- package/src/adapters/gemini.mjs +13 -7
- package/src/adapters/grok.mjs +290 -0
- package/src/adapters/madre.mjs +71 -23
- package/src/adapters/opencode.mjs +15 -2
- package/src/adapters/process.mjs +14 -3
- package/src/adapters/steps.mjs +176 -0
- package/src/app-invite.mjs +90 -0
- package/src/auth-probe.mjs +32 -0
- package/src/billing-key.mjs +8 -0
- package/src/billing.mjs +317 -0
- package/src/bridge/policy.mjs +1 -1
- package/src/capabilities.mjs +46 -10
- package/src/chats.mjs +44 -2
- package/src/checkpoint.mjs +119 -1
- package/src/codex-route.mjs +113 -0
- package/src/commands.mjs +5 -2
- package/src/credentials.mjs +46 -8
- package/src/dataset.mjs +18 -7
- package/src/directives.mjs +1 -0
- package/src/event-store.mjs +25 -2
- package/src/extensions.mjs +5 -1
- package/src/ficha.mjs +158 -0
- package/src/files.mjs +36 -2
- package/src/image-studio.mjs +13 -3
- package/src/install-metrics.mjs +9 -3
- package/src/lease.mjs +6 -1
- package/src/looks.mjs +4 -1
- package/src/market-check.mjs +1 -1
- package/src/market-remote.mjs +135 -1
- package/src/mcp/image-server.mjs +59 -90
- package/src/mcp/memory-server.mjs +10 -0
- package/src/memory-tools.mjs +3 -0
- package/src/memory.mjs +29 -4
- package/src/models.mjs +21 -3
- package/src/modules/ahp.mjs +10 -4
- package/src/modules/bishop-exam.mjs +41 -12
- package/src/modules/bishop.mjs +2 -2
- package/src/modules/choices.mjs +12 -10
- package/src/modules/fetch-alone.mjs +7 -0
- package/src/modules/github.mjs +6 -2
- package/src/modules/helpers.mjs +23 -5
- package/src/modules/image-providers.mjs +281 -0
- package/src/modules/image-studio.mjs +106 -39
- package/src/modules/index.mjs +61 -12
- package/src/modules/intents-observe.mjs +3 -1
- package/src/modules/isolated.mjs +160 -0
- package/src/modules/ollama.mjs +35 -6
- package/src/modules/playwright.mjs +78 -20
- package/src/modules/reminders.mjs +42 -2
- package/src/modules/ripley.mjs +2 -1
- package/src/modules/run-alone.mjs +122 -0
- package/src/modules/runs.mjs +11 -8
- package/src/modules/sdk.mjs +10 -3
- package/src/notices-key.mjs +8 -0
- package/src/notices.mjs +185 -0
- package/src/ollama.mjs +57 -15
- package/src/opencode-health.mjs +1 -1
- package/src/outbound.mjs +124 -13
- package/src/quota-sources.mjs +148 -3
- package/src/review-ask.mjs +55 -31
- package/src/room/archivist.mjs +30 -5
- package/src/room/busy.mjs +16 -0
- package/src/room/changes.mjs +79 -0
- package/src/room/control.mjs +36 -6
- package/src/room/economy.mjs +1 -1
- package/src/room/guard.mjs +39 -2
- package/src/room/prompt.mjs +49 -6
- package/src/room/vectors.mjs +7 -1
- package/src/room.mjs +181 -49
- package/src/router.mjs +1 -1
- package/src/runs.mjs +39 -0
- package/src/runtime-detection.mjs +46 -6
- package/src/salas.mjs +181 -18
- package/src/server.mjs +1101 -118
- package/src/service.mjs +116 -0
- package/src/setup-trouble.mjs +20 -1
- package/src/setup.mjs +1 -1
- package/src/skill-check.mjs +269 -0
- package/src/skills-import.mjs +128 -0
- package/src/skills.mjs +502 -0
- package/src/terms.mjs +23 -5
- package/src/tour.mjs +31 -5
- package/src/updates.mjs +47 -4
- package/src/web-preview.mjs +181 -0
- package/src/whats-new.mjs +121 -1
- package/src/rumbo.mjs +0 -337
package/public/macroverso.js
CHANGED
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
// for less motion gets one still frame redrawn when something changes. No line joins two universes
|
|
25
25
|
// until a link exists (phase 3c).
|
|
26
26
|
|
|
27
|
-
import { COLLAPSED, FOCUS_VEIL, MEMORY_COLORS, NEURAL_AXON, NEURAL_COLORS, NEURAL_CROSSFADE, NEURAL_IGNITION, PITCH_LIMIT, TURN_PER_PIXEL, alongCurve, collapsedChip, createNostromo, currentAlong, drawNeuralBulb,
|
|
27
|
+
import { COLLAPSED, FOCUS_VEIL, MEMORY_COLORS, NEURAL_AXON, NEURAL_COLORS, NEURAL_CROSSFADE, NEURAL_IGNITION, PITCH_LIMIT, TURN_PER_PIXEL, alongCurve, buildPlanets, collapsedChip, createNostromo, currentAlong, drawNeuralBulb, drawSun, hexAlpha, hexMix, magmaMap, neuralGround, neuronChip, neuronGlow, planetChip, sunOrb, texturesReady } from './nostromo-engine.js';
|
|
28
28
|
import { createStrain, inviteNeural, neuralKey, paintNeuralKey, tellViews } from './neural.js';
|
|
29
29
|
import { trazo } from './icons.js';
|
|
30
|
+
import { dateWords } from './i18n.js';
|
|
30
31
|
|
|
31
32
|
const KINDS = Object.keys(MEMORY_COLORS);
|
|
32
33
|
const TILT = 0.42; // how flat the orbits read: the plane seen a little from above
|
|
@@ -65,242 +66,7 @@ function canvasOf(width, height) {
|
|
|
65
66
|
return canvas;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
// with one eye that sees everything, in violets, purples and blues. Drawn here, on canvas 2D, from
|
|
70
|
-
// nothing but noise generated here:
|
|
71
|
-
// the sphere — gas warped by gas (a nebula, not a marble), magenta and cyan drifting through the
|
|
72
|
-
// violet, dark lanes of dust, knots of light; lit from the top left, so it has a day side, a
|
|
73
|
-
// terminator and a night side, a soft sheen and a rim lit from behind: round, not a disc;
|
|
74
|
-
// the eye — on the sphere itself, so it foreshortens as it looks aside: an iris of fibres and
|
|
75
|
-
// crypts with a darker limbal ring and a corona, a pupil that opens a little when a universe is
|
|
76
|
-
// carried to it, the light's reflection in it, lids of gas that blink now and then; it follows
|
|
77
|
-
// the person (the pointer), with the small jumps of a living eye;
|
|
78
|
-
// round it — an atmosphere that breathes, wisps of nebula turning two ways, motes of light.
|
|
79
|
-
// The sphere is painted small and scaled up (gas is soft), at most ORB_FPS times a second; the
|
|
80
|
-
// wisps are painted once.
|
|
81
|
-
const ORB_SIDE = 176; // px of the sphere's own canvas
|
|
82
|
-
const ORB_FPS = 30; // the most the sphere is painted again in a second
|
|
83
|
-
const ORB_MOTES = 18; // motes of light in orbit round it
|
|
84
|
-
// The gas, from the deep to the lit: indigo, violet, purple, blue, a pale lilac at the brightest.
|
|
85
|
-
const ORB_GAS = [[0, 7, 3, 24], [0.18, 28, 10, 74], [0.36, 62, 24, 152], [0.52, 108, 50, 222], [0.66, 146, 80, 250], [0.78, 92, 118, 255], [0.9, 158, 188, 255], [1, 236, 228, 255]];
|
|
86
|
-
const ORB_LIGHT = (() => { const l = [-0.46, 0.56, 0.69]; const n = Math.hypot(...l); return l.map((v) => v / n); })();
|
|
87
|
-
|
|
88
|
-
// Fractal value noise on a band that wraps round in x (a sphere's longitude), 0..1, stretched.
|
|
89
|
-
function orbNoise(width, height, seed, octaves, stretch = 0.5) {
|
|
90
|
-
const field = new Float32Array(width * height);
|
|
91
|
-
const cell = (x, y, o) => {
|
|
92
|
-
let h = Math.imul(x + 1, 374761393) ^ Math.imul(y + 7, 668265263) ^ Math.imul(seed * 31 + o, 2246822519);
|
|
93
|
-
h = Math.imul(h ^ (h >>> 13), 1274126177);
|
|
94
|
-
return ((h ^ (h >>> 16)) >>> 0) / 4294967295;
|
|
95
|
-
};
|
|
96
|
-
let amp = 1;
|
|
97
|
-
for (let o = 0; o < octaves; o += 1) {
|
|
98
|
-
const cols = Math.min(6 << o, Math.floor(width / 3));
|
|
99
|
-
const rows = Math.max(2, Math.min(Math.round(cols * stretch), Math.floor(height / 4)));
|
|
100
|
-
for (let y = 0; y < height; y += 1) {
|
|
101
|
-
const fy = (y / height) * rows, y0 = Math.floor(fy), ty = fy - y0, sy = ty * ty * (3 - 2 * ty);
|
|
102
|
-
for (let x = 0; x < width; x += 1) {
|
|
103
|
-
const fx = (x / width) * cols, x0 = Math.floor(fx) % cols, tx = fx - Math.floor(fx), sx = tx * tx * (3 - 2 * tx);
|
|
104
|
-
const x1 = (x0 + 1) % cols;
|
|
105
|
-
const a = cell(x0, y0, o), b = cell(x1, y0, o), c = cell(x0, y0 + 1, o), d = cell(x1, y0 + 1, o);
|
|
106
|
-
field[y * width + x] += amp * (a + (b - a) * sx + (c - a) * sy + (a - b - c + d) * sx * sy);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
amp *= 0.52;
|
|
110
|
-
}
|
|
111
|
-
let low = Infinity, high = -Infinity;
|
|
112
|
-
for (const value of field) { low = Math.min(low, value); high = Math.max(high, value); }
|
|
113
|
-
for (let i = 0; i < field.length; i += 1) field[i] = (field[i] - low) / (high - low || 1);
|
|
114
|
-
return field;
|
|
115
|
-
}
|
|
116
|
-
const smooth = (edge0, edge1, x) => { const k = clamp((x - edge0) / (edge1 - edge0), 0, 1); return k * k * (3 - 2 * k); };
|
|
117
|
-
|
|
118
|
-
function bishopOrb() {
|
|
119
|
-
const side = ORB_SIDE;
|
|
120
|
-
const W = 256, H = 128;
|
|
121
|
-
const gas = orbNoise(W, H, 7, 5, 1.1);
|
|
122
|
-
const fine = orbNoise(W, H, 13, 4, 0.9);
|
|
123
|
-
const warp = orbNoise(W, H, 29, 3, 0.8);
|
|
124
|
-
const tint = orbNoise(W, H, 41, 3, 0.7);
|
|
125
|
-
const air = orbNoise(W, H, 19, 4);
|
|
126
|
-
// Knots of light in the gas: a few bright points, soft.
|
|
127
|
-
const knots = new Float32Array(W * H);
|
|
128
|
-
{
|
|
129
|
-
const rnd = random(77);
|
|
130
|
-
for (let k = 0; k < 80; k += 1) {
|
|
131
|
-
const kx = Math.floor(rnd() * W), ky = 6 + Math.floor(rnd() * (H - 12)), bright = 0.35 + rnd() * 0.65;
|
|
132
|
-
for (let dy = -2; dy <= 2; dy += 1) for (let dx = -2; dx <= 2; dx += 1) {
|
|
133
|
-
const at = (ky + dy) * W + ((kx + dx + W) % W);
|
|
134
|
-
knots[at] = Math.max(knots[at], bright * Math.exp(-(dx * dx + dy * dy) / 1.3));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const sample = (field, u, v) => {
|
|
139
|
-
const x = (((u % 1) + 1) % 1) * W, y = clamp(v, 0, 0.999) * (H - 1);
|
|
140
|
-
const x0 = Math.floor(x), y0 = Math.floor(y), tx = x - x0, ty = y - y0;
|
|
141
|
-
const x1 = (x0 + 1) % W, y1 = Math.min(H - 1, y0 + 1);
|
|
142
|
-
const a = field[y0 * W + x0], b = field[y0 * W + x1], c = field[y1 * W + x0], d = field[y1 * W + x1];
|
|
143
|
-
return a + (b - a) * tx + (c - a) * ty + (a - b - c + d) * tx * ty;
|
|
144
|
-
};
|
|
145
|
-
const lut = new Float32Array(256 * 3);
|
|
146
|
-
for (let i = 0; i < 256; i += 1) {
|
|
147
|
-
const k = i / 255;
|
|
148
|
-
const at = ORB_GAS.findIndex((stop) => stop[0] >= k);
|
|
149
|
-
const hi = ORB_GAS[Math.max(1, at)], lo = ORB_GAS[Math.max(0, at - 1)];
|
|
150
|
-
const f = hi[0] === lo[0] ? 0 : (k - lo[0]) / (hi[0] - lo[0]);
|
|
151
|
-
for (let c = 0; c < 3; c += 1) lut[i * 3 + c] = lo[c + 1] + (hi[c + 1] - lo[c + 1]) * f;
|
|
152
|
-
}
|
|
153
|
-
// The disc, once: for every pixel inside it, its normal, where on the sphere it looks, and how
|
|
154
|
-
// the light falls on it (diffuse, sheen, rim).
|
|
155
|
-
const N = side * side;
|
|
156
|
-
const nxs = new Float32Array(N), nys = new Float32Array(N), nzs = new Float32Array(N);
|
|
157
|
-
const lon = new Float32Array(N), lat = new Float32Array(N), inside = new Uint8Array(N);
|
|
158
|
-
const lit = new Float32Array(N), sheen = new Float32Array(N), rimOf = new Float32Array(N);
|
|
159
|
-
const [Lx, Ly, Lz] = ORB_LIGHT;
|
|
160
|
-
for (let py = 0; py < side; py += 1) {
|
|
161
|
-
for (let px = 0; px < side; px += 1) {
|
|
162
|
-
const i = py * side + px;
|
|
163
|
-
const sx = ((px + 0.5) / side) * 2 - 1, sy = ((py + 0.5) / side) * 2 - 1;
|
|
164
|
-
const d2 = sx * sx + sy * sy;
|
|
165
|
-
if (d2 > 1) continue;
|
|
166
|
-
const z = Math.sqrt(1 - d2);
|
|
167
|
-
inside[i] = 1;
|
|
168
|
-
nxs[i] = sx; nys[i] = -sy; nzs[i] = z;
|
|
169
|
-
lon[i] = Math.atan2(sx, z); lat[i] = Math.asin(clamp(-sy, -1, 1));
|
|
170
|
-
const dot = sx * Lx - sy * Ly + z * Lz;
|
|
171
|
-
lit[i] = Math.max(0, dot);
|
|
172
|
-
sheen[i] = Math.max(0, 2 * dot * z - Lz) ** 18;
|
|
173
|
-
rimOf[i] = (1 - z) ** 2.4;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
const canvas = canvasOf(side, side);
|
|
177
|
-
const ctx = canvas.getContext('2d');
|
|
178
|
-
const image = ctx.createImageData(side, side);
|
|
179
|
-
const data = image.data;
|
|
180
|
-
|
|
181
|
-
// The wisps round it, painted once: a nebula in a ring from the rim outward, thinning away.
|
|
182
|
-
const WS = 340, REACH = 2.6;
|
|
183
|
-
const wisps = canvasOf(WS, WS);
|
|
184
|
-
{
|
|
185
|
-
const wctx = wisps.getContext('2d');
|
|
186
|
-
const out = wctx.createImageData(WS, WS);
|
|
187
|
-
for (let py = 0; py < WS; py += 1) {
|
|
188
|
-
for (let px = 0; px < WS; px += 1) {
|
|
189
|
-
const dx = (px - WS / 2) / (WS / 2), dy = (py - WS / 2) / (WS / 2);
|
|
190
|
-
const rr = Math.hypot(dx, dy) * REACH;
|
|
191
|
-
if (rr < 0.82 || rr > REACH) continue;
|
|
192
|
-
const angle = Math.atan2(dy, dx) / (Math.PI * 2) + 0.5;
|
|
193
|
-
const radial = rr / REACH;
|
|
194
|
-
const bend = sample(warp, angle * 2, radial) - 0.5;
|
|
195
|
-
const f = sample(air, angle * 2 + bend * 0.3, radial + bend * 0.2) * 0.6 + sample(fine, angle * 4 + 0.21, radial * 0.7 + 0.2) * 0.4;
|
|
196
|
-
const fall = smooth(0.86, 1.06, rr) * (1 - smooth(1.15, REACH, rr));
|
|
197
|
-
const a = fall * f ** 2.3;
|
|
198
|
-
const h = sample(tint, angle * 2, radial);
|
|
199
|
-
const mag = smooth(0.6, 0.9, h), cyan = smooth(0.6, 0.9, 1 - h);
|
|
200
|
-
const o = (py * WS + px) * 4;
|
|
201
|
-
out.data[o] = 112 + 90 * mag - 40 * cyan; out.data[o + 1] = 58 + 40 * cyan; out.data[o + 2] = 240 + 15 * cyan; out.data[o + 3] = 255 * a;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
wctx.putImageData(out, 0, 0);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// One frame of the sphere. `eye`: where it looks (x, y: -1..1 across the screen), how open its
|
|
208
|
-
// pupil is (`open`, 0..1), how closed its lids are (`lid`, 0..1), and whether BISHOP sleeps.
|
|
209
|
-
function paint(t, eye) {
|
|
210
|
-
// The eye's direction on the sphere and the frame round it.
|
|
211
|
-
let gx = eye.x * 0.62, gy = -eye.y * 0.62;
|
|
212
|
-
const gz = Math.sqrt(Math.max(0.05, 1 - gx * gx - gy * gy));
|
|
213
|
-
const gl = Math.hypot(gx, gy, gz); gx /= gl; gy /= gl; const gzn = gz / gl;
|
|
214
|
-
const rl = Math.hypot(gzn, gx) || 1;
|
|
215
|
-
const Rx = gzn / rl, Rz = -gx / rl; // right: up × gaze
|
|
216
|
-
const Ux = gy * Rz, Uy = gzn * Rx - gx * Rz, Uz = -gy * Rx; // up: gaze × right
|
|
217
|
-
const ex = gx, ey = -gy; // the eye's centre on the disc
|
|
218
|
-
const turn = t * 0.02;
|
|
219
|
-
const life = eye.asleep ? 0.45 : 1;
|
|
220
|
-
const pupilR = 0.082 + 0.05 * eye.open + 0.004 * Math.sin(t * 1.3);
|
|
221
|
-
const irisR = 0.3;
|
|
222
|
-
const lidHalf = (1 - eye.lid) * 0.36;
|
|
223
|
-
for (let i = 0; i < N; i += 1) {
|
|
224
|
-
const o = i * 4;
|
|
225
|
-
if (!inside[i]) { data[o + 3] = 0; continue; }
|
|
226
|
-
const nx = nxs[i], ny = nys[i], nz = nzs[i];
|
|
227
|
-
const c = nx * gx + ny * gy + nz * gzn;
|
|
228
|
-
const d2 = Math.max(0, 2 * (1 - c)); // chord² from the eye's centre
|
|
229
|
-
// The vortex: the gas winds into the eye, a little, faster near it.
|
|
230
|
-
const wind = 0.9 / (1 + d2 * 26) + t * 0.22 / (1 + d2 * 60);
|
|
231
|
-
const sxp = nx, syp = -ny;
|
|
232
|
-
const dx = sxp - ex, dy = syp - ey;
|
|
233
|
-
const cw = Math.cos(wind), sw = Math.sin(wind);
|
|
234
|
-
const qx = ex + dx * cw - dy * sw, qy = ey + dx * sw + dy * cw;
|
|
235
|
-
let j = Math.round(((qy + 1) / 2) * side - 0.5) * side + Math.round(((qx + 1) / 2) * side - 0.5);
|
|
236
|
-
if (j < 0 || j >= N || !inside[j]) j = i;
|
|
237
|
-
const u = lon[j] / (Math.PI * 2), v = lat[j] / Math.PI + 0.5;
|
|
238
|
-
// A nebula: the gas warped by gas.
|
|
239
|
-
const wu = sample(warp, u * 2, v * 2) - 0.5, wv = sample(warp, u * 2 + 0.31, v * 2 + 0.17) - 0.5;
|
|
240
|
-
const gu = u + turn + wu * 0.18, gv = v + wv * 0.12;
|
|
241
|
-
let g = sample(gas, gu, gv) * 0.6 + sample(fine, gu * 3 + 0.37, gv * 2.6) * 0.4;
|
|
242
|
-
g = smooth(0.1, 0.9, g) + (sample(fine, gu * 7 + 0.11, gv * 5.2) - 0.5) * 0.18;
|
|
243
|
-
const k = clamp(Math.round(g * 255), 0, 255) * 3;
|
|
244
|
-
let r = lut[k], gr = lut[k + 1], b = lut[k + 2];
|
|
245
|
-
// Magenta and cyan drifting through the violet; lanes of dust.
|
|
246
|
-
const h = sample(tint, gu * 1.4, gv * 1.4);
|
|
247
|
-
const mag = smooth(0.62, 0.92, h) * 0.38, cyan = smooth(0.62, 0.92, 1 - h) * 0.3;
|
|
248
|
-
r += (198 * g - r) * mag + (80 * g - r) * cyan; gr += (70 * g - gr) * mag + (196 * g - gr) * cyan; b += (226 * g - b) * mag + (255 * g - b) * cyan;
|
|
249
|
-
const dust = 1 - smooth(0.6, 0.82, sample(warp, gu * 3.3 + 0.6, gv * 2.9)) * 0.55;
|
|
250
|
-
// The light: a day side and a night side, a sheen, a rim lit from behind; the gas glows a little of its own.
|
|
251
|
-
const shade = (0.14 + 0.95 * lit[i]) * dust;
|
|
252
|
-
const glow = 0.1 + 0.2 * g;
|
|
253
|
-
r = r * (shade + glow) * life; gr = gr * (shade + glow) * life; b = b * (shade + glow) * life;
|
|
254
|
-
const knot = sample(knots, gu, gv) * life;
|
|
255
|
-
r += 255 * knot; gr += 214 * knot; b += 255 * knot;
|
|
256
|
-
const s = sheen[i] * 0.4 * life;
|
|
257
|
-
r += 170 * s; gr += 180 * s; b += 255 * s;
|
|
258
|
-
const rim = rimOf[i] * life;
|
|
259
|
-
r += 60 * rim; gr += 96 * rim; b += 255 * rim;
|
|
260
|
-
// The eye, on the sphere.
|
|
261
|
-
if (c > 0.6 && life > 0.5) {
|
|
262
|
-
const lx = nx * Rx + nz * Rz, ly = nx * Ux + ny * Uy + nz * Uz;
|
|
263
|
-
const e = Math.sqrt(d2);
|
|
264
|
-
const ay = Math.abs(ly);
|
|
265
|
-
const open = 1 - smooth(lidHalf - 0.035, lidHalf + 0.008, ay);
|
|
266
|
-
// The lids' crease, where gas meets the eye.
|
|
267
|
-
const crease = eye.lid > 0.02 || lidHalf < 0.34 ? Math.exp(-(((ay - lidHalf) / 0.025) ** 2)) * 0.35 * (e < irisR + 0.12 ? 1 : 0) : 0;
|
|
268
|
-
if (open > 0) {
|
|
269
|
-
const angle = Math.atan2(ly, lx) / (Math.PI * 2) + 0.5;
|
|
270
|
-
const fibre = 0.55 + 0.45 * sample(fine, angle * 9, e * 1.6 + 0.3);
|
|
271
|
-
// Crypts: soft hollows in the middle of the iris, never ticks at its rim.
|
|
272
|
-
const crypt = smooth(0.62, 0.86, sample(warp, angle * 3 + 0.2, e * 1.8 + 0.4)) * Math.exp(-(((e - irisR * 0.55) / (irisR * 0.28)) ** 2));
|
|
273
|
-
const irisIn = 1 - smooth(irisR - 0.018, irisR + 0.01, e);
|
|
274
|
-
const limbal = smooth(irisR - 0.075, irisR - 0.005, e);
|
|
275
|
-
const collar = Math.exp(-(((e - pupilR * 1.75) / 0.022) ** 2));
|
|
276
|
-
const depthIn = e / irisR;
|
|
277
|
-
let ir = 150 + 70 * (1 - depthIn), ig = 150 + 60 * (1 - depthIn), ib = 255;
|
|
278
|
-
const fibreLight = (0.55 + 0.6 * fibre) * (1 - 0.3 * crypt) * (1 - 0.45 * limbal) + 0.35 * collar;
|
|
279
|
-
ir *= fibreLight; ig *= fibreLight; ib *= Math.min(1.2, fibreLight + 0.15);
|
|
280
|
-
// The iris is lit by the same light, a little: a curved thing, not a sticker.
|
|
281
|
-
const irisLit = 0.62 + 0.45 * lit[i];
|
|
282
|
-
ir *= irisLit; ig *= irisLit; ib *= irisLit;
|
|
283
|
-
const mix = irisIn * open;
|
|
284
|
-
r += (ir - r) * mix; gr += (ig - gr) * mix; b += (ib - b) * mix;
|
|
285
|
-
const pupil = (1 - smooth(pupilR - 0.012, pupilR + 0.004, e)) * open;
|
|
286
|
-
r += (5 - r) * pupil; gr += (2 - gr) * pupil; b += (16 - b) * pupil;
|
|
287
|
-
const corona = Math.exp(-(((e - irisR) / 0.075) ** 2)) * 0.42 * open;
|
|
288
|
-
r += 70 * corona; gr += 116 * corona; b += 255 * corona;
|
|
289
|
-
// The light's reflection: where the light would glint, not where the eye looks.
|
|
290
|
-
const glint = Math.max(0, 1 - Math.hypot(sxp - (ex - 0.075), syp - (ey - 0.085)) / 0.028) * irisIn * open;
|
|
291
|
-
const glint2 = Math.max(0, 1 - Math.hypot(sxp - (ex + 0.045), syp - (ey + 0.06)) / 0.012) * irisIn * open * 0.5;
|
|
292
|
-
r += 255 * (glint + glint2); gr += 255 * (glint + glint2); b += 255 * (glint + glint2);
|
|
293
|
-
}
|
|
294
|
-
r *= 1 - crease; gr *= 1 - crease; b *= 1 - crease;
|
|
295
|
-
}
|
|
296
|
-
data[o] = r; data[o + 1] = gr; data[o + 2] = b;
|
|
297
|
-
// The edge is gas, not a line: it thins out, ragged with the gas itself.
|
|
298
|
-
data[o + 3] = 255 * (1 - smooth(0.92 + (g - 0.5) * 0.06, 1.0, Math.sqrt(1 - nz * nz)));
|
|
299
|
-
}
|
|
300
|
-
ctx.putImageData(image, 0, 0);
|
|
301
|
-
}
|
|
302
|
-
return { canvas, wisps, reach: REACH, paint, paintedAt: -1 };
|
|
303
|
-
}
|
|
69
|
+
const ORB_FPS = 30; // the most the centre's sun is painted again in a second
|
|
304
70
|
|
|
305
71
|
// How big a universe reads at zoom 1, in css px of radius: the more it knows, the bigger
|
|
306
72
|
// (2026-10-28), plainly enough to tell one project from another, and never past a size that looks
|
|
@@ -350,6 +116,8 @@ function paintUniverse(one, dpr, shown = null, neural = false) {
|
|
|
350
116
|
for (let step = 0; step < (one.settled ? 8 : RELAX_STEPS); step += 1) { t += 1 / 60; engine.stepNostromo(1, t); }
|
|
351
117
|
}
|
|
352
118
|
scene.cam = { x: 0, y: 0, scale: (css / 2 - 4) / BODY_REACH, manual: true };
|
|
119
|
+
// The Coordinator's memories ride round the sun drawn here (sunOrb): its own core is not drawn.
|
|
120
|
+
scene.noCore = Boolean(one.centre) && !neural;
|
|
353
121
|
if (data?.sealed) scene.cage = { at: 0, closed: true };
|
|
354
122
|
// Neural mode (public/neural.js): the universe drawn as a cluster of neurons round its bulb.
|
|
355
123
|
scene.neural = neural;
|
|
@@ -416,7 +184,7 @@ function paintStars(seed, count, biggest, dpr) {
|
|
|
416
184
|
return { canvas, side };
|
|
417
185
|
}
|
|
418
186
|
|
|
419
|
-
export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#
|
|
187
|
+
export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#34d399', accentInk = '#022c22', bishop = null, words, actions, neural: neuralStart = false }) {
|
|
420
188
|
const reduced = reducedMotion();
|
|
421
189
|
const layer = document.createElement('section');
|
|
422
190
|
layer.className = 'mv';
|
|
@@ -427,8 +195,8 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
427
195
|
canvas.className = 'mv-canvas';
|
|
428
196
|
canvas.tabIndex = 0;
|
|
429
197
|
// Its head is the Memory map's (styles.css, .nostromo-head; 2026-10-10): the name in small mono,
|
|
430
|
-
// what it holds in a line beside it, its keys at the end
|
|
431
|
-
//
|
|
198
|
+
// what it holds in a line beside it, its keys at the end; the kinds of memory, as the same planets
|
|
199
|
+
// (nostromo-engine.js, planetChip), along the bottom. The two maps read as one family.
|
|
432
200
|
const head = document.createElement('header');
|
|
433
201
|
head.className = 'mv-head nostromo-head';
|
|
434
202
|
const title = document.createElement('h2');
|
|
@@ -448,14 +216,14 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
448
216
|
chip.className = `k ${kind}`;
|
|
449
217
|
const said = document.createElement('i');
|
|
450
218
|
said.textContent = words.kinds?.[kind] ?? kind;
|
|
451
|
-
chip.append(asNeurons ? neuronChip(NEURAL_COLORS[kind] ?? hex, 16, kind === COLLAPSED ? 'dead' : 'alive') : kind === COLLAPSED ? collapsedChip(hex, 14) :
|
|
219
|
+
chip.append(asNeurons ? neuronChip(NEURAL_COLORS[kind] ?? hex, 16, kind === COLLAPSED ? 'dead' : 'alive') : kind === COLLAPSED ? collapsedChip(hex, 14) : planetChip(kind, 14), said);
|
|
452
220
|
chips.push(chip);
|
|
453
221
|
}
|
|
454
222
|
const chip = document.createElement('span');
|
|
455
223
|
chip.className = 'k dim';
|
|
456
224
|
const said = document.createElement('i');
|
|
457
225
|
said.textContent = words.kinds?.dim ?? 'Out of circulation';
|
|
458
|
-
chip.append(asNeurons ? neuronChip(NEURAL_COLORS.fact, 16, 'spent') :
|
|
226
|
+
chip.append(asNeurons ? neuronChip(NEURAL_COLORS.fact, 16, 'spent') : planetChip('fact', 14, { faded: true }), said);
|
|
459
227
|
chips.push(chip);
|
|
460
228
|
legend.replaceChildren(...chips);
|
|
461
229
|
};
|
|
@@ -484,7 +252,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
484
252
|
neuralButton.className = 'mother-close neural-key';
|
|
485
253
|
neuralKey(neuralButton);
|
|
486
254
|
keys.append(neuralButton, recenter, backTrack);
|
|
487
|
-
head.append(title, sub,
|
|
255
|
+
head.append(title, sub, keys);
|
|
488
256
|
const card = document.createElement('aside');
|
|
489
257
|
card.className = 'mv-card';
|
|
490
258
|
card.hidden = true;
|
|
@@ -492,7 +260,12 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
492
260
|
hint.className = 'mv-hint';
|
|
493
261
|
// A line of words, or the keys to move round it (public/neural.js, mapKeys).
|
|
494
262
|
if (typeof Node === 'function' && words.hint instanceof Node) hint.append(words.hint); else hint.textContent = words.hint;
|
|
495
|
-
|
|
263
|
+
// The kinds of memory and the ways to move sit along the bottom edge (2026-11-10), as in the
|
|
264
|
+
// Memory map: the head keeps only the name, what it holds and its keys.
|
|
265
|
+
const foot = document.createElement('div');
|
|
266
|
+
foot.className = 'nostromo-foot';
|
|
267
|
+
foot.append(legend, hint);
|
|
268
|
+
layer.append(canvas, head, card, foot);
|
|
496
269
|
host.append(layer);
|
|
497
270
|
|
|
498
271
|
const view = { w: 0, h: 0, dpr: 1 };
|
|
@@ -519,11 +292,10 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
519
292
|
let queued = false;
|
|
520
293
|
let resizeTimer = 0;
|
|
521
294
|
const drag = { active: false, moved: false, turning: false, link: null, x: 0, y: 0, x0: 0, y0: 0 };
|
|
522
|
-
// BISHOP at the centre: its room when the lobby knows it, and its
|
|
523
|
-
//
|
|
295
|
+
// BISHOP at the centre: its room when the lobby knows it, and its sun (sunOrb), made on first sight;
|
|
296
|
+
// and where the pointer is over the space.
|
|
524
297
|
const core = { centre: true, room: null, screen: null };
|
|
525
|
-
let
|
|
526
|
-
const gaze = { x: 0, y: 0, open: 0, at: 0, jumpAt: 0, jx: 0, jy: 0, blinkAt: -1, nextBlink: 3 + Math.random() * 4, twice: false };
|
|
298
|
+
let sun = null;
|
|
527
299
|
let pointer = null;
|
|
528
300
|
// Neural mode, switched from its key or because a project switched it: the space as it was fades
|
|
529
301
|
// over the new drawing, the light runs out from the centre, every universe is drawn again its new
|
|
@@ -544,6 +316,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
544
316
|
paintLegend(on);
|
|
545
317
|
layer.querySelector('.neural-invite')?.remove();
|
|
546
318
|
const now = performance.now() / 1000;
|
|
319
|
+
if (core.sprite) core.dirty = true;
|
|
547
320
|
for (const one of universes) {
|
|
548
321
|
if (!one.sprite?.scene) continue;
|
|
549
322
|
if (one.room.open && !reducedMotion()) one.sprite.engine.setNeural(on, now);
|
|
@@ -561,11 +334,19 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
561
334
|
if (!layer.isConnected || !actions.mayTellViews?.()) return;
|
|
562
335
|
if (tellViews({ key: neuralButton, host: layer, neural, onSwitch: () => setNeuralMode(!neural) })) actions.toldViews?.();
|
|
563
336
|
}, 2200);
|
|
564
|
-
const motes = Array.from({ length: ORB_MOTES }, (_, i) => { const rnd = random(hash(`mote${i}`)); return { phase: rnd() * Math.PI * 2, reach: 1.3 + rnd() * 0.65, speed: 0.12 + rnd() * 0.2, tilt: (rnd() - 0.5) * 0.5, size: 0.35 + rnd() * 0.6 }; });
|
|
565
337
|
|
|
566
338
|
function layout(all) {
|
|
567
339
|
// BISHOP's own room is the centre, not a universe on an orbit.
|
|
568
340
|
core.room = bishop ? all.find((room) => room.id === bishop.id) ?? null : null;
|
|
341
|
+
// The Coordinator's own memories round its body (2026-11-07), read and painted as a universe's are:
|
|
342
|
+
// its room is a project like the others. Read again only when what it holds has changed.
|
|
343
|
+
if (core.room) {
|
|
344
|
+
const face = `${core.room.open ? 1 : 0}:${JSON.stringify(core.room.glance?.census ?? null)}`;
|
|
345
|
+
if (core.face !== face || core.dpr !== view.dpr) { core.dirty = true; if (core.face !== face) { core.data = null; core.full = null; core.loading = null; } }
|
|
346
|
+
core.face = face;
|
|
347
|
+
core.dpr = view.dpr;
|
|
348
|
+
core.reach = reachOf(core.room);
|
|
349
|
+
}
|
|
569
350
|
const list = bishop ? all.filter((room) => room.id !== bishop.id) : all;
|
|
570
351
|
const kept = new Map(universes.map((one) => [one.room.id, one]));
|
|
571
352
|
const open = list.filter((room) => room.open);
|
|
@@ -634,7 +415,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
634
415
|
.then((response) => (response.ok ? response.json() : null))
|
|
635
416
|
.catch(() => null)
|
|
636
417
|
.then((answer) => {
|
|
637
|
-
const now = universes.find((item) => item.room.id === one.room.id);
|
|
418
|
+
const now = one.centre ? (core.room?.id === one.room.id ? core : null) : universes.find((item) => item.room.id === one.room.id);
|
|
638
419
|
if (!now || now.face !== one.face) return null;
|
|
639
420
|
now[key] = answer ?? { unreachable: true };
|
|
640
421
|
if (now.loading) delete now.loading[key];
|
|
@@ -642,7 +423,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
642
423
|
// A saturated machine can miss one read while the room is still alive. Do not keep
|
|
643
424
|
// that transient failure as the universe's permanent texture.
|
|
644
425
|
if (now[key].unreachable || now[key].outdated) setTimeout(() => {
|
|
645
|
-
const current = universes.find((item) => item.room.id === one.room.id);
|
|
426
|
+
const current = one.centre ? (core.room?.id === one.room.id ? core : null) : universes.find((item) => item.room.id === one.room.id);
|
|
646
427
|
if (!current || current.face !== one.face || (!current[key]?.unreachable && !current[key]?.outdated)) return;
|
|
647
428
|
current[key] = null;
|
|
648
429
|
if (full) { if (focus === current && !live) enterLive(current); }
|
|
@@ -656,7 +437,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
656
437
|
|
|
657
438
|
// One universe is painted a frame, the chosen one first, so a Mac with many rooms never stalls.
|
|
658
439
|
function paintNext() {
|
|
659
|
-
const next = [focus, ...universes].find((one) => one && one.dirty);
|
|
440
|
+
const next = [focus, core.room ? core : null, ...universes].find((one) => one && one.dirty);
|
|
660
441
|
if (!next) return false;
|
|
661
442
|
if (!next.data) { if (!next.loading?.data) void load(next); return false; }
|
|
662
443
|
next.sprite = paintUniverse(next, view.dpr, next.shown ?? null, neural);
|
|
@@ -669,13 +450,14 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
669
450
|
function tick() {
|
|
670
451
|
if (!textures.ready) {
|
|
671
452
|
magmaMap(12);
|
|
453
|
+
buildPlanets();
|
|
672
454
|
if (texturesReady()) {
|
|
673
455
|
textures.ready = true;
|
|
674
|
-
for (const one of universes) if (one.sprite && !one.sprite.ready) one.dirty = true;
|
|
456
|
+
for (const one of [core, ...universes]) if (one.sprite && !one.sprite.ready) one.dirty = true;
|
|
675
457
|
}
|
|
676
458
|
}
|
|
677
459
|
paintNext();
|
|
678
|
-
return !textures.ready || universes.some((one) => one.dirty && (one.data || one.loading?.data));
|
|
460
|
+
return !textures.ready || [core.room ? core : null, ...universes].some((one) => one && one.dirty && (one.data || one.loading?.data));
|
|
679
461
|
}
|
|
680
462
|
|
|
681
463
|
// Where a universe is now: on its orbit round the Mac, the far side smaller and fainter.
|
|
@@ -964,13 +746,11 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
964
746
|
ctx.globalAlpha = 1;
|
|
965
747
|
}
|
|
966
748
|
|
|
967
|
-
// BISHOP at the centre: a
|
|
968
|
-
//
|
|
969
|
-
//
|
|
970
|
-
// carried onto it. Dim and slow while its room sleeps. Its name and its state under it.
|
|
749
|
+
// BISHOP at the centre: a sun in the planets view (sunOrb, 2026-11-10; it was a nebula with an eye),
|
|
750
|
+
// the bulb of the brain in the neural one. Dimmer while its room sleeps. Its name and its state
|
|
751
|
+
// under it.
|
|
971
752
|
function drawCentre(ctx, beat) {
|
|
972
753
|
if (!bishop) return;
|
|
973
|
-
if (!orb) orb = bishopOrb();
|
|
974
754
|
const room = core.room;
|
|
975
755
|
const awake = Boolean(room?.open);
|
|
976
756
|
const float = reduced ? 0 : Math.sin(clock * 0.8) * 3;
|
|
@@ -978,106 +758,28 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
978
758
|
const p = { x: centre.x, y: centre.y + float * Math.max(0.6, camera.zoom) };
|
|
979
759
|
const r = 30 * clamp(camera.zoom, 0.75, 1.8);
|
|
980
760
|
core.screen = { x: p.x, y: p.y, r: r * (neural ? 1.8 : 1.3) };
|
|
761
|
+
// Its memories first, round where its body floats: the same sprite a project's universe wears.
|
|
762
|
+
if (core.sprite && core.reach) {
|
|
763
|
+
// Wide enough that its memories sit round its body and are not hidden under it.
|
|
764
|
+
const side = Math.max(core.reach * 2 * camera.zoom, r * 12);
|
|
765
|
+
core.shown = side;
|
|
766
|
+
ctx.globalAlpha = awake ? 1 : 0.6;
|
|
767
|
+
ctx.drawImage(core.sprite.canvas, p.x - side / 2, p.y - side / 2, side, side);
|
|
768
|
+
ctx.globalAlpha = 1;
|
|
769
|
+
}
|
|
981
770
|
// Neural mode: the centre of the brain, its bulb, in the Coordinator's violet; no eye, no gas.
|
|
982
771
|
if (neural) {
|
|
983
772
|
const ignite = neuralSince === null ? 1 : clamp((clock - neuralSince) / NEURAL_IGNITION, 0, 1);
|
|
984
773
|
drawNeuralBulb(ctx, p.x, p.y, r * 1.6, clock, { beat, light: awake ? 1 : 0.6, ignite, tone: 'bishop', still: reduced });
|
|
985
774
|
} else {
|
|
986
|
-
//
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
if (!reduced && clock > gaze.jumpAt) { gaze.jumpAt = clock + 0.6 + Math.random() * 1.2; gaze.jx = (Math.random() - 0.5) * 0.07; gaze.jy = (Math.random() - 0.5) * 0.05; }
|
|
993
|
-
const toward = target ? { x: target.x - p.x, y: target.y - p.y } : { x: 0, y: 0 };
|
|
994
|
-
const far = Math.hypot(toward.x, toward.y) + 180;
|
|
995
|
-
const step = reduced ? 1 : clamp((clock - gaze.at) * 6, 0, 1);
|
|
996
|
-
gaze.at = clock;
|
|
997
|
-
gaze.x += (clamp(toward.x / far + gaze.jx, -1, 1) - gaze.x) * step;
|
|
998
|
-
gaze.y += (clamp(toward.y / far + gaze.jy, -1, 1) - gaze.y) * step;
|
|
999
|
-
gaze.open += ((linking?.over === core ? 1 : hover === core ? 0.45 : 0) - gaze.open) * step;
|
|
1000
|
-
// A blink now and then, sometimes two; the lids close fast and open a little slower.
|
|
1001
|
-
if (!reduced && awake && clock > gaze.nextBlink) {
|
|
1002
|
-
gaze.blinkAt = clock;
|
|
1003
|
-
gaze.twice = !gaze.twice && Math.random() < 0.25;
|
|
1004
|
-
gaze.nextBlink = clock + (gaze.twice ? 0.32 : 4 + Math.random() * 6);
|
|
1005
|
-
}
|
|
1006
|
-
const since = clock - gaze.blinkAt;
|
|
1007
|
-
const lid = gaze.blinkAt < 0 || since > 0.26 ? 0 : since < 0.09 ? since / 0.09 : 1 - (since - 0.09) / 0.17;
|
|
1008
|
-
if (clock - orb.paintedAt >= 1 / ORB_FPS || orb.paintedAt < 0 || lid > 0) {
|
|
1009
|
-
orb.paint(reduced ? 0 : clock, { x: gaze.x, y: gaze.y, open: gaze.open, lid: clamp(lid, 0, 1) * 0.94, asleep: !awake });
|
|
1010
|
-
orb.paintedAt = clock;
|
|
775
|
+
// The planets view: a sun (sunOrb). It turns slowly; asleep, it burns lower.
|
|
776
|
+
if (!sun) sun = sunOrb();
|
|
777
|
+
const life = awake ? 1 : 0.62;
|
|
778
|
+
if (clock - sun.paintedAt >= 1 / ORB_FPS || sun.paintedAt < 0) {
|
|
779
|
+
sun.paint(reduced ? 0 : clock * 0.035, life);
|
|
780
|
+
sun.paintedAt = clock;
|
|
1011
781
|
}
|
|
1012
|
-
|
|
1013
|
-
// The atmosphere: violet into blue, breathing slowly.
|
|
1014
|
-
ctx.globalCompositeOperation = 'lighter';
|
|
1015
|
-
const air = ctx.createRadialGradient(p.x, p.y, r * 0.8, p.x, p.y, r * (2.7 + 0.12 * beat));
|
|
1016
|
-
air.addColorStop(0, `rgba(122, 58, 238, ${0.3 * life})`);
|
|
1017
|
-
air.addColorStop(0.45, `rgba(72, 112, 255, ${0.12 * life})`);
|
|
1018
|
-
air.addColorStop(1, 'rgba(40, 20, 120, 0)');
|
|
1019
|
-
ctx.fillStyle = air;
|
|
1020
|
-
ctx.beginPath(); ctx.arc(p.x, p.y, r * (2.7 + 0.12 * beat), 0, Math.PI * 2); ctx.fill();
|
|
1021
|
-
// The wisps, turning two ways at once, as gas does.
|
|
1022
|
-
const span = r * orb.reach * 2;
|
|
1023
|
-
for (const [speed, alpha] of [[0.05, 0.8], [-0.033, 0.5]]) {
|
|
1024
|
-
ctx.save();
|
|
1025
|
-
ctx.translate(p.x, p.y);
|
|
1026
|
-
ctx.rotate(reduced ? 0 : clock * speed);
|
|
1027
|
-
ctx.globalAlpha = alpha * life;
|
|
1028
|
-
ctx.drawImage(orb.wisps, -span / 2, -span / 2, span, span);
|
|
1029
|
-
ctx.restore();
|
|
1030
|
-
}
|
|
1031
|
-
// The motes behind it, then the sphere, then the motes in front.
|
|
1032
|
-
const drawMotes = (front) => {
|
|
1033
|
-
for (const mote of motes) {
|
|
1034
|
-
const a = mote.phase + (reduced ? 0 : clock * mote.speed);
|
|
1035
|
-
const ahead = Math.sin(a) > 0;
|
|
1036
|
-
if (ahead !== front) continue;
|
|
1037
|
-
const mx = p.x + Math.cos(a) * r * mote.reach;
|
|
1038
|
-
const my = p.y + Math.sin(a) * r * mote.reach * 0.3 + mote.tilt * r * Math.cos(a);
|
|
1039
|
-
const size = mote.size * (ahead ? 1 : 0.7) * clamp(camera.zoom, 0.7, 1.4);
|
|
1040
|
-
const glow = ctx.createRadialGradient(mx, my, 0, mx, my, size * 3);
|
|
1041
|
-
glow.addColorStop(0, `rgba(214, 206, 255, ${(ahead ? 0.6 : 0.25) * life})`);
|
|
1042
|
-
glow.addColorStop(1, 'rgba(120, 140, 255, 0)');
|
|
1043
|
-
ctx.fillStyle = glow;
|
|
1044
|
-
ctx.beginPath(); ctx.arc(mx, my, size * 3, 0, Math.PI * 2); ctx.fill();
|
|
1045
|
-
}
|
|
1046
|
-
};
|
|
1047
|
-
drawMotes(false);
|
|
1048
|
-
ctx.globalCompositeOperation = 'source-over';
|
|
1049
|
-
ctx.globalAlpha = awake ? 1 : 0.8;
|
|
1050
|
-
ctx.drawImage(orb.canvas, p.x - r, p.y - r, r * 2, r * 2);
|
|
1051
|
-
ctx.globalAlpha = 1;
|
|
1052
|
-
// Volume (2026-10-28): the light comes from the upper left, as its atmosphere says; the far side
|
|
1053
|
-
// falls into a soft night and a sheen sits where the light strikes, so it reads as a sphere.
|
|
1054
|
-
ctx.save();
|
|
1055
|
-
ctx.beginPath(); ctx.arc(p.x, p.y, r, 0, Math.PI * 2); ctx.clip();
|
|
1056
|
-
const night = ctx.createLinearGradient(p.x - r * 0.72, p.y - r * 0.78, p.x + r * 0.82, p.y + r * 0.88);
|
|
1057
|
-
night.addColorStop(0, 'rgba(6, 4, 20, 0)');
|
|
1058
|
-
night.addColorStop(0.5, 'rgba(6, 4, 20, 0.08)');
|
|
1059
|
-
night.addColorStop(1, `rgba(6, 4, 20, ${0.55 * (awake ? 1 : 0.8)})`);
|
|
1060
|
-
ctx.fillStyle = night;
|
|
1061
|
-
ctx.fillRect(p.x - r, p.y - r, r * 2, r * 2);
|
|
1062
|
-
ctx.globalCompositeOperation = 'lighter';
|
|
1063
|
-
const sheen = ctx.createRadialGradient(p.x - r * 0.4, p.y - r * 0.44, 0, p.x - r * 0.4, p.y - r * 0.44, r * 0.6);
|
|
1064
|
-
sheen.addColorStop(0, `rgba(236, 228, 255, ${0.24 * life})`);
|
|
1065
|
-
sheen.addColorStop(1, 'rgba(236, 228, 255, 0)');
|
|
1066
|
-
ctx.fillStyle = sheen;
|
|
1067
|
-
ctx.fillRect(p.x - r, p.y - r, r * 2, r * 2);
|
|
1068
|
-
ctx.restore();
|
|
1069
|
-
// Its own thin atmosphere, brighter on the side the light comes from.
|
|
1070
|
-
ctx.globalCompositeOperation = 'lighter';
|
|
1071
|
-
const limb = ctx.createRadialGradient(p.x - r * 0.1, p.y - r * 0.12, r * 0.9, p.x, p.y, r * 1.14);
|
|
1072
|
-
limb.addColorStop(0, 'rgba(120, 150, 255, 0)');
|
|
1073
|
-
limb.addColorStop(0.55, `rgba(130, 160, 255, ${0.28 * life})`);
|
|
1074
|
-
limb.addColorStop(1, 'rgba(90, 60, 220, 0)');
|
|
1075
|
-
ctx.fillStyle = limb;
|
|
1076
|
-
ctx.beginPath(); ctx.arc(p.x, p.y, r * 1.14, 0, Math.PI * 2); ctx.fill();
|
|
1077
|
-
ctx.globalCompositeOperation = 'source-over';
|
|
1078
|
-
ctx.globalCompositeOperation = 'lighter';
|
|
1079
|
-
drawMotes(true);
|
|
1080
|
-
ctx.globalCompositeOperation = 'source-over';
|
|
782
|
+
drawSun(ctx, p.x, p.y, r, sun, { life, beat });
|
|
1081
783
|
}
|
|
1082
784
|
// A ring in the accent while a universe is carried onto it, and while it waits for the person;
|
|
1083
785
|
// a white one while it is pointed at or chosen.
|
|
@@ -1093,7 +795,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
1093
795
|
ctx.lineWidth = core === focus ? 1.4 : 1;
|
|
1094
796
|
ctx.beginPath(); ctx.arc(p.x, p.y, r * (neural ? 2.2 : 1.5), 0, Math.PI * 2); ctx.stroke();
|
|
1095
797
|
}
|
|
1096
|
-
// The bulb's stem reaches lower than the
|
|
798
|
+
// The bulb's stem reaches lower than the sun: its name stands under the stem.
|
|
1097
799
|
const below = p.y + r * (neural ? 3.25 : 1.62) + 8;
|
|
1098
800
|
ctx.textAlign = 'center';
|
|
1099
801
|
ctx.textBaseline = 'top';
|
|
@@ -1276,7 +978,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
1276
978
|
const meta = document.createElement('p');
|
|
1277
979
|
meta.className = 'mv-mem-meta';
|
|
1278
980
|
const span = memory.fromSequence ? (memory.fromSequence === memory.throughSequence ? `#${memory.fromSequence}` : `#${memory.fromSequence}–#${memory.throughSequence}`) : null;
|
|
1279
|
-
meta.textContent = [span, memory.agent ? `@${memory.agent}` : null, memory.created ?
|
|
981
|
+
meta.textContent = [span, memory.agent ? `@${memory.agent}` : null, memory.created ? dateWords(memory.created) : null].filter(Boolean).join(' · ');
|
|
1280
982
|
el.append(head, text);
|
|
1281
983
|
if (meta.textContent) el.append(meta);
|
|
1282
984
|
shelf.append(el);
|