@idle-screens/savers-classic 2.0.0 → 3.0.0
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/dist/{chunk-MIVXP2IL.js → chunk-RMW74SYX.js} +249 -5
- package/dist/chunk-RMW74SYX.js.map +1 -0
- package/dist/idle-worker.js +2082 -398
- package/dist/idle-worker.js.map +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.js +31 -174
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-MIVXP2IL.js.map +0 -1
package/dist/idle-worker.js
CHANGED
|
@@ -3,13 +3,14 @@ import {
|
|
|
3
3
|
flurry,
|
|
4
4
|
globe,
|
|
5
5
|
hardRain,
|
|
6
|
+
messages,
|
|
6
7
|
mystify,
|
|
7
8
|
pipes,
|
|
8
9
|
rainstorm,
|
|
9
10
|
reactionDiffusion,
|
|
10
11
|
spotlight,
|
|
11
12
|
warp
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RMW74SYX.js";
|
|
13
14
|
|
|
14
15
|
// src/idle-worker.ts
|
|
15
16
|
import { runIdleWorker } from "@idle-screens/core";
|
|
@@ -18,6 +19,9 @@ import { runIdleWorker } from "@idle-screens/core";
|
|
|
18
19
|
import {
|
|
19
20
|
createRng
|
|
20
21
|
} from "@idle-screens/core";
|
|
22
|
+
import { createRng as createRng2 } from "@idle-screens/core";
|
|
23
|
+
import { createRng as createRng3 } from "@idle-screens/core";
|
|
24
|
+
import { createRng as createRng4 } from "@idle-screens/core";
|
|
21
25
|
var SCHEMA_VERSION = 1;
|
|
22
26
|
var LIMITS = {
|
|
23
27
|
maxPerLayer: 400,
|
|
@@ -27,18 +31,94 @@ var LIMITS = {
|
|
|
27
31
|
// px/sec — bounds motion so nothing teleports
|
|
28
32
|
maxPulseAmp: 0.5,
|
|
29
33
|
// opacity breathing amplitude cap
|
|
30
|
-
minPulsePeriod: 500
|
|
34
|
+
minPulsePeriod: 500,
|
|
31
35
|
// ms — caps pulse at 2 Hz (WCAG flash threshold is 3 Hz)
|
|
36
|
+
maxSpin: 360,
|
|
37
|
+
// degrees/sec — one full revolution per second
|
|
38
|
+
maxGrowAmp: 0.8,
|
|
39
|
+
// size breathing amplitude cap (fraction of base size)
|
|
40
|
+
maxOrbitSpeed: 180,
|
|
41
|
+
// degrees/sec — half a revolution per second
|
|
42
|
+
maxLinksK: 8,
|
|
43
|
+
maxLinkLayerCount: 200,
|
|
44
|
+
minCyclePeriod: 500,
|
|
45
|
+
// ms — same flash-safety floor as pulse
|
|
46
|
+
referenceViewport: 1080,
|
|
47
|
+
// for validating viewport-unit dimensional caps
|
|
48
|
+
maxTrailLength: 5e3,
|
|
49
|
+
// ms — cap trail duration
|
|
50
|
+
maxTrailSamples: 24,
|
|
51
|
+
// dots per trail
|
|
52
|
+
minDriftPeriod: 1e4,
|
|
53
|
+
// ms — background drift floor (10 s)
|
|
54
|
+
maxDriftAmount: 0.3,
|
|
55
|
+
// fraction of gradient stop shift
|
|
56
|
+
maxGhosting: 0.95,
|
|
57
|
+
// frame persistence cap — bounds the seek warm-up replay
|
|
58
|
+
maxGhostReplayFrames: 120,
|
|
59
|
+
// fixed-step frames replayed on a non-contiguous seek
|
|
60
|
+
maxMeander: 500,
|
|
61
|
+
// px — wander harmonic amplitude cap (viewport cap: /referenceViewport)
|
|
62
|
+
maxWarpSpeed: 1.5,
|
|
63
|
+
// depth-units/sec — full near-to-far span in ~0.7 s at max
|
|
64
|
+
minPathPoints: 2,
|
|
65
|
+
maxPathPoints: 24,
|
|
66
|
+
minPathDuration: 2e3,
|
|
67
|
+
// ms — a path lap can't be faster than this
|
|
68
|
+
maxGridColumns: 100
|
|
32
69
|
};
|
|
33
70
|
var HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
34
71
|
var isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
35
72
|
var isStr = (v) => typeof v === "string";
|
|
36
73
|
var isNum = (v) => typeof v === "number" && Number.isFinite(v);
|
|
37
74
|
var isRange = (v) => Array.isArray(v) && v.length === 2 && isNum(v[0]) && isNum(v[1]) && v[0] <= v[1];
|
|
75
|
+
var KNOWN_TOP = /* @__PURE__ */ new Set(["schemaVersion", "id", "label", "seed", "motionIntensity", "units", "referenceViewport", "background", "layers", "ghosting"]);
|
|
76
|
+
var KNOWN_LAYER = /* @__PURE__ */ new Set([
|
|
77
|
+
"count",
|
|
78
|
+
"sprite",
|
|
79
|
+
"motion",
|
|
80
|
+
"size",
|
|
81
|
+
"wrap",
|
|
82
|
+
"flip",
|
|
83
|
+
"alpha",
|
|
84
|
+
"blend",
|
|
85
|
+
"region",
|
|
86
|
+
"pulse",
|
|
87
|
+
"spin",
|
|
88
|
+
"grow",
|
|
89
|
+
"key",
|
|
90
|
+
"position",
|
|
91
|
+
"trail",
|
|
92
|
+
"links",
|
|
93
|
+
"layout",
|
|
94
|
+
"life"
|
|
95
|
+
]);
|
|
96
|
+
var KNOWN_CIRCLE = /* @__PURE__ */ new Set(["kind", "radius", "color", "soft", "colors", "colorWeights"]);
|
|
97
|
+
var KNOWN_RING = /* @__PURE__ */ new Set(["kind", "radius", "color", "width", "colors", "colorWeights"]);
|
|
98
|
+
var KNOWN_STREAK = /* @__PURE__ */ new Set(["kind", "length", "color", "width", "colors", "colorWeights"]);
|
|
99
|
+
var KNOWN_RECT = /* @__PURE__ */ new Set(["kind", "width", "aspect", "color", "colors", "colorWeights"]);
|
|
100
|
+
var KNOWN_EMOJI = /* @__PURE__ */ new Set(["kind", "glyphs", "cycle"]);
|
|
101
|
+
var KNOWN_TEXT = /* @__PURE__ */ new Set(["kind", "strings", "color", "font", "align", "baseline", "maxWidth", "cycle"]);
|
|
102
|
+
var KNOWN_DRIFT = /* @__PURE__ */ new Set(["type", "speed", "angle", "bidirectional", "bob"]);
|
|
103
|
+
var KNOWN_RISE = /* @__PURE__ */ new Set(["type", "speed", "sway"]);
|
|
104
|
+
var KNOWN_BOUNCE = /* @__PURE__ */ new Set(["type", "speed"]);
|
|
105
|
+
var KNOWN_STATIC = /* @__PURE__ */ new Set(["type"]);
|
|
106
|
+
var KNOWN_ORBIT = /* @__PURE__ */ new Set(["type", "speed", "radius", "center"]);
|
|
107
|
+
var KNOWN_WANDER = /* @__PURE__ */ new Set(["type", "speed", "angle", "meander", "coherence"]);
|
|
108
|
+
var KNOWN_WARP = /* @__PURE__ */ new Set(["type", "speed", "center"]);
|
|
109
|
+
var KNOWN_PATH = /* @__PURE__ */ new Set(["type", "points", "duration", "curve", "closed", "scatter"]);
|
|
110
|
+
var KNOWN_BG_SOLID = /* @__PURE__ */ new Set(["type", "color"]);
|
|
111
|
+
var KNOWN_BG_GRADIENT = /* @__PURE__ */ new Set(["type", "stops", "band", "drift"]);
|
|
112
|
+
var LAYER_PROPS_ON_SPRITE = /* @__PURE__ */ new Set(["blend", "trail", "alpha", "pulse", "spin", "grow", "region", "links", "flip", "wrap", "key"]);
|
|
113
|
+
function unknownKeys(obj, known) {
|
|
114
|
+
return Object.keys(obj).filter((k) => !known.has(k));
|
|
115
|
+
}
|
|
38
116
|
function validateSpec(spec) {
|
|
39
117
|
const errors = [];
|
|
118
|
+
const warnings = [];
|
|
40
119
|
const err = (path, message) => void errors.push({ path, message });
|
|
41
|
-
|
|
120
|
+
const warn = (path, code, message) => void warnings.push({ path, code, message });
|
|
121
|
+
if (!isObj(spec)) return { valid: false, errors: [{ path: "", message: "spec must be an object" }], warnings: [] };
|
|
42
122
|
if (spec.schemaVersion !== SCHEMA_VERSION) err("schemaVersion", `must be ${SCHEMA_VERSION}`);
|
|
43
123
|
if (!isStr(spec.id) || spec.id.trim() === "") err("id", "must be a non-empty string");
|
|
44
124
|
if (!isStr(spec.label) || spec.label.trim() === "") err("label", "must be a non-empty string");
|
|
@@ -46,7 +126,21 @@ function validateSpec(spec) {
|
|
|
46
126
|
if (spec.motionIntensity !== void 0 && !["calm", "moderate", "energetic"].includes(spec.motionIntensity)) {
|
|
47
127
|
err("motionIntensity", "must be calm | moderate | energetic");
|
|
48
128
|
}
|
|
49
|
-
if (spec.
|
|
129
|
+
if (spec.units !== void 0 && spec.units !== "px" && spec.units !== "viewport") {
|
|
130
|
+
err("units", "must be 'px' | 'viewport'");
|
|
131
|
+
}
|
|
132
|
+
if (spec.referenceViewport !== void 0) {
|
|
133
|
+
if (!isNum(spec.referenceViewport) || spec.referenceViewport < 100 || spec.referenceViewport > 8640) {
|
|
134
|
+
err("referenceViewport", "must be a number between 100 and 8640");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (spec.ghosting !== void 0 && (!isNum(spec.ghosting) || spec.ghosting < 0 || spec.ghosting > LIMITS.maxGhosting)) {
|
|
138
|
+
err("ghosting", `must be a number 0..${LIMITS.maxGhosting}`);
|
|
139
|
+
}
|
|
140
|
+
for (const k of unknownKeys(spec, KNOWN_TOP)) {
|
|
141
|
+
warn(k, "unknown-property", `unknown top-level property '${k}' \u2014 will be ignored`);
|
|
142
|
+
}
|
|
143
|
+
if (spec.background !== void 0) validateBackground(spec.background, err, warn);
|
|
50
144
|
if (!Array.isArray(spec.layers) || spec.layers.length === 0) {
|
|
51
145
|
err("layers", "must be a non-empty array");
|
|
52
146
|
} else {
|
|
@@ -54,19 +148,22 @@ function validateSpec(spec) {
|
|
|
54
148
|
let total = 0;
|
|
55
149
|
spec.layers.forEach((layer, i) => {
|
|
56
150
|
total += isObj(layer) && isNum(layer.count) ? layer.count : 0;
|
|
57
|
-
validateLayer(layer, `layers[${i}]`, err);
|
|
151
|
+
validateLayer(layer, `layers[${i}]`, err, warn, spec);
|
|
58
152
|
});
|
|
59
153
|
if (total > LIMITS.maxTotal) err("layers", `total entities ${total} exceeds cap ${LIMITS.maxTotal}`);
|
|
60
154
|
}
|
|
61
|
-
return { valid: errors.length === 0, errors };
|
|
155
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
62
156
|
}
|
|
63
157
|
function color(v, path, err) {
|
|
64
158
|
if (!isStr(v) || !HEX.test(v)) err(path, "must be a hex colour like #0a3a52");
|
|
65
159
|
}
|
|
66
|
-
function validateBackground(bg, err) {
|
|
160
|
+
function validateBackground(bg, err, warn) {
|
|
67
161
|
if (!isObj(bg)) return err("background", "must be an object");
|
|
68
162
|
if (bg.type === "solid") {
|
|
69
163
|
color(bg.color, "background.color", err);
|
|
164
|
+
for (const k of unknownKeys(bg, KNOWN_BG_SOLID)) {
|
|
165
|
+
warn(`background.${k}`, "unknown-property", `unknown background property '${k}' \u2014 will be ignored`);
|
|
166
|
+
}
|
|
70
167
|
} else if (bg.type === "gradient") {
|
|
71
168
|
if (!Array.isArray(bg.stops) || bg.stops.length < 2) {
|
|
72
169
|
err("background.stops", "gradient needs at least 2 stops");
|
|
@@ -76,6 +173,17 @@ function validateBackground(bg, err) {
|
|
|
76
173
|
color(isObj(s) ? s.color : void 0, `background.stops[${i}].color`, err);
|
|
77
174
|
});
|
|
78
175
|
}
|
|
176
|
+
if (bg.drift !== void 0) {
|
|
177
|
+
if (!isObj(bg.drift)) err("background.drift", "must be an object");
|
|
178
|
+
else {
|
|
179
|
+
if (!isNum(bg.drift.period) || bg.drift.period < LIMITS.minDriftPeriod) {
|
|
180
|
+
err("background.drift.period", `must be >= ${LIMITS.minDriftPeriod} ms`);
|
|
181
|
+
}
|
|
182
|
+
if (bg.drift.amount !== void 0 && (!isNum(bg.drift.amount) || bg.drift.amount <= 0 || bg.drift.amount > LIMITS.maxDriftAmount)) {
|
|
183
|
+
err("background.drift.amount", `must be > 0 and <= ${LIMITS.maxDriftAmount}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
79
187
|
if (bg.band !== void 0) {
|
|
80
188
|
if (!isObj(bg.band)) err("background.band", "must be an object");
|
|
81
189
|
else {
|
|
@@ -83,12 +191,24 @@ function validateBackground(bg, err) {
|
|
|
83
191
|
if (!isNum(bg.band.height) || bg.band.height <= 0) err("background.band.height", "must be > 0");
|
|
84
192
|
}
|
|
85
193
|
}
|
|
194
|
+
for (const k of unknownKeys(bg, KNOWN_BG_GRADIENT)) {
|
|
195
|
+
warn(`background.${k}`, "unknown-property", `unknown background property '${k}' \u2014 will be ignored`);
|
|
196
|
+
}
|
|
86
197
|
} else {
|
|
87
198
|
err("background.type", "must be solid | gradient");
|
|
88
199
|
}
|
|
89
200
|
}
|
|
90
|
-
function validateLayer(layer, path, err) {
|
|
201
|
+
function validateLayer(layer, path, err, warn, spec) {
|
|
91
202
|
if (!isObj(layer)) return err(path, "must be an object");
|
|
203
|
+
for (const k of unknownKeys(layer, KNOWN_LAYER)) {
|
|
204
|
+
if (k === "id") {
|
|
205
|
+
warn(`${path}.id`, "misplaced-property", `'id' is not a layer property \u2014 did you mean 'key'? Use 'key' to name a layer`);
|
|
206
|
+
} else if (k === "depth") {
|
|
207
|
+
warn(`${path}.depth`, "unknown-property", `'depth' is not a layer property \u2014 use motion type 'warp' for true perspective depth, or fake parallax with size/speed/alpha across layers`);
|
|
208
|
+
} else {
|
|
209
|
+
warn(`${path}.${k}`, "unknown-property", `unknown layer property '${k}' \u2014 will be ignored`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
92
212
|
if (!isNum(layer.count) || !Number.isInteger(layer.count) || layer.count < 1) {
|
|
93
213
|
err(`${path}.count`, "must be a positive integer");
|
|
94
214
|
} else if (layer.count > LIMITS.maxPerLayer) {
|
|
@@ -102,7 +222,9 @@ function validateLayer(layer, path, err) {
|
|
|
102
222
|
if (layer.alpha !== void 0 && (!isRange(layer.alpha) || layer.alpha[0] < 0 || layer.alpha[1] > 1)) {
|
|
103
223
|
err(`${path}.alpha`, "must be a [min,max] range within 0..1");
|
|
104
224
|
}
|
|
105
|
-
if (layer.blend !== void 0 &&
|
|
225
|
+
if (layer.blend !== void 0 && !["lighter", "screen", "multiply"].includes(layer.blend)) {
|
|
226
|
+
err(`${path}.blend`, "must be 'lighter' | 'screen' | 'multiply' when set");
|
|
227
|
+
}
|
|
106
228
|
if (layer.key !== void 0 && (!isStr(layer.key) || layer.key.trim() === "")) {
|
|
107
229
|
err(`${path}.key`, "must be a non-empty string");
|
|
108
230
|
}
|
|
@@ -135,18 +257,137 @@ function validateLayer(layer, path, err) {
|
|
|
135
257
|
if (!isNum(layer.pulse.period) || layer.pulse.period < LIMITS.minPulsePeriod) {
|
|
136
258
|
err(`${path}.pulse.period`, `must be >= ${LIMITS.minPulsePeriod} ms (flash-safety floor)`);
|
|
137
259
|
}
|
|
260
|
+
if (layer.pulse.wave !== void 0) {
|
|
261
|
+
if (!isObj(layer.pulse.wave)) err(`${path}.pulse.wave`, "must be an object");
|
|
262
|
+
else {
|
|
263
|
+
if (!isNum(layer.pulse.wave.wavelength) || layer.pulse.wave.wavelength <= 0) {
|
|
264
|
+
err(`${path}.pulse.wave.wavelength`, "must be > 0 (px or viewport-units)");
|
|
265
|
+
}
|
|
266
|
+
if (layer.pulse.wave.angle !== void 0 && !isNum(layer.pulse.wave.angle)) {
|
|
267
|
+
err(`${path}.pulse.wave.angle`, "must be a number (degrees)");
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (layer.spin !== void 0) {
|
|
274
|
+
if (isRange(layer.spin)) {
|
|
275
|
+
if (Math.abs(layer.spin[0]) > LIMITS.maxSpin || Math.abs(layer.spin[1]) > LIMITS.maxSpin) {
|
|
276
|
+
err(`${path}.spin`, `each end of the range must be within \xB1${LIMITS.maxSpin} deg/sec`);
|
|
277
|
+
}
|
|
278
|
+
} else if (!isNum(layer.spin)) {
|
|
279
|
+
err(`${path}.spin`, "must be a number or a [min,max] range (degrees/sec)");
|
|
280
|
+
} else if (Math.abs(layer.spin) > LIMITS.maxSpin) {
|
|
281
|
+
err(`${path}.spin`, `must be within \xB1${LIMITS.maxSpin} deg/sec`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (layer.grow !== void 0) {
|
|
285
|
+
if (!isObj(layer.grow)) err(`${path}.grow`, "must be an object");
|
|
286
|
+
else {
|
|
287
|
+
if (!isNum(layer.grow.amp) || layer.grow.amp <= 0 || layer.grow.amp > LIMITS.maxGrowAmp) {
|
|
288
|
+
err(`${path}.grow.amp`, `must be within 0..${LIMITS.maxGrowAmp}`);
|
|
289
|
+
}
|
|
290
|
+
if (!isNum(layer.grow.period) || layer.grow.period < LIMITS.minPulsePeriod) {
|
|
291
|
+
err(`${path}.grow.period`, `must be >= ${LIMITS.minPulsePeriod} ms (flash-safety floor)`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (layer.links !== void 0) {
|
|
296
|
+
if (!isObj(layer.links)) err(`${path}.links`, "must be an object");
|
|
297
|
+
else {
|
|
298
|
+
if (!isNum(layer.links.k) || !Number.isInteger(layer.links.k) || layer.links.k < 1 || layer.links.k > LIMITS.maxLinksK) {
|
|
299
|
+
err(`${path}.links.k`, `must be an integer 1..${LIMITS.maxLinksK}`);
|
|
300
|
+
}
|
|
301
|
+
if (!isNum(layer.links.maxDist) || layer.links.maxDist <= 0) {
|
|
302
|
+
err(`${path}.links.maxDist`, "must be > 0");
|
|
303
|
+
}
|
|
304
|
+
if (layer.links.color !== void 0) color(layer.links.color, `${path}.links.color`, err);
|
|
305
|
+
if (layer.links.alpha !== void 0 && (!isNum(layer.links.alpha) || layer.links.alpha < 0 || layer.links.alpha > 1)) {
|
|
306
|
+
err(`${path}.links.alpha`, "must be 0..1");
|
|
307
|
+
}
|
|
308
|
+
if (layer.links.width !== void 0 && (!isNum(layer.links.width) || layer.links.width <= 0)) {
|
|
309
|
+
err(`${path}.links.width`, "must be > 0");
|
|
310
|
+
}
|
|
311
|
+
if (layer.links.mode !== void 0 && !["nearest", "chain", "random"].includes(layer.links.mode)) {
|
|
312
|
+
err(`${path}.links.mode`, "must be 'nearest' | 'chain' | 'random'");
|
|
313
|
+
}
|
|
314
|
+
if (layer.links.falloff !== void 0 && typeof layer.links.falloff !== "boolean") {
|
|
315
|
+
err(`${path}.links.falloff`, "must be a boolean");
|
|
316
|
+
}
|
|
317
|
+
if (layer.links.closed !== void 0 && typeof layer.links.closed !== "boolean") {
|
|
318
|
+
err(`${path}.links.closed`, "must be a boolean");
|
|
319
|
+
}
|
|
320
|
+
if (isNum(layer.count) && layer.count > LIMITS.maxLinkLayerCount) {
|
|
321
|
+
err(`${path}.links`, `layer count must be <= ${LIMITS.maxLinkLayerCount} when links is set`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (layer.layout !== void 0) {
|
|
326
|
+
if (!isObj(layer.layout) || layer.layout.type !== "grid") {
|
|
327
|
+
err(`${path}.layout`, "must be an object with type: 'grid'");
|
|
328
|
+
} else {
|
|
329
|
+
if (layer.layout.columns !== void 0 && (!isNum(layer.layout.columns) || !Number.isInteger(layer.layout.columns) || layer.layout.columns < 1 || layer.layout.columns > LIMITS.maxGridColumns)) {
|
|
330
|
+
err(`${path}.layout.columns`, `must be an integer 1..${LIMITS.maxGridColumns}`);
|
|
331
|
+
}
|
|
332
|
+
const jit = layer.layout.jitter;
|
|
333
|
+
if (jit !== void 0) {
|
|
334
|
+
const jitterOk = (v) => isNum(v) && v >= 0 && v <= 1;
|
|
335
|
+
if (isNum(jit)) {
|
|
336
|
+
if (!jitterOk(jit)) err(`${path}.layout.jitter`, "must be 0..1");
|
|
337
|
+
} else if (isObj(jit)) {
|
|
338
|
+
if (jit.x !== void 0 && !jitterOk(jit.x)) err(`${path}.layout.jitter.x`, "must be 0..1");
|
|
339
|
+
if (jit.y !== void 0 && !jitterOk(jit.y)) err(`${path}.layout.jitter.y`, "must be 0..1");
|
|
340
|
+
} else {
|
|
341
|
+
err(`${path}.layout.jitter`, "must be a number 0..1 or { x?, y? }");
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (layer.position !== void 0) {
|
|
345
|
+
warn(`${path}.layout`, "layout-with-position", "position overrides layout for the single entity \u2014 layout has no effect");
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (layer.life !== void 0) {
|
|
350
|
+
if (!isObj(layer.life)) err(`${path}.life`, "must be an object");
|
|
351
|
+
else {
|
|
352
|
+
if (layer.life.enter !== void 0 && (!isNum(layer.life.enter) || layer.life.enter < 0)) {
|
|
353
|
+
err(`${path}.life.enter`, "must be >= 0 (ms)");
|
|
354
|
+
}
|
|
355
|
+
if (layer.life.exit !== void 0 && (!isNum(layer.life.exit) || layer.life.exit < 0)) {
|
|
356
|
+
err(`${path}.life.exit`, "must be >= 0 (ms)");
|
|
357
|
+
}
|
|
358
|
+
if (isNum(layer.life.enter) && isNum(layer.life.exit) && layer.life.exit <= layer.life.enter) {
|
|
359
|
+
err(`${path}.life.exit`, "must be greater than life.enter");
|
|
360
|
+
}
|
|
361
|
+
if (layer.life.fade !== void 0 && (!isNum(layer.life.fade) || layer.life.fade < 0)) {
|
|
362
|
+
err(`${path}.life.fade`, "must be >= 0 (ms)");
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (layer.trail !== void 0) {
|
|
367
|
+
if (!isObj(layer.trail)) err(`${path}.trail`, "must be an object");
|
|
368
|
+
else {
|
|
369
|
+
if (!isNum(layer.trail.length) || layer.trail.length <= 0 || layer.trail.length > LIMITS.maxTrailLength) {
|
|
370
|
+
err(`${path}.trail.length`, `must be > 0 and <= ${LIMITS.maxTrailLength} ms`);
|
|
371
|
+
}
|
|
372
|
+
if (layer.trail.fade !== void 0 && (!isNum(layer.trail.fade) || layer.trail.fade < 0 || layer.trail.fade > 1)) {
|
|
373
|
+
err(`${path}.trail.fade`, "must be 0..1");
|
|
374
|
+
}
|
|
138
375
|
}
|
|
139
376
|
}
|
|
140
|
-
validateSprite(layer.sprite, `${path}.sprite`, err);
|
|
141
|
-
validateMotion(layer.motion, `${path}.motion`, err);
|
|
377
|
+
validateSprite(layer.sprite, `${path}.sprite`, err, warn);
|
|
378
|
+
validateMotion(layer.motion, `${path}.motion`, err, warn, spec);
|
|
142
379
|
}
|
|
143
|
-
function validateSprite(sprite, path, err) {
|
|
380
|
+
function validateSprite(sprite, path, err, warn) {
|
|
144
381
|
if (!isObj(sprite)) return err(path, "must be an object");
|
|
382
|
+
let knownSet;
|
|
145
383
|
if (sprite.kind === "emoji") {
|
|
384
|
+
knownSet = KNOWN_EMOJI;
|
|
146
385
|
if (!Array.isArray(sprite.glyphs) || sprite.glyphs.length === 0 || !sprite.glyphs.every(isStr)) {
|
|
147
386
|
err(`${path}.glyphs`, "must be a non-empty array of strings");
|
|
148
387
|
}
|
|
388
|
+
validateCycle(sprite, path, err);
|
|
149
389
|
} else if (sprite.kind === "text") {
|
|
390
|
+
knownSet = KNOWN_TEXT;
|
|
150
391
|
if (!Array.isArray(sprite.strings) || sprite.strings.length === 0 || !sprite.strings.every(isStr)) {
|
|
151
392
|
err(`${path}.strings`, "must be a non-empty array of strings");
|
|
152
393
|
}
|
|
@@ -160,33 +401,192 @@ function validateSprite(sprite, path, err) {
|
|
|
160
401
|
if (sprite.maxWidth !== void 0 && (!isNum(sprite.maxWidth) || sprite.maxWidth <= 0)) {
|
|
161
402
|
err(`${path}.maxWidth`, "must be a positive number");
|
|
162
403
|
}
|
|
404
|
+
validateCycle(sprite, path, err);
|
|
163
405
|
} else if (sprite.kind === "circle") {
|
|
406
|
+
knownSet = KNOWN_CIRCLE;
|
|
164
407
|
if (!isRange(sprite.radius) || sprite.radius[0] <= 0) err(`${path}.radius`, "must be a [min,max] range of positive px");
|
|
165
408
|
color(sprite.color, `${path}.color`, err);
|
|
166
409
|
if (sprite.soft !== void 0 && typeof sprite.soft !== "boolean") err(`${path}.soft`, "must be a boolean");
|
|
410
|
+
validatePalette(sprite, path, err);
|
|
411
|
+
} else if (sprite.kind === "ring") {
|
|
412
|
+
knownSet = KNOWN_RING;
|
|
413
|
+
if (!isRange(sprite.radius) || sprite.radius[0] <= 0) err(`${path}.radius`, "must be a [min,max] range of positive px");
|
|
414
|
+
color(sprite.color, `${path}.color`, err);
|
|
415
|
+
if (sprite.width !== void 0 && (!isNum(sprite.width) || sprite.width <= 0)) err(`${path}.width`, "must be > 0");
|
|
416
|
+
validatePalette(sprite, path, err);
|
|
417
|
+
} else if (sprite.kind === "streak") {
|
|
418
|
+
knownSet = KNOWN_STREAK;
|
|
419
|
+
if (!isRange(sprite.length) || sprite.length[0] <= 0) err(`${path}.length`, "must be a [min,max] range of positive px");
|
|
420
|
+
color(sprite.color, `${path}.color`, err);
|
|
421
|
+
if (sprite.width !== void 0 && (!isNum(sprite.width) || sprite.width <= 0)) err(`${path}.width`, "must be > 0");
|
|
422
|
+
validatePalette(sprite, path, err);
|
|
423
|
+
} else if (sprite.kind === "rect") {
|
|
424
|
+
knownSet = KNOWN_RECT;
|
|
425
|
+
if (!isRange(sprite.width) || sprite.width[0] <= 0) err(`${path}.width`, "must be a [min,max] range of positive px");
|
|
426
|
+
if (sprite.aspect !== void 0 && (!isRange(sprite.aspect) || sprite.aspect[0] <= 0)) {
|
|
427
|
+
err(`${path}.aspect`, "must be a [min,max] range of positive height/width ratios");
|
|
428
|
+
}
|
|
429
|
+
color(sprite.color, `${path}.color`, err);
|
|
430
|
+
validatePalette(sprite, path, err);
|
|
167
431
|
} else {
|
|
168
|
-
err(`${path}.kind`, "must be emoji | text | circle");
|
|
432
|
+
err(`${path}.kind`, "must be emoji | text | circle | ring | streak | rect");
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
for (const k of unknownKeys(sprite, knownSet)) {
|
|
436
|
+
if (LAYER_PROPS_ON_SPRITE.has(k)) {
|
|
437
|
+
warn(`${path}.${k}`, "misplaced-property", `'${k}' belongs on the layer, not inside sprite \u2014 move it up one level`);
|
|
438
|
+
} else {
|
|
439
|
+
warn(`${path}.${k}`, "unknown-property", `unknown sprite property '${k}' \u2014 will be ignored`);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
function validatePalette(sprite, path, err) {
|
|
444
|
+
if (sprite.colors !== void 0) {
|
|
445
|
+
if (!Array.isArray(sprite.colors) || sprite.colors.length === 0) {
|
|
446
|
+
err(`${path}.colors`, "must be a non-empty array of hex colours");
|
|
447
|
+
} else {
|
|
448
|
+
sprite.colors.forEach((c, ci) => color(c, `${path}.colors[${ci}]`, err));
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
if (sprite.colorWeights !== void 0) {
|
|
452
|
+
if (!Array.isArray(sprite.colors)) {
|
|
453
|
+
err(`${path}.colorWeights`, "requires colors to be set");
|
|
454
|
+
} else if (!Array.isArray(sprite.colorWeights) || sprite.colorWeights.length !== sprite.colors.length) {
|
|
455
|
+
err(`${path}.colorWeights`, "must be an array the same length as colors");
|
|
456
|
+
} else if (!sprite.colorWeights.every((v) => isNum(v) && v >= 0) || !sprite.colorWeights.some((v) => isNum(v) && v > 0)) {
|
|
457
|
+
err(`${path}.colorWeights`, "weights must be >= 0 with at least one > 0");
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function validateCycle(sprite, path, err) {
|
|
462
|
+
if (sprite.cycle === void 0) return;
|
|
463
|
+
if (!isObj(sprite.cycle)) return err(`${path}.cycle`, "must be an object");
|
|
464
|
+
if (!isNum(sprite.cycle.period) || sprite.cycle.period < LIMITS.minCyclePeriod) {
|
|
465
|
+
err(`${path}.cycle.period`, `must be >= ${LIMITS.minCyclePeriod} ms (flash-safety floor)`);
|
|
169
466
|
}
|
|
170
467
|
}
|
|
171
|
-
function validateMotion(motion, path, err) {
|
|
468
|
+
function validateMotion(motion, path, err, warn, spec) {
|
|
172
469
|
if (!isObj(motion)) return err(path, "must be an object");
|
|
470
|
+
const isViewport = !isObj(spec) || spec.units !== "px";
|
|
471
|
+
const refVp = isObj(spec) && isNum(spec.referenceViewport) ? spec.referenceViewport : LIMITS.referenceViewport;
|
|
472
|
+
const speedCap = isViewport ? LIMITS.maxSpeed / refVp : LIMITS.maxSpeed;
|
|
173
473
|
const speedOk = (v, p) => {
|
|
174
474
|
if (!isRange(v)) err(p, "must be a [min,max] range");
|
|
175
|
-
else if (v[
|
|
475
|
+
else if (v[0] < 0) err(p, "speed lower bound must be >= 0");
|
|
476
|
+
else if (v[1] > speedCap) err(p, `speed exceeds cap ${isViewport ? speedCap.toFixed(2) + " viewport-units/sec" : LIMITS.maxSpeed + " px/sec"}`);
|
|
176
477
|
};
|
|
478
|
+
let knownSet;
|
|
177
479
|
if (motion.type === "drift") {
|
|
480
|
+
knownSet = KNOWN_DRIFT;
|
|
178
481
|
speedOk(motion.speed, `${path}.speed`);
|
|
179
482
|
if (motion.angle !== void 0 && !isNum(motion.angle)) err(`${path}.angle`, "must be a number (degrees)");
|
|
180
483
|
if (motion.bidirectional !== void 0 && typeof motion.bidirectional !== "boolean") err(`${path}.bidirectional`, "must be a boolean");
|
|
181
484
|
if (motion.bob !== void 0 && !isNum(motion.bob)) err(`${path}.bob`, "must be a number");
|
|
485
|
+
if (isRange(motion.speed) && motion.speed[1] < 1 && !isViewport) {
|
|
486
|
+
warn(`${path}.speed`, "near-zero-speed", `max speed is ${motion.speed[1]} px/sec \u2014 entities will appear frozen. Typical range: 10\u2013200 px/sec`);
|
|
487
|
+
}
|
|
182
488
|
} else if (motion.type === "rise") {
|
|
489
|
+
knownSet = KNOWN_RISE;
|
|
183
490
|
speedOk(motion.speed, `${path}.speed`);
|
|
184
491
|
if (motion.sway !== void 0 && !isNum(motion.sway)) err(`${path}.sway`, "must be a number");
|
|
492
|
+
if (isRange(motion.speed) && motion.speed[1] < 1 && !isViewport) {
|
|
493
|
+
warn(`${path}.speed`, "near-zero-speed", `max speed is ${motion.speed[1]} px/sec \u2014 entities will appear frozen. Typical range: 5\u201380 px/sec`);
|
|
494
|
+
}
|
|
185
495
|
} else if (motion.type === "bounce") {
|
|
496
|
+
knownSet = KNOWN_BOUNCE;
|
|
186
497
|
speedOk(motion.speed, `${path}.speed`);
|
|
498
|
+
if (isRange(motion.speed) && motion.speed[1] < 1 && !isViewport) {
|
|
499
|
+
warn(`${path}.speed`, "near-zero-speed", `max speed is ${motion.speed[1]} px/sec \u2014 entities will appear frozen. Typical range: 20\u2013150 px/sec`);
|
|
500
|
+
}
|
|
187
501
|
} else if (motion.type === "static") {
|
|
502
|
+
knownSet = KNOWN_STATIC;
|
|
503
|
+
} else if (motion.type === "orbit") {
|
|
504
|
+
knownSet = KNOWN_ORBIT;
|
|
505
|
+
if (!isRange(motion.speed)) err(`${path}.speed`, "must be a [min,max] range");
|
|
506
|
+
else {
|
|
507
|
+
if (Math.abs(motion.speed[0]) > LIMITS.maxOrbitSpeed || Math.abs(motion.speed[1]) > LIMITS.maxOrbitSpeed) err(`${path}.speed`, `orbit speed exceeds cap ${LIMITS.maxOrbitSpeed} deg/sec`);
|
|
508
|
+
if (Math.max(Math.abs(motion.speed[0]), Math.abs(motion.speed[1])) < 1) {
|
|
509
|
+
warn(`${path}.speed`, "near-zero-speed", `orbit speed is near zero \u2014 entities will appear frozen. Typical range: 5\u201360 deg/sec`);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (!isRange(motion.radius) || motion.radius[0] <= 0) err(`${path}.radius`, "must be a [min,max] range of positive px");
|
|
513
|
+
if (motion.center !== void 0) {
|
|
514
|
+
if (!isObj(motion.center)) {
|
|
515
|
+
err(`${path}.center`, "must be {x, y} (0..1) or { layer: key }");
|
|
516
|
+
} else if ("layer" in motion.center) {
|
|
517
|
+
if (!isStr(motion.center.layer) || motion.center.layer.trim() === "") {
|
|
518
|
+
err(`${path}.center.layer`, "must be a non-empty layer key");
|
|
519
|
+
} else if (isObj(spec) && Array.isArray(spec.layers)) {
|
|
520
|
+
const layers = spec.layers;
|
|
521
|
+
const parent = layers.find((l) => isObj(l) && l.key === motion.center.layer);
|
|
522
|
+
if (!parent) {
|
|
523
|
+
err(`${path}.center.layer`, `no layer with key '${motion.center.layer}'`);
|
|
524
|
+
} else {
|
|
525
|
+
if (parent.count !== 1) err(`${path}.center.layer`, "parent layer must have count: 1");
|
|
526
|
+
const pm = parent.motion;
|
|
527
|
+
if (isObj(pm) && pm.type === "orbit" && isObj(pm.center) && "layer" in pm.center) {
|
|
528
|
+
err(`${path}.center.layer`, "parent may not itself orbit a layer (one level deep only)");
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
} else if (!isNum(motion.center.x) || !isNum(motion.center.y)) {
|
|
533
|
+
err(`${path}.center`, "must be {x, y} with numbers 0..1");
|
|
534
|
+
} else {
|
|
535
|
+
if (motion.center.x < 0 || motion.center.x > 1) err(`${path}.center.x`, "must be 0..1");
|
|
536
|
+
if (motion.center.y < 0 || motion.center.y > 1) err(`${path}.center.y`, "must be 0..1");
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
} else if (motion.type === "wander") {
|
|
540
|
+
knownSet = KNOWN_WANDER;
|
|
541
|
+
speedOk(motion.speed, `${path}.speed`);
|
|
542
|
+
if (motion.angle !== void 0 && !isNum(motion.angle)) err(`${path}.angle`, "must be a number (degrees)");
|
|
543
|
+
const meanderCap = isViewport ? LIMITS.maxMeander / refVp : LIMITS.maxMeander;
|
|
544
|
+
if (motion.meander !== void 0 && (!isNum(motion.meander) || motion.meander <= 0 || motion.meander > meanderCap)) {
|
|
545
|
+
err(`${path}.meander`, `must be > 0 and <= ${isViewport ? meanderCap.toFixed(3) + " viewport-units" : LIMITS.maxMeander + " px"}`);
|
|
546
|
+
}
|
|
547
|
+
if (motion.coherence !== void 0 && (!isNum(motion.coherence) || motion.coherence < 0 || motion.coherence > 1)) {
|
|
548
|
+
err(`${path}.coherence`, "must be 0..1");
|
|
549
|
+
}
|
|
550
|
+
} else if (motion.type === "warp") {
|
|
551
|
+
knownSet = KNOWN_WARP;
|
|
552
|
+
if (!isRange(motion.speed) || motion.speed[0] < 0) err(`${path}.speed`, "must be a [min,max] range >= 0 (depth-units/sec)");
|
|
553
|
+
else if (motion.speed[1] > LIMITS.maxWarpSpeed) err(`${path}.speed`, `warp speed exceeds cap ${LIMITS.maxWarpSpeed} depth-units/sec`);
|
|
554
|
+
if (motion.center !== void 0) {
|
|
555
|
+
if (!isObj(motion.center) || !isNum(motion.center.x) || !isNum(motion.center.y)) {
|
|
556
|
+
err(`${path}.center`, "must be {x, y} with numbers 0..1");
|
|
557
|
+
} else {
|
|
558
|
+
if (motion.center.x < 0 || motion.center.x > 1) err(`${path}.center.x`, "must be 0..1");
|
|
559
|
+
if (motion.center.y < 0 || motion.center.y > 1) err(`${path}.center.y`, "must be 0..1");
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
} else if (motion.type === "path") {
|
|
563
|
+
knownSet = KNOWN_PATH;
|
|
564
|
+
if (!Array.isArray(motion.points) || motion.points.length < LIMITS.minPathPoints || motion.points.length > LIMITS.maxPathPoints) {
|
|
565
|
+
err(`${path}.points`, `must be an array of ${LIMITS.minPathPoints}..${LIMITS.maxPathPoints} points`);
|
|
566
|
+
} else {
|
|
567
|
+
motion.points.forEach((p, pi) => {
|
|
568
|
+
if (!isObj(p) || !isNum(p.x) || !isNum(p.y) || p.x < 0 || p.x > 1 || p.y < 0 || p.y > 1) {
|
|
569
|
+
err(`${path}.points[${pi}]`, "must be {x, y} with numbers 0..1");
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
if (!isNum(motion.duration) || motion.duration < LIMITS.minPathDuration) {
|
|
574
|
+
err(`${path}.duration`, `must be >= ${LIMITS.minPathDuration} ms`);
|
|
575
|
+
}
|
|
576
|
+
if (motion.curve !== void 0 && motion.curve !== "linear" && motion.curve !== "smooth") {
|
|
577
|
+
err(`${path}.curve`, "must be 'linear' | 'smooth'");
|
|
578
|
+
}
|
|
579
|
+
if (motion.closed !== void 0 && typeof motion.closed !== "boolean") err(`${path}.closed`, "must be a boolean");
|
|
580
|
+
const scatterCap = isViewport ? LIMITS.maxMeander / refVp : LIMITS.maxMeander;
|
|
581
|
+
if (motion.scatter !== void 0 && (!isNum(motion.scatter) || motion.scatter <= 0 || motion.scatter > scatterCap)) {
|
|
582
|
+
err(`${path}.scatter`, `must be > 0 and <= ${isViewport ? scatterCap.toFixed(3) + " viewport-units" : LIMITS.maxMeander + " px"}`);
|
|
583
|
+
}
|
|
188
584
|
} else {
|
|
189
|
-
err(`${path}.type`, "must be drift | rise | bounce | static");
|
|
585
|
+
err(`${path}.type`, "must be drift | rise | bounce | static | orbit | wander | warp | path");
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
for (const k of unknownKeys(motion, knownSet)) {
|
|
589
|
+
warn(`${path}.${k}`, "unknown-property", `unknown motion property '${k}' \u2014 will be ignored`);
|
|
190
590
|
}
|
|
191
591
|
}
|
|
192
592
|
function assertValidSpec(spec) {
|
|
@@ -197,53 +597,168 @@ ${r.errors.map((e) => ` ${e.path || "<root>"}: ${e.message}`).join("\n")}`);
|
|
|
197
597
|
}
|
|
198
598
|
return spec;
|
|
199
599
|
}
|
|
600
|
+
var WARP_NEAR = 0.08;
|
|
601
|
+
var WARP_MAX_SCALE = 8;
|
|
200
602
|
function spriteVariants(sprite) {
|
|
201
603
|
if (sprite.kind === "emoji") return sprite.glyphs.length;
|
|
202
604
|
if (sprite.kind === "text") return sprite.strings.length;
|
|
203
605
|
return 1;
|
|
204
606
|
}
|
|
205
|
-
|
|
607
|
+
var OCT_AMP = [1, 0.5, 0.25];
|
|
608
|
+
var OCT_PERIOD = [
|
|
609
|
+
[6e3, 14e3],
|
|
610
|
+
[3e3, 7e3],
|
|
611
|
+
[1500, 4e3]
|
|
612
|
+
];
|
|
613
|
+
function drawOsc(rng, amp) {
|
|
614
|
+
const osc = { ax: [], fx: [], phx: [], ay: [], fy: [], phy: [] };
|
|
615
|
+
for (let i = 0; i < 3; i++) {
|
|
616
|
+
osc.ax.push(amp * OCT_AMP[i] * rng.range(0.6, 1.4));
|
|
617
|
+
osc.fx.push(2 * Math.PI / rng.range(OCT_PERIOD[i][0], OCT_PERIOD[i][1]));
|
|
618
|
+
osc.phx.push(rng.range(0, Math.PI * 2));
|
|
619
|
+
}
|
|
620
|
+
for (let i = 0; i < 3; i++) {
|
|
621
|
+
osc.ay.push(amp * OCT_AMP[i] * rng.range(0.6, 1.4));
|
|
622
|
+
osc.fy.push(2 * Math.PI / rng.range(OCT_PERIOD[i][0], OCT_PERIOD[i][1]));
|
|
623
|
+
osc.phy.push(rng.range(0, Math.PI * 2));
|
|
624
|
+
}
|
|
625
|
+
return osc;
|
|
626
|
+
}
|
|
627
|
+
function weightedIndex(u, weights) {
|
|
628
|
+
const total = weights.reduce((a, b) => a + b, 0);
|
|
629
|
+
let acc = 0;
|
|
630
|
+
for (let i = 0; i < weights.length; i++) {
|
|
631
|
+
acc += weights[i] / total;
|
|
632
|
+
if (u < acc) return i;
|
|
633
|
+
}
|
|
634
|
+
return weights.length - 1;
|
|
635
|
+
}
|
|
636
|
+
function buildEntities(layer, rng, w, h, scale = 1, countScale = 1) {
|
|
637
|
+
const effectiveCount = countScale === 1 ? layer.count : Math.max(1, Math.min(
|
|
638
|
+
Math.round(layer.count * countScale),
|
|
639
|
+
layer.links ? LIMITS.maxLinkLayerCount : LIMITS.maxPerLayer
|
|
640
|
+
));
|
|
206
641
|
const [smin, smax] = layer.size ?? [20, 40];
|
|
207
642
|
const variants = spriteVariants(layer.sprite);
|
|
643
|
+
const sprite = layer.sprite;
|
|
644
|
+
const spriteColors = sprite.kind === "circle" || sprite.kind === "ring" || sprite.kind === "streak" || sprite.kind === "rect" ? sprite.colors : void 0;
|
|
645
|
+
const colorWeights = sprite.kind === "circle" || sprite.kind === "ring" || sprite.kind === "streak" || sprite.kind === "rect" ? sprite.colorWeights : void 0;
|
|
646
|
+
const colorsLen = spriteColors?.length ?? 0;
|
|
647
|
+
const cycle = sprite.kind === "emoji" || sprite.kind === "text" ? sprite.cycle : void 0;
|
|
648
|
+
const mSpec = layer.motion;
|
|
649
|
+
let sharedOsc = null;
|
|
650
|
+
let meanderPx = 0;
|
|
651
|
+
if (mSpec.type === "wander") {
|
|
652
|
+
meanderPx = (mSpec.meander ?? (scale === 1 ? 60 : 0.05)) * scale;
|
|
653
|
+
sharedOsc = drawOsc(rng, meanderPx);
|
|
654
|
+
}
|
|
655
|
+
let pathPts = null;
|
|
656
|
+
if (mSpec.type === "path") {
|
|
657
|
+
pathPts = mSpec.points.map((p) => ({ x: p.x * w, y: p.y * h }));
|
|
658
|
+
}
|
|
659
|
+
const layout = layer.layout;
|
|
660
|
+
let gridCols = 0;
|
|
661
|
+
let cellW = 0;
|
|
662
|
+
let cellH = 0;
|
|
663
|
+
let gridX0 = 0;
|
|
664
|
+
let gridY0 = 0;
|
|
665
|
+
if (layout?.type === "grid") {
|
|
666
|
+
const [rx0, rx1] = layer.region?.x ?? [0, 1];
|
|
667
|
+
const [ry0, ry1] = layer.region?.y ?? [0, 1];
|
|
668
|
+
const gw = Math.max(1, (rx1 - rx0) * w);
|
|
669
|
+
const gh = Math.max(1, (ry1 - ry0) * h);
|
|
670
|
+
gridCols = Math.min(
|
|
671
|
+
layout.columns ?? Math.max(1, Math.round(Math.sqrt(effectiveCount * (gw / gh)))),
|
|
672
|
+
LIMITS.maxGridColumns
|
|
673
|
+
);
|
|
674
|
+
const gridRows = Math.max(1, Math.ceil(effectiveCount / gridCols));
|
|
675
|
+
cellW = gw / gridCols;
|
|
676
|
+
cellH = gh / gridRows;
|
|
677
|
+
gridX0 = rx0 * w;
|
|
678
|
+
gridY0 = ry0 * h;
|
|
679
|
+
}
|
|
208
680
|
const out = [];
|
|
209
|
-
for (let i = 0; i <
|
|
210
|
-
const size =
|
|
681
|
+
for (let i = 0; i < effectiveCount; i++) {
|
|
682
|
+
const size = sprite.kind === "circle" || sprite.kind === "ring" ? rng.range(sprite.radius[0], sprite.radius[1]) * 2 * scale : sprite.kind === "streak" ? rng.range(sprite.length[0], sprite.length[1]) * scale : sprite.kind === "rect" ? rng.range(sprite.width[0], sprite.width[1]) * scale : rng.range(smin, smax) * scale;
|
|
683
|
+
const size2 = sprite.kind === "rect" ? size * (sprite.aspect ? rng.range(sprite.aspect[0], sprite.aspect[1]) : 1) : void 0;
|
|
211
684
|
let vx = 0;
|
|
212
685
|
let vy = 0;
|
|
213
686
|
let bob = 0;
|
|
214
687
|
let motion = "drift";
|
|
688
|
+
let warpParams;
|
|
689
|
+
let pathPhase = 0;
|
|
690
|
+
let pathOffX = 0;
|
|
691
|
+
let pathOffY = 0;
|
|
215
692
|
const m = layer.motion;
|
|
216
693
|
if (m.type === "static") {
|
|
217
694
|
motion = "static";
|
|
218
695
|
} else if (m.type === "drift") {
|
|
219
|
-
const s = rng.range(m.speed[0], m.speed[1]);
|
|
696
|
+
const s = rng.range(m.speed[0], m.speed[1]) * scale;
|
|
220
697
|
let angle = (m.angle ?? 0) * Math.PI / 180;
|
|
221
698
|
if (m.bidirectional && rng.next() < 0.5) angle = Math.PI - angle;
|
|
222
699
|
vx = s * Math.cos(angle);
|
|
223
700
|
vy = s * Math.sin(angle);
|
|
224
|
-
bob = m.bob ?? 0;
|
|
701
|
+
bob = (m.bob ?? 0) * scale;
|
|
225
702
|
} else if (m.type === "rise") {
|
|
226
703
|
motion = "rise";
|
|
227
|
-
vy = -rng.range(m.speed[0], m.speed[1]);
|
|
228
|
-
bob = m.sway ?? 0;
|
|
229
|
-
} else {
|
|
704
|
+
vy = -rng.range(m.speed[0], m.speed[1]) * scale;
|
|
705
|
+
bob = (m.sway ?? 0) * scale;
|
|
706
|
+
} else if (m.type === "bounce") {
|
|
230
707
|
motion = "bounce";
|
|
231
|
-
const s = rng.range(m.speed[0], m.speed[1]);
|
|
708
|
+
const s = rng.range(m.speed[0], m.speed[1]) * scale;
|
|
232
709
|
const a = rng.range(0, Math.PI * 2);
|
|
233
710
|
vx = s * Math.cos(a);
|
|
234
711
|
vy = s * Math.sin(a);
|
|
712
|
+
} else if (m.type === "orbit") {
|
|
713
|
+
motion = "orbit";
|
|
714
|
+
vx = rng.range(m.speed[0], m.speed[1]);
|
|
715
|
+
} else if (m.type === "wander") {
|
|
716
|
+
motion = "wander";
|
|
717
|
+
const s = rng.range(m.speed[0], m.speed[1]) * scale;
|
|
718
|
+
const heading = m.angle !== void 0 ? m.angle * Math.PI / 180 : rng.range(0, Math.PI * 2);
|
|
719
|
+
vx = s * Math.cos(heading);
|
|
720
|
+
vy = s * Math.sin(heading);
|
|
721
|
+
} else if (m.type === "warp") {
|
|
722
|
+
motion = "warp";
|
|
723
|
+
const vz = rng.range(m.speed[0], m.speed[1]);
|
|
724
|
+
const theta = rng.range(0, Math.PI * 2);
|
|
725
|
+
const r = rng.range(0.15, 1);
|
|
726
|
+
warpParams = {
|
|
727
|
+
ux: Math.cos(theta) * r,
|
|
728
|
+
uy: Math.sin(theta) * r,
|
|
729
|
+
z0: rng.range(WARP_NEAR, 1),
|
|
730
|
+
vz,
|
|
731
|
+
cx: (m.center?.x ?? 0.5) * w,
|
|
732
|
+
cy: (m.center?.y ?? 0.5) * h
|
|
733
|
+
};
|
|
734
|
+
} else if (m.type === "path") {
|
|
735
|
+
motion = "path";
|
|
736
|
+
pathPhase = rng.next();
|
|
737
|
+
if (m.scatter) {
|
|
738
|
+
pathOffX = rng.range(-1, 1) * m.scatter * scale;
|
|
739
|
+
pathOffY = rng.range(-1, 1) * m.scatter * scale;
|
|
740
|
+
}
|
|
235
741
|
}
|
|
236
742
|
let x0;
|
|
237
743
|
let y0;
|
|
238
744
|
if (layer.position && layer.count === 1) {
|
|
239
745
|
x0 = layer.position.x * w;
|
|
240
746
|
y0 = layer.position.y * h;
|
|
747
|
+
} else if (layout?.type === "grid") {
|
|
748
|
+
const col = i % gridCols;
|
|
749
|
+
const row = Math.floor(i / gridCols);
|
|
750
|
+
const j = layout.jitter ?? 0;
|
|
751
|
+
const jx = typeof j === "number" ? j : j.x ?? 0;
|
|
752
|
+
const jy = typeof j === "number" ? j : j.y ?? 0;
|
|
753
|
+
x0 = gridX0 + (col + 0.5) * cellW + rng.range(-0.5, 0.5) * jx * cellW;
|
|
754
|
+
y0 = gridY0 + (row + 0.5) * cellH + rng.range(-0.5, 0.5) * jy * cellH;
|
|
241
755
|
} else {
|
|
242
756
|
const [rx0, rx1] = layer.region?.x ?? [0, 1];
|
|
243
757
|
const [ry0, ry1] = layer.region?.y ?? [0, 1];
|
|
244
758
|
x0 = rng.range(rx0 * w, rx1 * w);
|
|
245
759
|
y0 = rng.range(ry0 * h, ry1 * h);
|
|
246
760
|
}
|
|
761
|
+
const orbitParent = m.type === "orbit" && m.center && "layer" in m.center ? m.center.layer : void 0;
|
|
247
762
|
out.push({
|
|
248
763
|
x0,
|
|
249
764
|
y0,
|
|
@@ -258,16 +773,90 @@ function buildEntities(layer, rng, w, h) {
|
|
|
258
773
|
alpha: layer.alpha ? rng.range(layer.alpha[0], layer.alpha[1]) : 1,
|
|
259
774
|
pulseAmp: layer.pulse?.amp ?? 0,
|
|
260
775
|
pulsePeriod: layer.pulse?.period ?? 1e3,
|
|
261
|
-
pulsePhase: layer.pulse ? rng.range(0, Math.PI * 2) : 0
|
|
776
|
+
pulsePhase: layer.pulse ? rng.range(0, Math.PI * 2) : 0,
|
|
777
|
+
// New draws AFTER pulsePhase — guarded so existing specs keep identical streams.
|
|
778
|
+
// Scalar spin: no draw here, one phase draw below (unchanged). Range spin
|
|
779
|
+
// (new): one seeded speed draw here, then the phase draw — array form is new
|
|
780
|
+
// so the extra draw can't perturb any existing spec's entity stream.
|
|
781
|
+
spinSpeed: typeof layer.spin === "number" ? layer.spin * Math.PI / 180 : Array.isArray(layer.spin) ? rng.range(layer.spin[0], layer.spin[1]) * Math.PI / 180 : 0,
|
|
782
|
+
spinPhase: layer.spin ? rng.range(0, Math.PI * 2) : 0,
|
|
783
|
+
growAmp: layer.grow?.amp ?? 0,
|
|
784
|
+
growPeriod: layer.grow?.period ?? 1e3,
|
|
785
|
+
growPhase: layer.grow ? rng.range(0, Math.PI * 2) : 0,
|
|
786
|
+
orbitR: m.type === "orbit" ? rng.range(m.radius[0], m.radius[1]) * scale : 0,
|
|
787
|
+
orbitCx: m.type === "orbit" && !orbitParent ? (m.center?.x ?? 0.5) * w : 0,
|
|
788
|
+
orbitCy: m.type === "orbit" && !orbitParent ? (m.center?.y ?? 0.5) * h : 0,
|
|
789
|
+
// New draws AFTER orbit — guarded so existing specs keep identical streams.
|
|
790
|
+
colorIndex: colorsLen > 0 ? colorWeights && colorWeights.length === colorsLen ? weightedIndex(rng.next(), colorWeights) : rng.int(0, colorsLen - 1) : -1,
|
|
791
|
+
cyclePeriod: cycle ? cycle.period : 0,
|
|
792
|
+
// Optional feature fields last (guarded draws inside — wander draws 18 here).
|
|
793
|
+
...size2 !== void 0 ? { size2 } : {},
|
|
794
|
+
...orbitParent ? { orbitParent } : {},
|
|
795
|
+
...m.type === "wander" ? {
|
|
796
|
+
wander: {
|
|
797
|
+
own: drawOsc(rng, meanderPx),
|
|
798
|
+
shared: sharedOsc,
|
|
799
|
+
coherence: Math.max(0, Math.min(1, m.coherence ?? 0)),
|
|
800
|
+
margin: meanderPx * (OCT_AMP[0] + OCT_AMP[1] + OCT_AMP[2]) * 1.4
|
|
801
|
+
}
|
|
802
|
+
} : {},
|
|
803
|
+
...warpParams ? { warp: warpParams } : {},
|
|
804
|
+
...m.type === "path" && pathPts ? {
|
|
805
|
+
path: {
|
|
806
|
+
pts: pathPts,
|
|
807
|
+
duration: m.duration,
|
|
808
|
+
closed: m.closed !== false,
|
|
809
|
+
smooth: m.curve !== "linear",
|
|
810
|
+
phase: pathPhase,
|
|
811
|
+
offX: pathOffX,
|
|
812
|
+
offY: pathOffY
|
|
813
|
+
}
|
|
814
|
+
} : {}
|
|
262
815
|
});
|
|
816
|
+
if (layer.pulse?.wave) {
|
|
817
|
+
const wl = Math.max(1e-6, layer.pulse.wave.wavelength * scale);
|
|
818
|
+
const ang = (layer.pulse.wave.angle ?? 0) * Math.PI / 180;
|
|
819
|
+
out[out.length - 1].pulsePhase = -((x0 * Math.cos(ang) + y0 * Math.sin(ang)) / wl) * Math.PI * 2;
|
|
820
|
+
}
|
|
263
821
|
}
|
|
264
822
|
return out;
|
|
265
823
|
}
|
|
824
|
+
function warpZ(e, t) {
|
|
825
|
+
const wp = e.warp;
|
|
826
|
+
return wrap(wp.z0 - wp.vz * (t / 1e3), WARP_NEAR, 1);
|
|
827
|
+
}
|
|
266
828
|
function alphaAt(e, t) {
|
|
267
|
-
|
|
268
|
-
|
|
829
|
+
let a = e.alpha;
|
|
830
|
+
if (e.pulseAmp) a = e.alpha + e.pulseAmp * Math.sin(t * 2 * Math.PI / e.pulsePeriod + e.pulsePhase);
|
|
831
|
+
if (e.motion === "warp") {
|
|
832
|
+
const z = warpZ(e, t);
|
|
833
|
+
a *= Math.max(0, Math.min(1, (1 - z) / 0.2));
|
|
834
|
+
}
|
|
269
835
|
return a < 0 ? 0 : a > 1 ? 1 : a;
|
|
270
836
|
}
|
|
837
|
+
function sizeAt(e, t) {
|
|
838
|
+
let s = e.size;
|
|
839
|
+
if (e.growAmp) s = e.size * (1 + e.growAmp * Math.sin(t * 2 * Math.PI / e.growPeriod + e.growPhase));
|
|
840
|
+
if (e.motion === "warp") s *= Math.min(1 / warpZ(e, t), WARP_MAX_SCALE);
|
|
841
|
+
return s > 0 ? s : 0.1;
|
|
842
|
+
}
|
|
843
|
+
function rotationAt(e, t) {
|
|
844
|
+
if (!e.spinSpeed) return 0;
|
|
845
|
+
return e.spinPhase + e.spinSpeed * (t / 1e3);
|
|
846
|
+
}
|
|
847
|
+
function lifeAlphaAt(life, t) {
|
|
848
|
+
if (!life) return 1;
|
|
849
|
+
const fade = life.fade ?? 1e3;
|
|
850
|
+
let a = 1;
|
|
851
|
+
if (life.enter !== void 0) {
|
|
852
|
+
if (t < life.enter) return 0;
|
|
853
|
+
a = fade > 0 ? Math.min(1, (t - life.enter) / fade) : 1;
|
|
854
|
+
}
|
|
855
|
+
if (life.exit !== void 0 && t >= life.exit) {
|
|
856
|
+
a *= fade > 0 ? Math.max(0, 1 - (t - life.exit) / fade) : 0;
|
|
857
|
+
}
|
|
858
|
+
return a;
|
|
859
|
+
}
|
|
271
860
|
function wrap(v, min, max) {
|
|
272
861
|
const range = max - min;
|
|
273
862
|
return ((v - min) % range + range) % range + min;
|
|
@@ -279,8 +868,64 @@ function reflect(v, min, max) {
|
|
|
279
868
|
const p = ((v - min) % period + period) % period;
|
|
280
869
|
return min + (p < range ? p : period - p);
|
|
281
870
|
}
|
|
871
|
+
function catmullRom(p0, p1, p2, p3, u) {
|
|
872
|
+
const u2 = u * u;
|
|
873
|
+
const u3 = u2 * u;
|
|
874
|
+
return 0.5 * (2 * p1 + (-p0 + p2) * u + (2 * p0 - 5 * p1 + 4 * p2 - p3) * u2 + (-p0 + 3 * p1 - 3 * p2 + p3) * u3);
|
|
875
|
+
}
|
|
876
|
+
function pathPosition(e, t) {
|
|
877
|
+
const p = e.path;
|
|
878
|
+
const n = p.pts.length;
|
|
879
|
+
let s = (t / p.duration + p.phase) % 1;
|
|
880
|
+
if (s < 0) s += 1;
|
|
881
|
+
if (!p.closed) {
|
|
882
|
+
const pp = s * 2;
|
|
883
|
+
s = pp < 1 ? pp : 2 - pp;
|
|
884
|
+
}
|
|
885
|
+
const segs = p.closed ? n : n - 1;
|
|
886
|
+
const u = Math.min(s * segs, segs - 1e-9);
|
|
887
|
+
const i = Math.floor(u);
|
|
888
|
+
const local = u - i;
|
|
889
|
+
const at = (k) => p.closed ? p.pts[(k % n + n) % n] : p.pts[Math.max(0, Math.min(n - 1, k))];
|
|
890
|
+
const p1 = at(i);
|
|
891
|
+
const p2 = at(i + 1);
|
|
892
|
+
if (!p.smooth) {
|
|
893
|
+
return {
|
|
894
|
+
x: p1.x + (p2.x - p1.x) * local + p.offX,
|
|
895
|
+
y: p1.y + (p2.y - p1.y) * local + p.offY
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
const p0 = at(i - 1);
|
|
899
|
+
const p3 = at(i + 2);
|
|
900
|
+
return {
|
|
901
|
+
x: catmullRom(p0.x, p1.x, p2.x, p3.x, local) + p.offX,
|
|
902
|
+
y: catmullRom(p0.y, p1.y, p2.y, p3.y, local) + p.offY
|
|
903
|
+
};
|
|
904
|
+
}
|
|
282
905
|
function positionAt(e, t, w, h) {
|
|
283
906
|
if (e.motion === "static") return { x: e.x0, y: e.y0, flip: false };
|
|
907
|
+
if (e.motion === "orbit") {
|
|
908
|
+
const angle = e.phase + e.vx * Math.PI / 180 * (t / 1e3);
|
|
909
|
+
return {
|
|
910
|
+
x: e.orbitCx + e.orbitR * Math.cos(angle),
|
|
911
|
+
y: e.orbitCy + e.orbitR * Math.sin(angle),
|
|
912
|
+
flip: false
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
if (e.motion === "warp") {
|
|
916
|
+
const wp = e.warp;
|
|
917
|
+
const persp = 1 / warpZ(e, t);
|
|
918
|
+
const halfMin = Math.min(w, h) / 2;
|
|
919
|
+
return {
|
|
920
|
+
x: wp.cx + wp.ux * halfMin * persp,
|
|
921
|
+
y: wp.cy + wp.uy * halfMin * persp,
|
|
922
|
+
flip: false
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
if (e.motion === "path") {
|
|
926
|
+
const pos = pathPosition(e, t);
|
|
927
|
+
return { x: pos.x, y: pos.y, flip: false };
|
|
928
|
+
}
|
|
284
929
|
const dt = t / 1e3;
|
|
285
930
|
const m = e.size;
|
|
286
931
|
if (e.motion === "bounce") {
|
|
@@ -297,11 +942,127 @@ function positionAt(e, t, w, h) {
|
|
|
297
942
|
flip: false
|
|
298
943
|
};
|
|
299
944
|
}
|
|
945
|
+
if (e.motion === "wander") {
|
|
946
|
+
const wp = e.wander;
|
|
947
|
+
const c = wp.coherence;
|
|
948
|
+
let hx = 0;
|
|
949
|
+
let hy = 0;
|
|
950
|
+
for (let i = 0; i < 3; i++) {
|
|
951
|
+
if (c < 1) {
|
|
952
|
+
hx += (1 - c) * wp.own.ax[i] * Math.sin(wp.own.fx[i] * t + wp.own.phx[i]);
|
|
953
|
+
hy += (1 - c) * wp.own.ay[i] * Math.sin(wp.own.fy[i] * t + wp.own.phy[i]);
|
|
954
|
+
}
|
|
955
|
+
if (c > 0) {
|
|
956
|
+
hx += c * wp.shared.ax[i] * Math.sin(wp.shared.fx[i] * t + wp.shared.phx[i]);
|
|
957
|
+
hy += c * wp.shared.ay[i] * Math.sin(wp.shared.fy[i] * t + wp.shared.phy[i]);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
const margin = m + wp.margin;
|
|
961
|
+
return {
|
|
962
|
+
x: wrap(e.x0 + e.vx * dt + hx, -margin, w + margin),
|
|
963
|
+
y: wrap(e.y0 + e.vy * dt + hy, -margin, h + margin),
|
|
964
|
+
flip: e.headingLeft
|
|
965
|
+
};
|
|
966
|
+
}
|
|
300
967
|
const x = wrap(e.x0 + e.vx * dt, -m, w + m);
|
|
301
968
|
let y = e.vy !== 0 ? wrap(e.y0 + e.vy * dt, -m, h + m) : e.y0;
|
|
302
969
|
if (e.bob) y += e.bob * Math.sin(t / 500 + e.phase);
|
|
303
970
|
return { x, y, flip: e.headingLeft };
|
|
304
971
|
}
|
|
972
|
+
function headingAt(e, t, w, h) {
|
|
973
|
+
const dtMs = 32;
|
|
974
|
+
const t1 = t < dtMs ? t + dtMs : t;
|
|
975
|
+
const t0 = t1 - dtMs;
|
|
976
|
+
const a = positionAt(e, t0, w, h);
|
|
977
|
+
const b = positionAt(e, t1, w, h);
|
|
978
|
+
const dx = b.x - a.x;
|
|
979
|
+
const dy = b.y - a.y;
|
|
980
|
+
if (Math.abs(dx) > w / 2 || Math.abs(dy) > h / 2) return null;
|
|
981
|
+
if (dx === 0 && dy === 0) return null;
|
|
982
|
+
return Math.atan2(dy, dx);
|
|
983
|
+
}
|
|
984
|
+
function spriteIndexAt(e, t, variants) {
|
|
985
|
+
if (!e.cyclePeriod || variants <= 1) return e.spriteIndex;
|
|
986
|
+
return Math.floor(t / e.cyclePeriod + e.phase / (2 * Math.PI)) % variants;
|
|
987
|
+
}
|
|
988
|
+
function wrapDist(pi, pj, doWrap, w, h) {
|
|
989
|
+
let dx = pj.x - pi.x;
|
|
990
|
+
let dy = pj.y - pi.y;
|
|
991
|
+
if (doWrap) {
|
|
992
|
+
if (Math.abs(dx) > w / 2) dx = dx > 0 ? dx - w : dx + w;
|
|
993
|
+
if (Math.abs(dy) > h / 2) dy = dy > 0 ? dy - h : dy + h;
|
|
994
|
+
}
|
|
995
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
996
|
+
}
|
|
997
|
+
function linkEdges(links, positions, maxDistPx, doWrap, w, h) {
|
|
998
|
+
const n = positions.length;
|
|
999
|
+
const mode = links.mode ?? "nearest";
|
|
1000
|
+
if (mode === "chain") {
|
|
1001
|
+
const out = [];
|
|
1002
|
+
for (let i = 0; i < n - 1; i++) {
|
|
1003
|
+
out.push({ i, j: i + 1, dist: wrapDist(positions[i], positions[i + 1], doWrap, w, h) });
|
|
1004
|
+
}
|
|
1005
|
+
if (links.closed && n > 2) out.push({ i: n - 1, j: 0, dist: wrapDist(positions[n - 1], positions[0], doWrap, w, h) });
|
|
1006
|
+
return out;
|
|
1007
|
+
}
|
|
1008
|
+
if (mode === "random") {
|
|
1009
|
+
const stride = Math.max(1, Math.round(n * 0.381966));
|
|
1010
|
+
const edges = /* @__PURE__ */ new Set();
|
|
1011
|
+
const out = [];
|
|
1012
|
+
for (let i = 0; i < n; i++) {
|
|
1013
|
+
for (let mIdx = 1; mIdx <= links.k; mIdx++) {
|
|
1014
|
+
const j = (i + mIdx * stride) % n;
|
|
1015
|
+
if (j === i) continue;
|
|
1016
|
+
const dist = wrapDist(positions[i], positions[j], doWrap, w, h);
|
|
1017
|
+
if (dist > maxDistPx) continue;
|
|
1018
|
+
const key = `${Math.min(i, j)}:${Math.max(i, j)}`;
|
|
1019
|
+
if (!edges.has(key)) {
|
|
1020
|
+
edges.add(key);
|
|
1021
|
+
out.push({ i: Math.min(i, j), j: Math.max(i, j), dist });
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
return out;
|
|
1026
|
+
}
|
|
1027
|
+
return linkPairs(positions, links.k, maxDistPx, doWrap, w, h).map(([i, j]) => ({
|
|
1028
|
+
i,
|
|
1029
|
+
j,
|
|
1030
|
+
dist: wrapDist(positions[i], positions[j], doWrap, w, h)
|
|
1031
|
+
}));
|
|
1032
|
+
}
|
|
1033
|
+
function linkPairs(positions, k, maxDist, doWrap, w, h) {
|
|
1034
|
+
const n = positions.length;
|
|
1035
|
+
const edges = /* @__PURE__ */ new Set();
|
|
1036
|
+
const out = [];
|
|
1037
|
+
for (let i = 0; i < n; i++) {
|
|
1038
|
+
const pi = positions[i];
|
|
1039
|
+
const neighbors = [];
|
|
1040
|
+
for (let j = 0; j < n; j++) {
|
|
1041
|
+
if (i === j) continue;
|
|
1042
|
+
const pj = positions[j];
|
|
1043
|
+
let dx = pj.x - pi.x;
|
|
1044
|
+
let dy = pj.y - pi.y;
|
|
1045
|
+
if (doWrap) {
|
|
1046
|
+
if (Math.abs(dx) > w / 2) dx = dx > 0 ? dx - w : dx + w;
|
|
1047
|
+
if (Math.abs(dy) > h / 2) dy = dy > 0 ? dy - h : dy + h;
|
|
1048
|
+
}
|
|
1049
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
1050
|
+
if (dist <= maxDist) neighbors.push({ dist, j });
|
|
1051
|
+
}
|
|
1052
|
+
neighbors.sort((a, b) => a.dist - b.dist || a.j - b.j);
|
|
1053
|
+
for (let ni = 0; ni < Math.min(k, neighbors.length); ni++) {
|
|
1054
|
+
const j = neighbors[ni].j;
|
|
1055
|
+
const lo = Math.min(i, j);
|
|
1056
|
+
const hi = Math.max(i, j);
|
|
1057
|
+
const key = `${lo}:${hi}`;
|
|
1058
|
+
if (!edges.has(key)) {
|
|
1059
|
+
edges.add(key);
|
|
1060
|
+
out.push([lo, hi]);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
return out;
|
|
1065
|
+
}
|
|
305
1066
|
var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
306
1067
|
function resolveSpecPath(spec, path) {
|
|
307
1068
|
if (!spec || typeof spec !== "object" || !path) return null;
|
|
@@ -373,22 +1134,35 @@ function easeSmooth(k) {
|
|
|
373
1134
|
return c * c * (3 - 2 * c);
|
|
374
1135
|
}
|
|
375
1136
|
function structuralSignature(spec) {
|
|
376
|
-
return JSON.stringify(
|
|
377
|
-
spec.
|
|
378
|
-
|
|
379
|
-
l.
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
1137
|
+
return JSON.stringify([
|
|
1138
|
+
spec.units,
|
|
1139
|
+
spec.layers.map((l) => {
|
|
1140
|
+
const s = l.sprite;
|
|
1141
|
+
return [
|
|
1142
|
+
l.count,
|
|
1143
|
+
l.size,
|
|
1144
|
+
l.region,
|
|
1145
|
+
l.position,
|
|
1146
|
+
l.motion,
|
|
1147
|
+
l.wrap,
|
|
1148
|
+
l.flip,
|
|
1149
|
+
l.alpha,
|
|
1150
|
+
l.pulse,
|
|
1151
|
+
l.spin,
|
|
1152
|
+
l.grow,
|
|
1153
|
+
l.layout,
|
|
1154
|
+
l.sprite.kind,
|
|
1155
|
+
// Dimensional draws baked into entities: radius (circle/ring), length
|
|
1156
|
+
// (streak), width+aspect (rect), palette pick (all shaped sprites).
|
|
1157
|
+
s.radius,
|
|
1158
|
+
s.length,
|
|
1159
|
+
l.sprite.kind === "rect" ? [s.width, s.aspect] : void 0,
|
|
1160
|
+
Array.isArray(s.colors) ? s.colors.length : void 0,
|
|
1161
|
+
s.colorWeights,
|
|
1162
|
+
l.sprite.kind === "emoji" ? [l.sprite.glyphs.length, l.sprite.cycle?.period] : l.sprite.kind === "text" ? [l.sprite.strings.length, l.sprite.cycle?.period] : void 0
|
|
1163
|
+
];
|
|
1164
|
+
})
|
|
1165
|
+
]);
|
|
392
1166
|
}
|
|
393
1167
|
var DEFAULT_STEER_DUR = 1e3;
|
|
394
1168
|
function hexToRgba(hex, alpha) {
|
|
@@ -396,6 +1170,17 @@ function hexToRgba(hex, alpha) {
|
|
|
396
1170
|
const n = parseInt(h.slice(1), 16);
|
|
397
1171
|
return `rgba(${n >> 16 & 255},${n >> 8 & 255},${n & 255},${alpha})`;
|
|
398
1172
|
}
|
|
1173
|
+
var FONT_PREFIX_RE = /^((?:(?:italic|oblique|bold|bolder|lighter|normal|\d{3})\s+)+)/;
|
|
1174
|
+
var FONT_PX_RE = /(\d*\.?\d+)px/;
|
|
1175
|
+
function scaleFontPx(font, factor) {
|
|
1176
|
+
if (factor === 1) return font;
|
|
1177
|
+
return font.replace(FONT_PX_RE, (_m, n) => `${(Number(n) * factor).toFixed(2)}px`);
|
|
1178
|
+
}
|
|
1179
|
+
function composeFontShorthand(sz, font) {
|
|
1180
|
+
const m = FONT_PREFIX_RE.exec(font);
|
|
1181
|
+
if (m) return `${m[1].trim()} ${sz}px ${font.slice(m[0].length)}`;
|
|
1182
|
+
return `${sz}px ${font}`;
|
|
1183
|
+
}
|
|
399
1184
|
function manifestFor(spec) {
|
|
400
1185
|
const total = spec.layers.reduce((n, l) => n + l.count, 0);
|
|
401
1186
|
const costTier = total < 30 ? "idle" : total < 150 ? "low" : total < 400 ? "medium" : "high";
|
|
@@ -455,21 +1240,36 @@ var SpecInstance = class {
|
|
|
455
1240
|
baseT = 0;
|
|
456
1241
|
// elapsed logical time carried across pause/resume
|
|
457
1242
|
lastT = 0;
|
|
1243
|
+
/** Last time painted — detects non-contiguous seeks for the ghosting warm-up replay. */
|
|
1244
|
+
lastRenderT = Number.NEGATIVE_INFINITY;
|
|
458
1245
|
/** The spec currently being rendered (base spec + any applied steering). */
|
|
459
1246
|
effSpec;
|
|
460
1247
|
/** Active glide between two resolved specs (live setParam/applyTrack). */
|
|
461
1248
|
transition = null;
|
|
462
1249
|
lastStructural = "";
|
|
1250
|
+
/** Viewport factor for absolute px sizes — 1 for `units: 'px'` specs. */
|
|
1251
|
+
fontScale() {
|
|
1252
|
+
if (this.effSpec.units === "px") return 1;
|
|
1253
|
+
return Math.min(this.w, this.h) / (this.effSpec.referenceViewport ?? LIMITS.referenceViewport);
|
|
1254
|
+
}
|
|
463
1255
|
sizeCanvas() {
|
|
464
1256
|
const dpr = Math.min(this.saverCtx.dpr, 2);
|
|
465
1257
|
this.canvas.width = Math.max(1, Math.round(this.w * dpr));
|
|
466
1258
|
this.canvas.height = Math.max(1, Math.round(this.h * dpr));
|
|
467
1259
|
this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
1260
|
+
this.lastRenderT = Number.NEGATIVE_INFINITY;
|
|
468
1261
|
}
|
|
469
|
-
/** (Re)seed and place all entities — deterministic for the seed +
|
|
1262
|
+
/** (Re)seed and place all entities — deterministic for the seed + viewport. */
|
|
470
1263
|
rebuild() {
|
|
471
1264
|
const rng = createRng(this.seed);
|
|
472
|
-
|
|
1265
|
+
const scale = this.effSpec.units === "px" ? 1 : Math.min(this.w, this.h);
|
|
1266
|
+
const refVp = this.effSpec.referenceViewport ?? LIMITS.referenceViewport;
|
|
1267
|
+
let countScale = scale > 1 ? Math.min(this.w, this.h) / refVp : 1;
|
|
1268
|
+
if (countScale > 1) {
|
|
1269
|
+
const rawTotal = this.effSpec.layers.reduce((s, l) => s + Math.round(l.count * countScale), 0);
|
|
1270
|
+
if (rawTotal > LIMITS.maxTotal) countScale *= LIMITS.maxTotal / rawTotal;
|
|
1271
|
+
}
|
|
1272
|
+
this.layers = this.effSpec.layers.map((layer) => ({ layer, entities: buildEntities(layer, rng, this.w, this.h, scale, countScale) }));
|
|
473
1273
|
this.lastStructural = structuralSignature(this.effSpec);
|
|
474
1274
|
}
|
|
475
1275
|
start() {
|
|
@@ -490,7 +1290,7 @@ var SpecInstance = class {
|
|
|
490
1290
|
this.lastT = now - this.startT + this.baseT;
|
|
491
1291
|
this.renderFrame(this.lastT, this.seed);
|
|
492
1292
|
}
|
|
493
|
-
drawBackground() {
|
|
1293
|
+
drawBackground(t) {
|
|
494
1294
|
const { ctx, w, h } = this;
|
|
495
1295
|
const bg = this.effSpec.background;
|
|
496
1296
|
if (!bg || bg.type === "solid") {
|
|
@@ -499,50 +1299,179 @@ var SpecInstance = class {
|
|
|
499
1299
|
return;
|
|
500
1300
|
}
|
|
501
1301
|
const g = ctx.createLinearGradient(0, 0, 0, h);
|
|
502
|
-
|
|
1302
|
+
const drift = bg.drift;
|
|
1303
|
+
for (let i = 0; i < bg.stops.length; i++) {
|
|
1304
|
+
const s = bg.stops[i];
|
|
1305
|
+
let at = s.at;
|
|
1306
|
+
if (drift) {
|
|
1307
|
+
const amount = drift.amount ?? 0.15;
|
|
1308
|
+
const phase = i / bg.stops.length * Math.PI * 2;
|
|
1309
|
+
at = Math.max(0, Math.min(1, at + amount * Math.sin(t * 2 * Math.PI / drift.period + phase)));
|
|
1310
|
+
}
|
|
1311
|
+
g.addColorStop(at, s.color);
|
|
1312
|
+
}
|
|
503
1313
|
ctx.fillStyle = g;
|
|
504
1314
|
ctx.fillRect(0, 0, w, h);
|
|
505
1315
|
if (bg.band) {
|
|
506
1316
|
ctx.fillStyle = bg.band.color;
|
|
507
|
-
|
|
1317
|
+
const bh = bg.band.height * (this.effSpec.units === "px" ? 1 : Math.min(w, h));
|
|
1318
|
+
ctx.fillRect(0, h - bh, w, bh);
|
|
508
1319
|
}
|
|
509
1320
|
}
|
|
510
|
-
|
|
511
|
-
|
|
1321
|
+
/** Position with parent-orbit resolution: a layer-parented orbit entity's
|
|
1322
|
+
* positionAt is an offset around (0,0); add the parent's own analytic position. */
|
|
1323
|
+
entityPos(e, t, parentE) {
|
|
512
1324
|
const p = positionAt(e, t, this.w, this.h);
|
|
1325
|
+
if (parentE && e.orbitParent) {
|
|
1326
|
+
const pp = positionAt(parentE, t, this.w, this.h);
|
|
1327
|
+
p.x += pp.x;
|
|
1328
|
+
p.y += pp.y;
|
|
1329
|
+
}
|
|
1330
|
+
return p;
|
|
1331
|
+
}
|
|
1332
|
+
/** Resolve the single parent entity for a layer-parented orbit layer (or null). */
|
|
1333
|
+
parentEntityFor(built) {
|
|
1334
|
+
const m = built.layer.motion;
|
|
1335
|
+
if (m.type !== "orbit" || !m.center || !("layer" in m.center)) return null;
|
|
1336
|
+
const key = m.center.layer;
|
|
1337
|
+
const parent = this.layers.find((b) => b.layer.key === key);
|
|
1338
|
+
return parent?.entities[0] ?? null;
|
|
1339
|
+
}
|
|
1340
|
+
drawTrail(built, e, t, lifeA, parentE) {
|
|
1341
|
+
const trail = built.layer.trail;
|
|
1342
|
+
if (!trail) return;
|
|
1343
|
+
const { ctx, w, h } = this;
|
|
1344
|
+
const fade = trail.fade ?? 1;
|
|
1345
|
+
const n = Math.min(Math.ceil(trail.length / 50), LIMITS.maxTrailSamples);
|
|
1346
|
+
const headAlpha = alphaAt(e, t) * lifeA;
|
|
1347
|
+
const headSize = sizeAt(e, t);
|
|
1348
|
+
const sprite = built.layer.sprite;
|
|
1349
|
+
const resolvedColor = sprite.kind === "circle" || sprite.kind === "ring" || sprite.kind === "streak" || sprite.kind === "rect" ? sprite.colors?.[e.colorIndex] ?? sprite.color : sprite.kind === "text" ? sprite.color ?? "#e6e8ef" : "#e6e8ef";
|
|
1350
|
+
const isSoft = sprite.kind === "circle" && sprite.soft;
|
|
1351
|
+
const wrap2 = built.layer.wrap !== false;
|
|
1352
|
+
const head = this.entityPos(e, t, parentE);
|
|
1353
|
+
let prevX = head.x;
|
|
1354
|
+
let prevY = head.y;
|
|
1355
|
+
for (let s = 1; s <= n; s++) {
|
|
1356
|
+
const k = s / n;
|
|
1357
|
+
const pastT = t - k * trail.length;
|
|
1358
|
+
if (pastT < 0) break;
|
|
1359
|
+
const pos = this.entityPos(e, pastT, parentE);
|
|
1360
|
+
if (wrap2) {
|
|
1361
|
+
const dx = pos.x - prevX;
|
|
1362
|
+
const dy = pos.y - prevY;
|
|
1363
|
+
if (Math.abs(dx) > w / 2 || Math.abs(dy) > h / 2) break;
|
|
1364
|
+
}
|
|
1365
|
+
prevX = pos.x;
|
|
1366
|
+
prevY = pos.y;
|
|
1367
|
+
const a = headAlpha * (1 - k * fade);
|
|
1368
|
+
if (a <= 0) break;
|
|
1369
|
+
const r = headSize / 2 * (1 - k * 0.7);
|
|
1370
|
+
if (r < 0.2) break;
|
|
1371
|
+
ctx.globalAlpha = a;
|
|
1372
|
+
if (isSoft) {
|
|
1373
|
+
const g = ctx.createRadialGradient(pos.x, pos.y, 0, pos.x, pos.y, r);
|
|
1374
|
+
g.addColorStop(0, resolvedColor);
|
|
1375
|
+
g.addColorStop(0.35, hexToRgba(resolvedColor, 0.75));
|
|
1376
|
+
g.addColorStop(1, hexToRgba(resolvedColor, 0));
|
|
1377
|
+
ctx.fillStyle = g;
|
|
1378
|
+
} else {
|
|
1379
|
+
ctx.fillStyle = resolvedColor;
|
|
1380
|
+
}
|
|
1381
|
+
ctx.beginPath();
|
|
1382
|
+
ctx.arc(pos.x, pos.y, r, 0, Math.PI * 2);
|
|
1383
|
+
ctx.fill();
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
drawEntity(built, e, t, lifeA, parentE) {
|
|
1387
|
+
const { ctx } = this;
|
|
1388
|
+
const p = this.entityPos(e, t, parentE);
|
|
513
1389
|
const sprite = built.layer.sprite;
|
|
514
|
-
|
|
1390
|
+
const sz = sizeAt(e, t);
|
|
1391
|
+
const rot = rotationAt(e, t);
|
|
1392
|
+
const unitScale = this.effSpec.units === "px" ? 1 : Math.min(this.w, this.h);
|
|
1393
|
+
ctx.globalAlpha = alphaAt(e, t) * lifeA;
|
|
1394
|
+
if (sprite.kind === "ring") {
|
|
1395
|
+
const r = sz / 2;
|
|
1396
|
+
const resolvedColor = sprite.colors?.[e.colorIndex] ?? sprite.color;
|
|
1397
|
+
ctx.strokeStyle = resolvedColor;
|
|
1398
|
+
ctx.lineWidth = Math.max(0.5, (sprite.width ?? (unitScale === 1 ? 2 : 2e-3)) * unitScale);
|
|
1399
|
+
ctx.beginPath();
|
|
1400
|
+
ctx.arc(p.x, p.y, r, 0, Math.PI * 2);
|
|
1401
|
+
ctx.stroke();
|
|
1402
|
+
return;
|
|
1403
|
+
}
|
|
1404
|
+
if (sprite.kind === "streak") {
|
|
1405
|
+
const resolvedColor = sprite.colors?.[e.colorIndex] ?? sprite.color;
|
|
1406
|
+
const heading = headingAt(e, t, this.w, this.h) ?? 0;
|
|
1407
|
+
const tailX = p.x - Math.cos(heading) * sz;
|
|
1408
|
+
const tailY = p.y - Math.sin(heading) * sz;
|
|
1409
|
+
const g = ctx.createLinearGradient(tailX, tailY, p.x, p.y);
|
|
1410
|
+
g.addColorStop(0, hexToRgba(resolvedColor, 0));
|
|
1411
|
+
g.addColorStop(1, resolvedColor);
|
|
1412
|
+
ctx.strokeStyle = g;
|
|
1413
|
+
ctx.lineWidth = Math.max(0.5, (sprite.width ?? (unitScale === 1 ? 2 : 2e-3)) * unitScale);
|
|
1414
|
+
ctx.lineCap = "round";
|
|
1415
|
+
ctx.beginPath();
|
|
1416
|
+
ctx.moveTo(tailX, tailY);
|
|
1417
|
+
ctx.lineTo(p.x, p.y);
|
|
1418
|
+
ctx.stroke();
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
if (sprite.kind === "rect") {
|
|
1422
|
+
const resolvedColor = sprite.colors?.[e.colorIndex] ?? sprite.color;
|
|
1423
|
+
const rh = e.size2 !== void 0 ? e.size2 * (e.size > 0 ? sz / e.size : 1) : sz;
|
|
1424
|
+
ctx.save();
|
|
1425
|
+
ctx.translate(p.x, p.y);
|
|
1426
|
+
if (rot) ctx.rotate(rot);
|
|
1427
|
+
ctx.fillStyle = resolvedColor;
|
|
1428
|
+
ctx.fillRect(-sz / 2, -rh / 2, sz, rh);
|
|
1429
|
+
ctx.restore();
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
515
1432
|
if (sprite.kind === "circle") {
|
|
516
|
-
const r =
|
|
1433
|
+
const r = sz / 2;
|
|
1434
|
+
const resolvedColor = sprite.colors?.[e.colorIndex] ?? sprite.color;
|
|
1435
|
+
ctx.save();
|
|
1436
|
+
if (rot) {
|
|
1437
|
+
ctx.translate(p.x, p.y);
|
|
1438
|
+
ctx.rotate(rot);
|
|
1439
|
+
ctx.translate(-p.x, -p.y);
|
|
1440
|
+
}
|
|
517
1441
|
if (sprite.soft) {
|
|
518
1442
|
const g = ctx.createRadialGradient(p.x, p.y, 0, p.x, p.y, r);
|
|
519
|
-
g.addColorStop(0,
|
|
520
|
-
g.addColorStop(0.35, hexToRgba(
|
|
521
|
-
g.addColorStop(1, hexToRgba(
|
|
1443
|
+
g.addColorStop(0, resolvedColor);
|
|
1444
|
+
g.addColorStop(0.35, hexToRgba(resolvedColor, 0.75));
|
|
1445
|
+
g.addColorStop(1, hexToRgba(resolvedColor, 0));
|
|
522
1446
|
ctx.fillStyle = g;
|
|
523
1447
|
} else {
|
|
524
|
-
ctx.fillStyle =
|
|
1448
|
+
ctx.fillStyle = resolvedColor;
|
|
525
1449
|
}
|
|
526
1450
|
ctx.beginPath();
|
|
527
1451
|
ctx.arc(p.x, p.y, r, 0, Math.PI * 2);
|
|
528
1452
|
ctx.fill();
|
|
1453
|
+
ctx.restore();
|
|
529
1454
|
return;
|
|
530
1455
|
}
|
|
531
1456
|
ctx.save();
|
|
532
1457
|
ctx.translate(p.x, p.y);
|
|
1458
|
+
if (rot) ctx.rotate(rot);
|
|
533
1459
|
if (p.flip && built.layer.flip) ctx.scale(-1, 1);
|
|
534
1460
|
ctx.textAlign = "center";
|
|
535
1461
|
ctx.textBaseline = "middle";
|
|
536
1462
|
if (sprite.kind === "emoji") {
|
|
537
|
-
|
|
538
|
-
ctx.
|
|
1463
|
+
const idx = spriteIndexAt(e, t, sprite.glyphs.length);
|
|
1464
|
+
ctx.font = `${sz}px serif`;
|
|
1465
|
+
ctx.fillText(sprite.glyphs[idx] ?? sprite.glyphs[0], 0, 0);
|
|
539
1466
|
} else {
|
|
540
1467
|
ctx.textAlign = sprite.align ?? "center";
|
|
541
1468
|
ctx.textBaseline = sprite.baseline ?? "middle";
|
|
542
|
-
ctx.font = sprite.font
|
|
1469
|
+
ctx.font = sprite.font ? FONT_PX_RE.test(sprite.font) ? scaleFontPx(sprite.font, this.fontScale()) : composeFontShorthand(sz, sprite.font) : `${sz}px system-ui, sans-serif`;
|
|
543
1470
|
ctx.fillStyle = sprite.color ?? "#e6e8ef";
|
|
544
|
-
const
|
|
545
|
-
|
|
1471
|
+
const idx = spriteIndexAt(e, t, sprite.strings.length);
|
|
1472
|
+
const text = sprite.strings[idx] ?? sprite.strings[0];
|
|
1473
|
+
const mw = sprite.maxWidth ? sprite.maxWidth * (this.effSpec.units === "px" ? 1 : Math.min(this.w, this.h)) : void 0;
|
|
1474
|
+
if (mw) ctx.fillText(text, 0, 0, mw);
|
|
546
1475
|
else ctx.fillText(text, 0, 0);
|
|
547
1476
|
}
|
|
548
1477
|
ctx.restore();
|
|
@@ -585,20 +1514,96 @@ var SpecInstance = class {
|
|
|
585
1514
|
this.renderFrame(this.lastT, this.seed);
|
|
586
1515
|
}
|
|
587
1516
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
1517
|
+
drawLinks(built, t, lifeA, parentE) {
|
|
1518
|
+
const { links } = built.layer;
|
|
1519
|
+
if (!links) return;
|
|
591
1520
|
const { ctx } = this;
|
|
592
|
-
|
|
1521
|
+
const motionWraps = ["drift", "rise", "wander"].includes(built.layer.motion.type);
|
|
1522
|
+
const wrap2 = built.layer.wrap !== false && motionWraps;
|
|
1523
|
+
const positions = built.entities.map((e) => this.entityPos(e, t, parentE));
|
|
1524
|
+
const maxDistPx = links.maxDist * (this.effSpec.units === "px" ? 1 : Math.min(this.w, this.h));
|
|
1525
|
+
const edges = linkEdges(links, positions, maxDistPx, wrap2, this.w, this.h);
|
|
1526
|
+
const lw = (links.width ?? 1) * (this.effSpec.units === "px" ? 1 : Math.min(this.w, this.h));
|
|
1527
|
+
ctx.lineWidth = lw;
|
|
1528
|
+
ctx.lineCap = "butt";
|
|
1529
|
+
for (const { i, j, dist } of edges) {
|
|
1530
|
+
const pi = positions[i];
|
|
1531
|
+
const pj = positions[j];
|
|
1532
|
+
const ei = built.entities[i];
|
|
1533
|
+
let resolvedColor = links.color;
|
|
1534
|
+
if (!resolvedColor) {
|
|
1535
|
+
const sprite = built.layer.sprite;
|
|
1536
|
+
if (sprite.kind === "circle" || sprite.kind === "ring" || sprite.kind === "streak" || sprite.kind === "rect") {
|
|
1537
|
+
resolvedColor = sprite.colors?.[ei.colorIndex] ?? sprite.color;
|
|
1538
|
+
} else resolvedColor = "#e6e8ef";
|
|
1539
|
+
}
|
|
1540
|
+
let a = links.alpha ?? alphaAt(ei, t);
|
|
1541
|
+
if (links.falloff) a *= Math.max(0, 1 - dist / maxDistPx);
|
|
1542
|
+
ctx.globalAlpha = a * lifeA;
|
|
1543
|
+
ctx.strokeStyle = resolvedColor;
|
|
1544
|
+
let dx = pj.x - pi.x;
|
|
1545
|
+
let dy = pj.y - pi.y;
|
|
1546
|
+
if (wrap2) {
|
|
1547
|
+
if (Math.abs(dx) > this.w / 2) dx = dx > 0 ? dx - this.w : dx + this.w;
|
|
1548
|
+
if (Math.abs(dy) > this.h / 2) dy = dy > 0 ? dy - this.h : dy + this.h;
|
|
1549
|
+
}
|
|
1550
|
+
ctx.beginPath();
|
|
1551
|
+
ctx.moveTo(pi.x, pi.y);
|
|
1552
|
+
ctx.lineTo(pi.x + dx, pi.y + dy);
|
|
1553
|
+
ctx.stroke();
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
/** Paint one composite pass at time t. `bgAlpha` < 1 leaves the previous frame
|
|
1557
|
+
* showing through — the ghosting smear. */
|
|
1558
|
+
paintFrame(t, bgAlpha) {
|
|
1559
|
+
const { ctx } = this;
|
|
1560
|
+
ctx.globalAlpha = bgAlpha;
|
|
593
1561
|
ctx.globalCompositeOperation = "source-over";
|
|
594
|
-
this.drawBackground();
|
|
1562
|
+
this.drawBackground(t);
|
|
1563
|
+
ctx.globalAlpha = 1;
|
|
595
1564
|
for (const built of this.layers) {
|
|
1565
|
+
const lifeA = lifeAlphaAt(built.layer.life, t);
|
|
1566
|
+
if (lifeA <= 0) continue;
|
|
1567
|
+
const parentE = this.parentEntityFor(built);
|
|
596
1568
|
ctx.globalCompositeOperation = built.layer.blend ?? "source-over";
|
|
597
|
-
|
|
1569
|
+
this.drawLinks(built, t, lifeA, parentE);
|
|
1570
|
+
for (const e of built.entities) {
|
|
1571
|
+
this.drawTrail(built, e, t, lifeA, parentE);
|
|
1572
|
+
this.drawEntity(built, e, t, lifeA, parentE);
|
|
1573
|
+
}
|
|
598
1574
|
}
|
|
599
1575
|
ctx.globalAlpha = 1;
|
|
600
1576
|
ctx.globalCompositeOperation = "source-over";
|
|
601
1577
|
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Deterministic, frame-addressable render (shared by the rAF loop).
|
|
1580
|
+
*
|
|
1581
|
+
* With `ghosting` set, contiguous frames composite over the previous frame with a
|
|
1582
|
+
* refresh-rate-normalized fade. A non-contiguous seek (pause render, e2e frame
|
|
1583
|
+
* addressing) replays a bounded fixed-step warm-up from a full clear, so the
|
|
1584
|
+
* accumulated smear at time t is identical on every run — the determinism proof
|
|
1585
|
+
* survives statefulness because the "state" is reconstructed from pure history.
|
|
1586
|
+
*/
|
|
1587
|
+
renderFrame(t, _seed) {
|
|
1588
|
+
this.stepTransition(t);
|
|
1589
|
+
const g = this.effSpec.ghosting ?? 0;
|
|
1590
|
+
if (g > 0) {
|
|
1591
|
+
const dt = 1e3 / 60;
|
|
1592
|
+
const contiguous = this.lastRenderT !== Number.NEGATIVE_INFINITY && t > this.lastRenderT && t - this.lastRenderT <= 250;
|
|
1593
|
+
if (contiguous) {
|
|
1594
|
+
this.paintFrame(t, 1 - Math.pow(g, (t - this.lastRenderT) / dt));
|
|
1595
|
+
} else {
|
|
1596
|
+
const k = Math.min(Math.ceil(Math.log(1 / 255) / Math.log(g)), LIMITS.maxGhostReplayFrames);
|
|
1597
|
+
const t0 = Math.max(0, t - k * dt);
|
|
1598
|
+
this.paintFrame(t0, 1);
|
|
1599
|
+
for (let ft = t0 + dt; ft < t - dt / 2; ft += dt) this.paintFrame(ft, 1 - g);
|
|
1600
|
+
if (t > t0) this.paintFrame(t, 1 - g);
|
|
1601
|
+
}
|
|
1602
|
+
} else {
|
|
1603
|
+
this.paintFrame(t, 1);
|
|
1604
|
+
}
|
|
1605
|
+
this.lastRenderT = t;
|
|
1606
|
+
}
|
|
602
1607
|
setPaused(paused) {
|
|
603
1608
|
this.paused = paused;
|
|
604
1609
|
if (paused) {
|
|
@@ -628,6 +1633,12 @@ function compileSaver(spec) {
|
|
|
628
1633
|
spec: valid
|
|
629
1634
|
};
|
|
630
1635
|
}
|
|
1636
|
+
var DITHER = [
|
|
1637
|
+
[0.5 / 8, 4.5 / 8],
|
|
1638
|
+
[2.5 / 8, 6.5 / 8],
|
|
1639
|
+
[1.5 / 8, 5.5 / 8],
|
|
1640
|
+
[3.5 / 8, 7.5 / 8]
|
|
1641
|
+
];
|
|
631
1642
|
var AQUARIUM_SPEC = {
|
|
632
1643
|
schemaVersion: 1,
|
|
633
1644
|
id: "aquarium",
|
|
@@ -641,507 +1652,692 @@ var AQUARIUM_SPEC = {
|
|
|
641
1652
|
{ at: 0.6, color: "#062534" },
|
|
642
1653
|
{ at: 1, color: "#02141d" }
|
|
643
1654
|
],
|
|
644
|
-
band: { color: "#0b1a12", height:
|
|
1655
|
+
band: { color: "#0b1a12", height: 0.02222 }
|
|
645
1656
|
},
|
|
646
1657
|
layers: [
|
|
647
1658
|
{
|
|
648
1659
|
count: 14,
|
|
649
1660
|
sprite: { kind: "emoji", glyphs: ["\u{1F41F}", "\u{1F420}", "\u{1F421}", "\u{1F988}", "\u{1F419}"] },
|
|
650
|
-
size: [
|
|
651
|
-
motion: { type: "drift", speed: [
|
|
1661
|
+
size: [0.03148, 0.06667],
|
|
1662
|
+
motion: { type: "drift", speed: [0.02778, 0.1019], bidirectional: true, bob: 5556e-6 },
|
|
652
1663
|
flip: true
|
|
653
1664
|
},
|
|
654
1665
|
{
|
|
655
1666
|
count: 22,
|
|
656
|
-
sprite: { kind: "circle", radius: [
|
|
657
|
-
motion: { type: "rise", speed: [
|
|
1667
|
+
sprite: { kind: "circle", radius: [1852e-6, 6481e-6], color: "#c8ebff" },
|
|
1668
|
+
motion: { type: "rise", speed: [0.02222, 0.07222], sway: 7407e-6 }
|
|
658
1669
|
}
|
|
659
1670
|
]
|
|
660
1671
|
};
|
|
661
|
-
var
|
|
1672
|
+
var AURORA_SPEC = {
|
|
662
1673
|
schemaVersion: 1,
|
|
663
|
-
id: "
|
|
664
|
-
label: "
|
|
665
|
-
seed:
|
|
1674
|
+
id: "aurora",
|
|
1675
|
+
label: "Aurora",
|
|
1676
|
+
seed: 66,
|
|
666
1677
|
motionIntensity: "calm",
|
|
1678
|
+
ghosting: 0.85,
|
|
667
1679
|
background: {
|
|
668
1680
|
type: "gradient",
|
|
669
1681
|
stops: [
|
|
670
|
-
{ at: 0, color: "#
|
|
671
|
-
{ at: 0.
|
|
672
|
-
{ at: 1, color: "#
|
|
673
|
-
]
|
|
1682
|
+
{ at: 0, color: "#02030d" },
|
|
1683
|
+
{ at: 0.65, color: "#050a18" },
|
|
1684
|
+
{ at: 1, color: "#0a1220" }
|
|
1685
|
+
],
|
|
1686
|
+
drift: { period: 4e4, amount: 0.1 }
|
|
674
1687
|
},
|
|
675
1688
|
layers: [
|
|
676
|
-
// --- ambient depth ---
|
|
677
1689
|
{
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
motion: { type: "
|
|
1690
|
+
key: "stars",
|
|
1691
|
+
count: 110,
|
|
1692
|
+
sprite: { kind: "circle", radius: [5e-4, 15e-4], color: "#e8ecff", soft: true },
|
|
1693
|
+
motion: { type: "static" },
|
|
1694
|
+
region: { y: [0, 0.75] },
|
|
1695
|
+
alpha: [0.2, 0.6],
|
|
1696
|
+
// A slow shimmer travels across the sky instead of stars twinkling independently.
|
|
1697
|
+
pulse: { amp: 0.25, period: 6e3, wave: { wavelength: 0.5, angle: 15 } }
|
|
682
1698
|
},
|
|
683
1699
|
{
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
1700
|
+
key: "curtain-green",
|
|
1701
|
+
count: 100,
|
|
1702
|
+
sprite: {
|
|
1703
|
+
kind: "circle",
|
|
1704
|
+
radius: [0.055, 0.11],
|
|
1705
|
+
color: "#1fd68a",
|
|
1706
|
+
soft: true,
|
|
1707
|
+
colors: ["#1fd68a", "#2ee6c8", "#4bd1ff"],
|
|
1708
|
+
colorWeights: [5, 2, 1]
|
|
1709
|
+
},
|
|
1710
|
+
motion: { type: "wander", speed: [4e-3, 0.012], angle: 0, meander: 0.13, coherence: 0.7 },
|
|
1711
|
+
region: { y: [0.1, 0.42] },
|
|
1712
|
+
alpha: [0.04, 0.1],
|
|
687
1713
|
blend: "lighter",
|
|
688
|
-
|
|
689
|
-
motion: { type: "drift", speed: [0.5, 1.5], bob: 0.5 }
|
|
1714
|
+
grow: { amp: 0.25, period: 9e3 }
|
|
690
1715
|
},
|
|
691
|
-
// --- header ---
|
|
692
1716
|
{
|
|
693
|
-
key: "
|
|
694
|
-
count:
|
|
695
|
-
position: { x: 0.5, y: 0.04 },
|
|
1717
|
+
key: "curtain-violet",
|
|
1718
|
+
count: 60,
|
|
696
1719
|
sprite: {
|
|
697
|
-
kind: "
|
|
698
|
-
|
|
699
|
-
color: "#
|
|
700
|
-
|
|
701
|
-
|
|
1720
|
+
kind: "circle",
|
|
1721
|
+
radius: [0.045, 0.09],
|
|
1722
|
+
color: "#8d5bff",
|
|
1723
|
+
soft: true,
|
|
1724
|
+
colors: ["#8d5bff", "#d14bff", "#ff4bd8"],
|
|
1725
|
+
colorWeights: [4, 1.5, 0.5]
|
|
702
1726
|
},
|
|
703
|
-
motion: { type: "
|
|
1727
|
+
motion: { type: "wander", speed: [3e-3, 0.01], angle: 180, meander: 0.1, coherence: 0.55 },
|
|
1728
|
+
region: { y: [0.04, 0.28] },
|
|
1729
|
+
alpha: [0.03, 0.08],
|
|
1730
|
+
blend: "lighter",
|
|
1731
|
+
grow: { amp: 0.3, period: 12e3 }
|
|
704
1732
|
},
|
|
705
1733
|
{
|
|
706
|
-
key: "
|
|
707
|
-
count:
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
1734
|
+
key: "fireflies",
|
|
1735
|
+
count: 14,
|
|
1736
|
+
sprite: { kind: "circle", radius: [1e-3, 3e-3], color: "#b8ffe1", soft: true },
|
|
1737
|
+
motion: { type: "wander", speed: [6e-3, 0.02], meander: 0.06 },
|
|
1738
|
+
region: { y: [0.55, 0.95] },
|
|
1739
|
+
alpha: [0.2, 0.55],
|
|
1740
|
+
pulse: { amp: 0.3, period: 3500 },
|
|
1741
|
+
blend: "lighter"
|
|
1742
|
+
}
|
|
1743
|
+
]
|
|
1744
|
+
};
|
|
1745
|
+
var COMETS_SPEC = {
|
|
1746
|
+
schemaVersion: 1,
|
|
1747
|
+
id: "comets",
|
|
1748
|
+
label: "Comet Shower",
|
|
1749
|
+
seed: 42,
|
|
1750
|
+
motionIntensity: "moderate",
|
|
1751
|
+
background: {
|
|
1752
|
+
type: "gradient",
|
|
1753
|
+
stops: [
|
|
1754
|
+
{ at: 0, color: "#0a0015" },
|
|
1755
|
+
{ at: 0.5, color: "#0d1b2a" },
|
|
1756
|
+
{ at: 1, color: "#1b0a2e" }
|
|
1757
|
+
],
|
|
1758
|
+
drift: { period: 25e3, amount: 0.12 }
|
|
1759
|
+
},
|
|
1760
|
+
layers: [
|
|
1761
|
+
{
|
|
1762
|
+
key: "stars",
|
|
1763
|
+
count: 120,
|
|
1764
|
+
sprite: { kind: "circle", radius: [463e-6, 1852e-6], color: "#ffffff", soft: true },
|
|
1765
|
+
motion: { type: "static" },
|
|
1766
|
+
alpha: [0.3, 0.7],
|
|
1767
|
+
pulse: { amp: 0.15, period: 3e3 }
|
|
717
1768
|
},
|
|
718
1769
|
{
|
|
719
|
-
key: "
|
|
720
|
-
count:
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
1770
|
+
key: "comets",
|
|
1771
|
+
count: 8,
|
|
1772
|
+
sprite: { kind: "circle", radius: [2778e-6, 7407e-6], color: "#88ccff", soft: true },
|
|
1773
|
+
motion: { type: "drift", speed: [0.07407, 0.1852], angle: 225 },
|
|
1774
|
+
alpha: [0.7, 1],
|
|
1775
|
+
blend: "lighter",
|
|
1776
|
+
trail: { length: 1500, fade: 1 }
|
|
1777
|
+
},
|
|
1778
|
+
{
|
|
1779
|
+
key: "fireflies",
|
|
1780
|
+
count: 20,
|
|
1781
|
+
sprite: { kind: "circle", radius: [1852e-6, 463e-5], color: "#ffdd44", soft: true },
|
|
1782
|
+
motion: { type: "drift", speed: [9259e-6, 0.02778], bidirectional: true, bob: 0.01852 },
|
|
1783
|
+
alpha: [0.4, 0.8],
|
|
1784
|
+
pulse: { amp: 0.3, period: 2e3 },
|
|
1785
|
+
blend: "lighter",
|
|
1786
|
+
trail: { length: 800 }
|
|
1787
|
+
}
|
|
1788
|
+
]
|
|
1789
|
+
};
|
|
1790
|
+
var CONSTELLATION_SPEC = {
|
|
1791
|
+
schemaVersion: 1,
|
|
1792
|
+
id: "constellation",
|
|
1793
|
+
label: "Constellation",
|
|
1794
|
+
seed: 73,
|
|
1795
|
+
motionIntensity: "calm",
|
|
1796
|
+
background: {
|
|
1797
|
+
type: "gradient",
|
|
1798
|
+
stops: [
|
|
1799
|
+
{ at: 0, color: "#020212" },
|
|
1800
|
+
{ at: 0.5, color: "#050520" },
|
|
1801
|
+
{ at: 1, color: "#0a0830" }
|
|
1802
|
+
]
|
|
1803
|
+
},
|
|
1804
|
+
layers: [
|
|
1805
|
+
// Distant static stars (no links, just atmosphere)
|
|
1806
|
+
{
|
|
1807
|
+
count: 100,
|
|
1808
|
+
sprite: { kind: "circle", radius: [9259e-7, 2778e-6], color: "#667799", colors: ["#8899cc", "#99aadd", "#aabbee", "#7788aa"] },
|
|
1809
|
+
alpha: [0.2, 0.7],
|
|
1810
|
+
pulse: { amp: 0.2, period: 3e3 },
|
|
729
1811
|
motion: { type: "static" }
|
|
730
1812
|
},
|
|
731
|
-
//
|
|
1813
|
+
// Connected constellation nodes — slow drift, linked
|
|
732
1814
|
{
|
|
733
|
-
key: "
|
|
734
|
-
count:
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
1815
|
+
key: "nodes",
|
|
1816
|
+
count: 40,
|
|
1817
|
+
sprite: { kind: "circle", radius: [1852e-6, 463e-5], color: "#88aaff", colors: ["#88aaff", "#aaccff", "#ffcc88", "#ff8866"], soft: true },
|
|
1818
|
+
alpha: [0.5, 0.9],
|
|
1819
|
+
blend: "lighter",
|
|
1820
|
+
motion: { type: "drift", speed: [1852e-6, 7407e-6], bidirectional: true, bob: 2778e-6 },
|
|
1821
|
+
links: { k: 3, maxDist: 0.1852, alpha: 0.15, width: 463e-6 }
|
|
1822
|
+
},
|
|
1823
|
+
// Cycling asterism markers
|
|
1824
|
+
{
|
|
1825
|
+
count: 6,
|
|
1826
|
+
sprite: { kind: "emoji", glyphs: ["\u2726", "\u2727", "\u22C6", "\u2217"], cycle: { period: 2e3 } },
|
|
1827
|
+
size: [0.01296, 0.02037],
|
|
1828
|
+
alpha: [0.4, 0.7],
|
|
1829
|
+
motion: { type: "drift", speed: [9259e-7, 3704e-6], bidirectional: true }
|
|
1830
|
+
}
|
|
1831
|
+
]
|
|
1832
|
+
};
|
|
1833
|
+
var DASHBOARD_SPEC = {
|
|
1834
|
+
schemaVersion: 1,
|
|
1835
|
+
id: "dev-dashboard",
|
|
1836
|
+
label: "Control Center",
|
|
1837
|
+
seed: 256,
|
|
1838
|
+
motionIntensity: "calm",
|
|
1839
|
+
background: {
|
|
1840
|
+
type: "gradient",
|
|
1841
|
+
stops: [
|
|
1842
|
+
{ at: 0, color: "#05070d" },
|
|
1843
|
+
{ at: 0.55, color: "#080b14" },
|
|
1844
|
+
{ at: 1, color: "#0a0d18" }
|
|
1845
|
+
]
|
|
1846
|
+
},
|
|
1847
|
+
layers: [
|
|
1848
|
+
// ---- ambient: the LED wall behind everything ----
|
|
1849
|
+
{
|
|
1850
|
+
key: "led-wall",
|
|
1851
|
+
count: 240,
|
|
1852
|
+
sprite: { kind: "circle", radius: [7e-4, 11e-4], color: "#22344c" },
|
|
1853
|
+
alpha: [0.04, 0.1],
|
|
1854
|
+
layout: { type: "grid", columns: 24, jitter: 0.1 },
|
|
1855
|
+
pulse: { amp: 0.3, period: 6200, wave: { wavelength: 0.4, angle: 24 } },
|
|
744
1856
|
motion: { type: "static" }
|
|
745
1857
|
},
|
|
1858
|
+
// ---- frame chrome (boots first) ----
|
|
746
1859
|
{
|
|
747
|
-
key: "
|
|
1860
|
+
key: "rule-header",
|
|
748
1861
|
count: 1,
|
|
749
|
-
position: { x: 0.
|
|
750
|
-
sprite: {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
1862
|
+
position: { x: 0.5, y: 0.085 },
|
|
1863
|
+
sprite: { kind: "rect", width: [0.93, 0.93], aspect: [12e-4, 12e-4], color: "#24384f" },
|
|
1864
|
+
alpha: [0.8, 0.8],
|
|
1865
|
+
motion: { type: "static" },
|
|
1866
|
+
life: { enter: 100, fade: 400 }
|
|
1867
|
+
},
|
|
1868
|
+
{
|
|
1869
|
+
key: "rule-footer",
|
|
1870
|
+
count: 1,
|
|
1871
|
+
position: { x: 0.5, y: 0.915 },
|
|
1872
|
+
sprite: { kind: "rect", width: [0.93, 0.93], aspect: [12e-4, 12e-4], color: "#24384f" },
|
|
1873
|
+
alpha: [0.8, 0.8],
|
|
1874
|
+
motion: { type: "static" },
|
|
1875
|
+
life: { enter: 100, fade: 400 }
|
|
759
1876
|
},
|
|
760
1877
|
{
|
|
761
|
-
key: "
|
|
1878
|
+
key: "rule-col-left",
|
|
762
1879
|
count: 1,
|
|
763
|
-
position: { x: 0.
|
|
1880
|
+
position: { x: 0.265, y: 0.5 },
|
|
1881
|
+
sprite: { kind: "rect", width: [9e-4, 9e-4], aspect: [620, 620], color: "#1c2c40" },
|
|
1882
|
+
alpha: [0.7, 0.7],
|
|
1883
|
+
motion: { type: "static" },
|
|
1884
|
+
life: { enter: 100, fade: 400 }
|
|
1885
|
+
},
|
|
1886
|
+
{
|
|
1887
|
+
key: "rule-col-right",
|
|
1888
|
+
count: 1,
|
|
1889
|
+
position: { x: 0.645, y: 0.5 },
|
|
1890
|
+
sprite: { kind: "rect", width: [9e-4, 9e-4], aspect: [620, 620], color: "#1c2c40" },
|
|
1891
|
+
alpha: [0.7, 0.7],
|
|
1892
|
+
motion: { type: "static" },
|
|
1893
|
+
life: { enter: 100, fade: 400 }
|
|
1894
|
+
},
|
|
1895
|
+
// ---- header band ----
|
|
1896
|
+
{
|
|
1897
|
+
key: "title",
|
|
1898
|
+
count: 1,
|
|
1899
|
+
position: { x: 0.035, y: 0.052 },
|
|
764
1900
|
sprite: {
|
|
765
1901
|
kind: "text",
|
|
766
|
-
strings: ["
|
|
767
|
-
color: "#
|
|
768
|
-
font: "
|
|
769
|
-
align: "left"
|
|
770
|
-
baseline: "top"
|
|
1902
|
+
strings: ["VIREO-9 \xB7 TRANS-LUNAR RELAY \xB7 OPS WALL 03"],
|
|
1903
|
+
color: "#7f93ab",
|
|
1904
|
+
font: "600 13px 'SF Mono', monospace",
|
|
1905
|
+
align: "left"
|
|
771
1906
|
},
|
|
772
|
-
motion: { type: "static" }
|
|
1907
|
+
motion: { type: "static" },
|
|
1908
|
+
life: { enter: 200, fade: 600 }
|
|
773
1909
|
},
|
|
774
1910
|
{
|
|
775
|
-
key: "
|
|
1911
|
+
key: "clock",
|
|
776
1912
|
count: 1,
|
|
777
|
-
position: { x: 0.
|
|
1913
|
+
position: { x: 0.5, y: 0.058 },
|
|
778
1914
|
sprite: {
|
|
779
1915
|
kind: "text",
|
|
780
|
-
strings: ["
|
|
781
|
-
color: "#
|
|
782
|
-
font: "
|
|
783
|
-
align: "
|
|
784
|
-
baseline: "top"
|
|
1916
|
+
strings: ["04:17:26 UTC"],
|
|
1917
|
+
color: "#c8d4e4",
|
|
1918
|
+
font: "600 20px 'SF Mono', monospace",
|
|
1919
|
+
align: "center"
|
|
785
1920
|
},
|
|
786
|
-
motion: { type: "static" }
|
|
1921
|
+
motion: { type: "static" },
|
|
1922
|
+
life: { enter: 200, fade: 600 }
|
|
787
1923
|
},
|
|
788
1924
|
{
|
|
789
|
-
key: "
|
|
1925
|
+
key: "status",
|
|
790
1926
|
count: 1,
|
|
791
|
-
position: { x: 0.
|
|
1927
|
+
position: { x: 0.965, y: 0.052 },
|
|
792
1928
|
sprite: {
|
|
793
1929
|
kind: "text",
|
|
794
|
-
strings: ["
|
|
795
|
-
color: "#
|
|
796
|
-
font: "
|
|
797
|
-
align: "
|
|
798
|
-
baseline: "top"
|
|
1930
|
+
strings: ["\u25CF UPLINK LOCKED \xB7 WATCH C"],
|
|
1931
|
+
color: "#46d17a",
|
|
1932
|
+
font: "bold 11px 'SF Mono', monospace",
|
|
1933
|
+
align: "right"
|
|
799
1934
|
},
|
|
800
|
-
|
|
1935
|
+
pulse: { amp: 0.18, period: 2600 },
|
|
1936
|
+
motion: { type: "static" },
|
|
1937
|
+
life: { enter: 200, fade: 600 }
|
|
801
1938
|
},
|
|
1939
|
+
// ---- left column: arrays (boots second) ----
|
|
802
1940
|
{
|
|
803
|
-
key: "
|
|
1941
|
+
key: "dish1",
|
|
804
1942
|
count: 1,
|
|
805
|
-
position: { x: 0.
|
|
1943
|
+
position: { x: 0.035, y: 0.148 },
|
|
806
1944
|
sprite: {
|
|
807
1945
|
kind: "text",
|
|
808
|
-
strings: ["
|
|
809
|
-
color: "#
|
|
810
|
-
font: "
|
|
1946
|
+
strings: ["DSA-1 EAST AZ 214.6\xB0 EL 38.2\xB0"],
|
|
1947
|
+
color: "#9fb2c8",
|
|
1948
|
+
font: "11px 'SF Mono', monospace",
|
|
811
1949
|
align: "left",
|
|
812
1950
|
baseline: "top"
|
|
813
1951
|
},
|
|
814
|
-
motion: { type: "static" }
|
|
1952
|
+
motion: { type: "static" },
|
|
1953
|
+
life: { enter: 700, fade: 600 }
|
|
1954
|
+
},
|
|
1955
|
+
{
|
|
1956
|
+
key: "dish1-bars",
|
|
1957
|
+
count: 14,
|
|
1958
|
+
sprite: { kind: "rect", width: [38e-4, 38e-4], aspect: [0.5, 2.6], color: "#2ee6c8" },
|
|
1959
|
+
alpha: [0.3, 0.65],
|
|
1960
|
+
layout: { type: "grid", columns: 14 },
|
|
1961
|
+
region: { x: [0.035, 0.15], y: [0.183, 0.203] },
|
|
1962
|
+
pulse: { amp: 0.42, period: 1500, wave: { wavelength: 0.09, angle: 0 } },
|
|
1963
|
+
motion: { type: "static" },
|
|
1964
|
+
life: { enter: 700, fade: 600 }
|
|
815
1965
|
},
|
|
816
1966
|
{
|
|
817
|
-
key: "
|
|
1967
|
+
key: "dish2",
|
|
818
1968
|
count: 1,
|
|
819
|
-
position: { x: 0.
|
|
1969
|
+
position: { x: 0.035, y: 0.243 },
|
|
820
1970
|
sprite: {
|
|
821
1971
|
kind: "text",
|
|
822
|
-
strings: ["
|
|
823
|
-
color: "#
|
|
824
|
-
font: "
|
|
1972
|
+
strings: ["DSA-2 WEST AZ 097.1\xB0 EL 61.7\xB0"],
|
|
1973
|
+
color: "#9fb2c8",
|
|
1974
|
+
font: "11px 'SF Mono', monospace",
|
|
825
1975
|
align: "left",
|
|
826
1976
|
baseline: "top"
|
|
827
1977
|
},
|
|
828
|
-
motion: { type: "static" }
|
|
1978
|
+
motion: { type: "static" },
|
|
1979
|
+
life: { enter: 850, fade: 600 }
|
|
829
1980
|
},
|
|
830
1981
|
{
|
|
831
|
-
key: "
|
|
1982
|
+
key: "dish2-bars",
|
|
1983
|
+
count: 14,
|
|
1984
|
+
sprite: { kind: "rect", width: [38e-4, 38e-4], aspect: [0.5, 2.2], color: "#44aaff" },
|
|
1985
|
+
alpha: [0.3, 0.6],
|
|
1986
|
+
layout: { type: "grid", columns: 14 },
|
|
1987
|
+
region: { x: [0.035, 0.15], y: [0.278, 0.298] },
|
|
1988
|
+
pulse: { amp: 0.4, period: 1900, wave: { wavelength: 0.11, angle: 0 } },
|
|
1989
|
+
motion: { type: "static" },
|
|
1990
|
+
life: { enter: 850, fade: 600 }
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
key: "dish3",
|
|
832
1994
|
count: 1,
|
|
833
|
-
position: { x: 0.
|
|
1995
|
+
position: { x: 0.035, y: 0.338 },
|
|
834
1996
|
sprite: {
|
|
835
1997
|
kind: "text",
|
|
836
|
-
strings: ["
|
|
837
|
-
color: "#
|
|
838
|
-
font: "
|
|
1998
|
+
strings: ["DSA-3 POLAR AZ 002.4\xB0 EL 12.9\xB0 \u25B3 WIND"],
|
|
1999
|
+
color: "#5d7089",
|
|
2000
|
+
font: "11px 'SF Mono', monospace",
|
|
839
2001
|
align: "left",
|
|
840
2002
|
baseline: "top"
|
|
841
2003
|
},
|
|
842
|
-
motion: { type: "static" }
|
|
2004
|
+
motion: { type: "static" },
|
|
2005
|
+
life: { enter: 1e3, fade: 600 }
|
|
843
2006
|
},
|
|
844
|
-
// --- center column: system gauges ---
|
|
845
2007
|
{
|
|
846
|
-
key: "
|
|
847
|
-
count:
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
},
|
|
856
|
-
motion: { type: "static" }
|
|
2008
|
+
key: "dish3-bars",
|
|
2009
|
+
count: 14,
|
|
2010
|
+
sprite: { kind: "rect", width: [38e-4, 38e-4], aspect: [0.4, 1.1], color: "#5d7089" },
|
|
2011
|
+
alpha: [0.2, 0.4],
|
|
2012
|
+
layout: { type: "grid", columns: 14 },
|
|
2013
|
+
region: { x: [0.035, 0.15], y: [0.373, 0.393] },
|
|
2014
|
+
pulse: { amp: 0.3, period: 2600, wave: { wavelength: 0.14, angle: 0 } },
|
|
2015
|
+
motion: { type: "static" },
|
|
2016
|
+
life: { enter: 1e3, fade: 600 }
|
|
857
2017
|
},
|
|
858
2018
|
{
|
|
859
|
-
key: "
|
|
860
|
-
count:
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
},
|
|
869
|
-
motion: { type: "static" }
|
|
2019
|
+
key: "dish-leds",
|
|
2020
|
+
count: 3,
|
|
2021
|
+
sprite: { kind: "circle", radius: [4e-3, 4e-3], color: "#46d17a" },
|
|
2022
|
+
alpha: [0.9, 0.9],
|
|
2023
|
+
layout: { type: "grid", columns: 1 },
|
|
2024
|
+
region: { x: [0.238, 0.246], y: [0.15, 0.35] },
|
|
2025
|
+
pulse: { amp: 0.25, period: 2100 },
|
|
2026
|
+
motion: { type: "static" },
|
|
2027
|
+
life: { enter: 1e3, fade: 600 }
|
|
870
2028
|
},
|
|
2029
|
+
// carrier + doppler + station env
|
|
871
2030
|
{
|
|
872
|
-
key: "
|
|
873
|
-
count:
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
},
|
|
882
|
-
motion: { type: "static" }
|
|
2031
|
+
key: "carrier-wave",
|
|
2032
|
+
count: 30,
|
|
2033
|
+
sprite: { kind: "rect", width: [32e-4, 32e-4], aspect: [0.4, 3.6], color: "#2ee6c8" },
|
|
2034
|
+
alpha: [0.25, 0.6],
|
|
2035
|
+
layout: { type: "grid", columns: 30 },
|
|
2036
|
+
region: { x: [0.035, 0.245], y: [0.47, 0.5] },
|
|
2037
|
+
pulse: { amp: 0.5, period: 2100, wave: { wavelength: 0.16, angle: 0 } },
|
|
2038
|
+
motion: { type: "static" },
|
|
2039
|
+
life: { enter: 1150, fade: 600 }
|
|
883
2040
|
},
|
|
884
2041
|
{
|
|
885
|
-
key: "
|
|
2042
|
+
key: "doppler",
|
|
886
2043
|
count: 1,
|
|
887
|
-
position: { x: 0.
|
|
2044
|
+
position: { x: 0.035, y: 0.535 },
|
|
888
2045
|
sprite: {
|
|
889
2046
|
kind: "text",
|
|
890
|
-
strings: ["
|
|
891
|
-
color: "#
|
|
892
|
-
font: "
|
|
893
|
-
align: "
|
|
2047
|
+
strings: ["CARRIER X-BAND \xB7 DOPPLER +2.114 kHz \xB7 DRIFT 0.03"],
|
|
2048
|
+
color: "#9fb2c8",
|
|
2049
|
+
font: "10px 'SF Mono', monospace",
|
|
2050
|
+
align: "left",
|
|
2051
|
+
baseline: "top"
|
|
894
2052
|
},
|
|
895
|
-
motion: { type: "static" }
|
|
2053
|
+
motion: { type: "static" },
|
|
2054
|
+
life: { enter: 1150, fade: 600 }
|
|
896
2055
|
},
|
|
897
2056
|
{
|
|
898
|
-
key: "
|
|
2057
|
+
key: "env-line",
|
|
899
2058
|
count: 1,
|
|
900
|
-
position: { x: 0.
|
|
2059
|
+
position: { x: 0.035, y: 0.6 },
|
|
901
2060
|
sprite: {
|
|
902
2061
|
kind: "text",
|
|
903
|
-
strings: ["
|
|
904
|
-
color: "#
|
|
905
|
-
font: "
|
|
906
|
-
align: "
|
|
2062
|
+
strings: ["STATION \xB7 PWR 28.1 V \xB7 THERM 312 K \xB7 GYRO NOM \xB7 PROP 81%"],
|
|
2063
|
+
color: "#5d7089",
|
|
2064
|
+
font: "10px 'SF Mono', monospace",
|
|
2065
|
+
align: "left",
|
|
2066
|
+
baseline: "top"
|
|
907
2067
|
},
|
|
908
|
-
motion: { type: "static" }
|
|
2068
|
+
motion: { type: "static" },
|
|
2069
|
+
life: { enter: 1300, fade: 600 }
|
|
909
2070
|
},
|
|
2071
|
+
// ---- center: the orbital plot (boots third) ----
|
|
910
2072
|
{
|
|
911
|
-
key: "
|
|
2073
|
+
key: "moon",
|
|
912
2074
|
count: 1,
|
|
913
|
-
position: { x: 0.
|
|
2075
|
+
position: { x: 0.455, y: 0.4 },
|
|
2076
|
+
sprite: { kind: "circle", radius: [0.028, 0.028], color: "#8fa3bd", soft: true },
|
|
2077
|
+
alpha: [0.9, 0.9],
|
|
2078
|
+
motion: { type: "static" },
|
|
2079
|
+
life: { enter: 1200, fade: 700 }
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
key: "orbit-guides",
|
|
2083
|
+
count: 3,
|
|
2084
|
+
// All three guides pin to the plot centre; the seeded radius range
|
|
2085
|
+
// spreads them into concentric orbits (`position` is count:1-only).
|
|
2086
|
+
region: { x: [0.455, 0.455], y: [0.4, 0.4] },
|
|
2087
|
+
sprite: { kind: "ring", radius: [0.075, 0.185], color: "#1e3a52", width: 11e-4 },
|
|
2088
|
+
alpha: [0.55, 0.55],
|
|
2089
|
+
motion: { type: "static" },
|
|
2090
|
+
life: { enter: 1200, fade: 700 }
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
key: "fleet",
|
|
2094
|
+
count: 5,
|
|
914
2095
|
sprite: {
|
|
915
|
-
kind: "
|
|
916
|
-
|
|
917
|
-
color: "#
|
|
918
|
-
|
|
919
|
-
align: "center"
|
|
2096
|
+
kind: "circle",
|
|
2097
|
+
radius: [45e-4, 65e-4],
|
|
2098
|
+
color: "#2ee6c8",
|
|
2099
|
+
colors: ["#2ee6c8", "#44aaff", "#ffd166", "#aa88ff", "#ff9f43"]
|
|
920
2100
|
},
|
|
921
|
-
|
|
2101
|
+
alpha: [0.85, 0.95],
|
|
2102
|
+
blend: "lighter",
|
|
2103
|
+
motion: { type: "orbit", speed: [4, 11], radius: [0.075, 0.185], center: { x: 0.455, y: 0.4 } },
|
|
2104
|
+
trail: { length: 9, fade: 0.75 },
|
|
2105
|
+
// The relay web: each craft holds a comm chain to its neighbours.
|
|
2106
|
+
links: { k: 2, maxDist: 0.5, color: "#2ee6c8", alpha: 0.2, width: 12e-4, mode: "chain" },
|
|
2107
|
+
life: { enter: 1350, fade: 700 }
|
|
922
2108
|
},
|
|
923
|
-
// --- right column: recent files ---
|
|
924
2109
|
{
|
|
925
|
-
key: "
|
|
2110
|
+
key: "fleet-legend",
|
|
926
2111
|
count: 1,
|
|
927
|
-
position: { x: 0.
|
|
2112
|
+
position: { x: 0.455, y: 0.63 },
|
|
928
2113
|
sprite: {
|
|
929
2114
|
kind: "text",
|
|
930
|
-
strings: ["
|
|
931
|
-
color: "#
|
|
932
|
-
font: "9px monospace",
|
|
933
|
-
align: "
|
|
2115
|
+
strings: ["TRACKING 5 \xB7 KESTREL TIDE-2 LIMELIGHT CATWALK-1 SLIPSTREAM"],
|
|
2116
|
+
color: "#5d7089",
|
|
2117
|
+
font: "9px 'SF Mono', monospace",
|
|
2118
|
+
align: "center",
|
|
934
2119
|
baseline: "top"
|
|
935
2120
|
},
|
|
936
|
-
motion: { type: "static" }
|
|
2121
|
+
motion: { type: "static" },
|
|
2122
|
+
life: { enter: 1500, fade: 700 }
|
|
937
2123
|
},
|
|
2124
|
+
// pass schedule under the plot
|
|
938
2125
|
{
|
|
939
|
-
key: "
|
|
2126
|
+
key: "pass-label",
|
|
940
2127
|
count: 1,
|
|
941
|
-
position: { x: 0.
|
|
2128
|
+
position: { x: 0.3, y: 0.69 },
|
|
942
2129
|
sprite: {
|
|
943
2130
|
kind: "text",
|
|
944
|
-
strings: ["
|
|
945
|
-
color: "#
|
|
946
|
-
font: "
|
|
2131
|
+
strings: ["PASS SCHEDULE"],
|
|
2132
|
+
color: "#41536b",
|
|
2133
|
+
font: "9px 'SF Mono', monospace",
|
|
947
2134
|
align: "left",
|
|
948
|
-
baseline: "top"
|
|
949
|
-
maxWidth: 280
|
|
2135
|
+
baseline: "top"
|
|
950
2136
|
},
|
|
951
|
-
motion: { type: "static" }
|
|
2137
|
+
motion: { type: "static" },
|
|
2138
|
+
life: { enter: 1650, fade: 600 }
|
|
952
2139
|
},
|
|
953
2140
|
{
|
|
954
|
-
key: "
|
|
2141
|
+
key: "pass-1",
|
|
955
2142
|
count: 1,
|
|
956
|
-
position: { x: 0.
|
|
2143
|
+
position: { x: 0.3, y: 0.72 },
|
|
957
2144
|
sprite: {
|
|
958
2145
|
kind: "text",
|
|
959
|
-
strings: ["
|
|
960
|
-
color: "#
|
|
961
|
-
font: "11px monospace",
|
|
2146
|
+
strings: ["04:41 CATWALK-1 ACQUIRE \xB7 DSA-1 \u25B2 12 MIN"],
|
|
2147
|
+
color: "#c8d4e4",
|
|
2148
|
+
font: "11px 'SF Mono', monospace",
|
|
962
2149
|
align: "left",
|
|
963
|
-
baseline: "top"
|
|
964
|
-
maxWidth: 280
|
|
2150
|
+
baseline: "top"
|
|
965
2151
|
},
|
|
966
|
-
motion: { type: "static" }
|
|
2152
|
+
motion: { type: "static" },
|
|
2153
|
+
life: { enter: 1650, fade: 600 }
|
|
967
2154
|
},
|
|
968
2155
|
{
|
|
969
|
-
key: "
|
|
2156
|
+
key: "pass-2",
|
|
970
2157
|
count: 1,
|
|
971
|
-
position: { x: 0.
|
|
2158
|
+
position: { x: 0.3, y: 0.757 },
|
|
972
2159
|
sprite: {
|
|
973
2160
|
kind: "text",
|
|
974
|
-
strings: ["
|
|
975
|
-
color: "#
|
|
976
|
-
font: "11px monospace",
|
|
2161
|
+
strings: ["05:03 TIDE-2 OCCULT EXIT \xB7 DSA-2"],
|
|
2162
|
+
color: "#7f93ab",
|
|
2163
|
+
font: "11px 'SF Mono', monospace",
|
|
977
2164
|
align: "left",
|
|
978
|
-
baseline: "top"
|
|
979
|
-
maxWidth: 280
|
|
2165
|
+
baseline: "top"
|
|
980
2166
|
},
|
|
981
|
-
motion: { type: "static" }
|
|
2167
|
+
motion: { type: "static" },
|
|
2168
|
+
life: { enter: 1750, fade: 600 }
|
|
982
2169
|
},
|
|
983
2170
|
{
|
|
984
|
-
key: "
|
|
2171
|
+
key: "pass-3",
|
|
985
2172
|
count: 1,
|
|
986
|
-
position: { x: 0.
|
|
2173
|
+
position: { x: 0.3, y: 0.794 },
|
|
987
2174
|
sprite: {
|
|
988
2175
|
kind: "text",
|
|
989
|
-
strings: ["
|
|
990
|
-
color: "#
|
|
991
|
-
font: "11px monospace",
|
|
2176
|
+
strings: ["05:47 KESTREL RANGING \xB7 DSA-1+2"],
|
|
2177
|
+
color: "#7f93ab",
|
|
2178
|
+
font: "11px 'SF Mono', monospace",
|
|
992
2179
|
align: "left",
|
|
993
|
-
baseline: "top"
|
|
994
|
-
maxWidth: 280
|
|
2180
|
+
baseline: "top"
|
|
995
2181
|
},
|
|
996
|
-
motion: { type: "static" }
|
|
2182
|
+
motion: { type: "static" },
|
|
2183
|
+
life: { enter: 1850, fade: 600 }
|
|
997
2184
|
},
|
|
2185
|
+
// ---- right column: telemetry (boots fourth) ----
|
|
998
2186
|
{
|
|
999
|
-
key: "
|
|
2187
|
+
key: "signal-label",
|
|
1000
2188
|
count: 1,
|
|
1001
|
-
position: { x: 0.
|
|
2189
|
+
position: { x: 0.665, y: 0.115 },
|
|
1002
2190
|
sprite: {
|
|
1003
2191
|
kind: "text",
|
|
1004
|
-
strings: ["
|
|
1005
|
-
color: "#
|
|
1006
|
-
font: "
|
|
2192
|
+
strings: ["PRIMARY CARRIER \xB7 CATWALK-1"],
|
|
2193
|
+
color: "#41536b",
|
|
2194
|
+
font: "9px 'SF Mono', monospace",
|
|
1007
2195
|
align: "left",
|
|
1008
|
-
baseline: "top"
|
|
1009
|
-
maxWidth: 280
|
|
2196
|
+
baseline: "top"
|
|
1010
2197
|
},
|
|
1011
|
-
motion: { type: "static" }
|
|
2198
|
+
motion: { type: "static" },
|
|
2199
|
+
life: { enter: 1700, fade: 600 }
|
|
1012
2200
|
},
|
|
1013
|
-
// --- right column: session info ---
|
|
1014
2201
|
{
|
|
1015
|
-
key: "
|
|
2202
|
+
key: "signal-value",
|
|
1016
2203
|
count: 1,
|
|
1017
|
-
position: { x: 0.
|
|
2204
|
+
position: { x: 0.665, y: 0.14 },
|
|
1018
2205
|
sprite: {
|
|
1019
2206
|
kind: "text",
|
|
1020
|
-
strings: ["
|
|
1021
|
-
color: "#
|
|
1022
|
-
font: "
|
|
2207
|
+
strings: ["-112.4 dBm"],
|
|
2208
|
+
color: "#ffd166",
|
|
2209
|
+
font: "bold 30px 'SF Mono', monospace",
|
|
1023
2210
|
align: "left",
|
|
1024
2211
|
baseline: "top"
|
|
1025
2212
|
},
|
|
1026
|
-
motion: { type: "static" }
|
|
2213
|
+
motion: { type: "static" },
|
|
2214
|
+
life: { enter: 1700, fade: 600 }
|
|
1027
2215
|
},
|
|
1028
2216
|
{
|
|
1029
|
-
key: "
|
|
2217
|
+
key: "telemetry-row",
|
|
1030
2218
|
count: 1,
|
|
1031
|
-
position: { x: 0.
|
|
2219
|
+
position: { x: 0.665, y: 0.215 },
|
|
1032
2220
|
sprite: {
|
|
1033
2221
|
kind: "text",
|
|
1034
|
-
strings: ["
|
|
1035
|
-
color: "#
|
|
1036
|
-
font: "11px monospace",
|
|
2222
|
+
strings: ["RANGE 1.28 LS DOWNLINK 2.048 Mb/s BUFFER 38%"],
|
|
2223
|
+
color: "#9fb2c8",
|
|
2224
|
+
font: "11px 'SF Mono', monospace",
|
|
1037
2225
|
align: "left",
|
|
1038
2226
|
baseline: "top"
|
|
1039
2227
|
},
|
|
1040
|
-
motion: { type: "static" }
|
|
2228
|
+
motion: { type: "static" },
|
|
2229
|
+
life: { enter: 1800, fade: 600 }
|
|
1041
2230
|
},
|
|
2231
|
+
// event log
|
|
1042
2232
|
{
|
|
1043
|
-
key: "
|
|
2233
|
+
key: "feed-1",
|
|
1044
2234
|
count: 1,
|
|
1045
|
-
position: { x: 0.
|
|
2235
|
+
position: { x: 0.665, y: 0.3 },
|
|
1046
2236
|
sprite: {
|
|
1047
2237
|
kind: "text",
|
|
1048
|
-
strings: ["
|
|
1049
|
-
color: "#
|
|
1050
|
-
font: "
|
|
2238
|
+
strings: ["04:15:02 DSA-1 LOCK RE-ACQUIRED"],
|
|
2239
|
+
color: "#9fb2c8",
|
|
2240
|
+
font: "10px 'SF Mono', monospace",
|
|
1051
2241
|
align: "left",
|
|
1052
2242
|
baseline: "top"
|
|
1053
2243
|
},
|
|
1054
|
-
motion: { type: "static" }
|
|
2244
|
+
motion: { type: "static" },
|
|
2245
|
+
life: { enter: 1950, fade: 600 }
|
|
1055
2246
|
},
|
|
1056
|
-
// --- bottom: event log ---
|
|
1057
2247
|
{
|
|
1058
|
-
key: "
|
|
2248
|
+
key: "feed-2",
|
|
1059
2249
|
count: 1,
|
|
1060
|
-
position: { x: 0.
|
|
2250
|
+
position: { x: 0.665, y: 0.334 },
|
|
1061
2251
|
sprite: {
|
|
1062
2252
|
kind: "text",
|
|
1063
|
-
strings: ["
|
|
1064
|
-
color: "#
|
|
1065
|
-
font: "
|
|
2253
|
+
strings: ["04:12:47 CATWALK-1 WHEEL DESAT OK"],
|
|
2254
|
+
color: "#7f93ab",
|
|
2255
|
+
font: "10px 'SF Mono', monospace",
|
|
1066
2256
|
align: "left",
|
|
1067
2257
|
baseline: "top"
|
|
1068
2258
|
},
|
|
1069
|
-
motion: { type: "static" }
|
|
2259
|
+
motion: { type: "static" },
|
|
2260
|
+
life: { enter: 2050, fade: 600 }
|
|
1070
2261
|
},
|
|
1071
2262
|
{
|
|
1072
|
-
key: "
|
|
2263
|
+
key: "feed-3",
|
|
1073
2264
|
count: 1,
|
|
1074
|
-
position: { x: 0.
|
|
2265
|
+
position: { x: 0.665, y: 0.368 },
|
|
1075
2266
|
sprite: {
|
|
1076
2267
|
kind: "text",
|
|
1077
|
-
strings: ["
|
|
1078
|
-
color: "#
|
|
1079
|
-
font: "10px monospace",
|
|
2268
|
+
strings: ["04:09:31 RANGING RESIDUAL 0.4 m"],
|
|
2269
|
+
color: "#5d7089",
|
|
2270
|
+
font: "10px 'SF Mono', monospace",
|
|
1080
2271
|
align: "left",
|
|
1081
|
-
baseline: "top"
|
|
1082
|
-
maxWidth: 600
|
|
2272
|
+
baseline: "top"
|
|
1083
2273
|
},
|
|
1084
|
-
motion: { type: "static" }
|
|
2274
|
+
motion: { type: "static" },
|
|
2275
|
+
life: { enter: 2150, fade: 600 }
|
|
1085
2276
|
},
|
|
2277
|
+
// alert + relay load
|
|
1086
2278
|
{
|
|
1087
|
-
key: "
|
|
2279
|
+
key: "alert",
|
|
1088
2280
|
count: 1,
|
|
1089
|
-
position: { x: 0.
|
|
2281
|
+
position: { x: 0.665, y: 0.49 },
|
|
1090
2282
|
sprite: {
|
|
1091
2283
|
kind: "text",
|
|
1092
|
-
strings: ["
|
|
1093
|
-
color: "#
|
|
1094
|
-
font: "
|
|
2284
|
+
strings: ["\u25B3 SOLAR FLUX ELEVATED \u2014 MONITORING"],
|
|
2285
|
+
color: "#ff9f43",
|
|
2286
|
+
font: "bold 11px 'SF Mono', monospace",
|
|
1095
2287
|
align: "left",
|
|
1096
|
-
baseline: "top"
|
|
1097
|
-
maxWidth: 600
|
|
2288
|
+
baseline: "top"
|
|
1098
2289
|
},
|
|
1099
|
-
|
|
2290
|
+
pulse: { amp: 0.22, period: 3400 },
|
|
2291
|
+
motion: { type: "static" },
|
|
2292
|
+
life: { enter: 2450, fade: 600 }
|
|
1100
2293
|
},
|
|
1101
2294
|
{
|
|
1102
|
-
key: "
|
|
1103
|
-
count:
|
|
1104
|
-
position: { x: 0.06, y: 0.88 },
|
|
2295
|
+
key: "load-bars",
|
|
2296
|
+
count: 24,
|
|
1105
2297
|
sprite: {
|
|
1106
|
-
kind: "
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
maxWidth: 600
|
|
2298
|
+
kind: "rect",
|
|
2299
|
+
width: [42e-4, 42e-4],
|
|
2300
|
+
aspect: [0.5, 3.2],
|
|
2301
|
+
color: "#aa88ff",
|
|
2302
|
+
colors: ["#aa88ff", "#44aaff", "#2ee6c8"],
|
|
2303
|
+
colorWeights: [2, 2, 3]
|
|
1113
2304
|
},
|
|
1114
|
-
|
|
2305
|
+
alpha: [0.3, 0.65],
|
|
2306
|
+
layout: { type: "grid", columns: 24 },
|
|
2307
|
+
region: { x: [0.665, 0.965], y: [0.58, 0.615] },
|
|
2308
|
+
pulse: { amp: 0.45, period: 1800, wave: { wavelength: 0.12, angle: 0 } },
|
|
2309
|
+
motion: { type: "static" },
|
|
2310
|
+
life: { enter: 2550, fade: 600 }
|
|
1115
2311
|
},
|
|
1116
2312
|
{
|
|
1117
|
-
key: "
|
|
2313
|
+
key: "load-note",
|
|
1118
2314
|
count: 1,
|
|
1119
|
-
position: { x: 0.
|
|
2315
|
+
position: { x: 0.665, y: 0.65 },
|
|
1120
2316
|
sprite: {
|
|
1121
2317
|
kind: "text",
|
|
1122
|
-
strings: ["14
|
|
1123
|
-
color: "#
|
|
1124
|
-
font: "10px monospace",
|
|
2318
|
+
strings: ["RELAY LOAD \xB7 QUEUE 14 FRAMES \xB7 NOMINAL"],
|
|
2319
|
+
color: "#5d7089",
|
|
2320
|
+
font: "10px 'SF Mono', monospace",
|
|
1125
2321
|
align: "left",
|
|
1126
|
-
baseline: "top"
|
|
1127
|
-
maxWidth: 600
|
|
2322
|
+
baseline: "top"
|
|
1128
2323
|
},
|
|
1129
|
-
motion: { type: "static" }
|
|
2324
|
+
motion: { type: "static" },
|
|
2325
|
+
life: { enter: 2550, fade: 600 }
|
|
1130
2326
|
},
|
|
2327
|
+
// ---- footer band ----
|
|
1131
2328
|
{
|
|
1132
|
-
key: "
|
|
2329
|
+
key: "footer",
|
|
1133
2330
|
count: 1,
|
|
1134
|
-
position: { x: 0.
|
|
2331
|
+
position: { x: 0.035, y: 0.95 },
|
|
1135
2332
|
sprite: {
|
|
1136
2333
|
kind: "text",
|
|
1137
|
-
strings: ["
|
|
1138
|
-
color: "#
|
|
1139
|
-
font: "
|
|
1140
|
-
align: "left"
|
|
1141
|
-
baseline: "top",
|
|
1142
|
-
maxWidth: 600
|
|
2334
|
+
strings: ["NET STATE GREEN \xB7 3 ARRAYS \xB7 5 CARRIERS \xB7 DSN HANDOVER 23:34 \xB7 NEXT WINDOW 04:41:00"],
|
|
2335
|
+
color: "#41536b",
|
|
2336
|
+
font: "9px 'SF Mono', monospace",
|
|
2337
|
+
align: "left"
|
|
1143
2338
|
},
|
|
1144
|
-
motion: { type: "static" }
|
|
2339
|
+
motion: { type: "static" },
|
|
2340
|
+
life: { enter: 2750, fade: 600 }
|
|
1145
2341
|
}
|
|
1146
2342
|
]
|
|
1147
2343
|
};
|
|
@@ -1163,58 +2359,413 @@ var LANTERNS_SPEC = {
|
|
|
1163
2359
|
layers: [
|
|
1164
2360
|
{
|
|
1165
2361
|
count: 60,
|
|
1166
|
-
sprite: { kind: "circle", radius: [
|
|
2362
|
+
sprite: { kind: "circle", radius: [463e-6, 1296e-6], color: "#8fa0c8" },
|
|
1167
2363
|
alpha: [0.35, 1],
|
|
1168
2364
|
region: { y: [0, 0.62] },
|
|
1169
|
-
motion: { type: "drift", speed: [
|
|
2365
|
+
motion: { type: "drift", speed: [463e-6, 1852e-6], bob: 9259e-7 }
|
|
1170
2366
|
},
|
|
1171
2367
|
{
|
|
1172
2368
|
count: 36,
|
|
1173
2369
|
sprite: {
|
|
1174
2370
|
kind: "circle",
|
|
1175
|
-
radius: [
|
|
2371
|
+
radius: [1389e-6, 2778e-6],
|
|
1176
2372
|
color: "#b06a2a",
|
|
1177
2373
|
soft: true
|
|
1178
2374
|
},
|
|
1179
2375
|
alpha: [0.5, 0.9],
|
|
1180
2376
|
blend: "lighter",
|
|
1181
2377
|
pulse: { amp: 0.18, period: 2800 },
|
|
1182
|
-
motion: { type: "rise", speed: [6,
|
|
2378
|
+
motion: { type: "rise", speed: [5556e-6, 0.01296], sway: 3704e-6 }
|
|
1183
2379
|
},
|
|
1184
2380
|
{
|
|
1185
2381
|
count: 14,
|
|
1186
2382
|
sprite: {
|
|
1187
2383
|
kind: "circle",
|
|
1188
|
-
radius: [
|
|
2384
|
+
radius: [3241e-6, 6019e-6],
|
|
1189
2385
|
color: "#e08a34",
|
|
1190
2386
|
soft: true
|
|
1191
2387
|
},
|
|
1192
2388
|
alpha: [0.6, 1],
|
|
1193
2389
|
blend: "lighter",
|
|
1194
2390
|
pulse: { amp: 0.22, period: 3400 },
|
|
1195
|
-
motion: { type: "rise", speed: [
|
|
2391
|
+
motion: { type: "rise", speed: [0.01481, 0.02593], sway: 6481e-6 }
|
|
1196
2392
|
},
|
|
1197
2393
|
{
|
|
1198
2394
|
count: 8,
|
|
1199
2395
|
sprite: { kind: "emoji", glyphs: ["\u{1F3EE}"] },
|
|
1200
|
-
size: [
|
|
2396
|
+
size: [0.02407, 0.04074],
|
|
1201
2397
|
alpha: [0.85, 1],
|
|
1202
|
-
motion: { type: "rise", speed: [
|
|
2398
|
+
motion: { type: "rise", speed: [0.02778, 0.04444], sway: 9259e-6 }
|
|
1203
2399
|
},
|
|
1204
2400
|
{
|
|
1205
2401
|
count: 4,
|
|
1206
2402
|
sprite: { kind: "emoji", glyphs: ["\u{1F3EE}"] },
|
|
1207
|
-
size: [
|
|
1208
|
-
motion: { type: "rise", speed: [
|
|
2403
|
+
size: [0.0537, 0.07778],
|
|
2404
|
+
motion: { type: "rise", speed: [0.04815, 0.06852], sway: 0.01296 }
|
|
1209
2405
|
},
|
|
1210
2406
|
{
|
|
1211
2407
|
count: 12,
|
|
1212
|
-
sprite: { kind: "circle", radius: [
|
|
2408
|
+
sprite: { kind: "circle", radius: [1852e-6, 463e-5], color: "#e08a34", soft: true },
|
|
1213
2409
|
alpha: [0.12, 0.35],
|
|
1214
2410
|
blend: "lighter",
|
|
1215
2411
|
region: { y: [0.93, 1] },
|
|
1216
2412
|
pulse: { amp: 0.1, period: 2200 },
|
|
1217
|
-
motion: { type: "drift", speed: [
|
|
2413
|
+
motion: { type: "drift", speed: [1852e-6, 5556e-6], bob: 1852e-6 }
|
|
2414
|
+
}
|
|
2415
|
+
]
|
|
2416
|
+
};
|
|
2417
|
+
var MATRIX_RAIN_SPEC = {
|
|
2418
|
+
schemaVersion: 1,
|
|
2419
|
+
id: "matrix-rain",
|
|
2420
|
+
label: "Matrix Rain",
|
|
2421
|
+
seed: 1999,
|
|
2422
|
+
motionIntensity: "moderate",
|
|
2423
|
+
ghosting: 0.88,
|
|
2424
|
+
background: { type: "solid", color: "#010401" },
|
|
2425
|
+
layers: [
|
|
2426
|
+
{
|
|
2427
|
+
key: "rain-far",
|
|
2428
|
+
count: 64,
|
|
2429
|
+
sprite: {
|
|
2430
|
+
kind: "text",
|
|
2431
|
+
strings: ["\u30A2", "\u30AB", "\u30B5", "\u30BF", "\u30CA", "\u30CF", "\u30DE", "\u30E4", "\u30E9", "\u30EF", "0", "1", "7", "Z", "X", "K"],
|
|
2432
|
+
color: "#1c7a2e",
|
|
2433
|
+
font: "bold monospace",
|
|
2434
|
+
cycle: { period: 900 }
|
|
2435
|
+
},
|
|
2436
|
+
size: [0.014, 0.02],
|
|
2437
|
+
layout: { type: "grid", columns: 32, jitter: { y: 1 } },
|
|
2438
|
+
motion: { type: "drift", speed: [0.06, 0.14], angle: 90 },
|
|
2439
|
+
alpha: [0.35, 0.6]
|
|
2440
|
+
},
|
|
2441
|
+
{
|
|
2442
|
+
key: "rain-near",
|
|
2443
|
+
count: 40,
|
|
2444
|
+
sprite: {
|
|
2445
|
+
kind: "text",
|
|
2446
|
+
strings: ["\u30DF", "\u30CD", "\u30EA", "\u30BD", "\u30C4", "\u30CC", "\u30DB", "\u30E6", "3", "8", "9", "V", "N"],
|
|
2447
|
+
color: "#2ecc40",
|
|
2448
|
+
font: "bold monospace",
|
|
2449
|
+
cycle: { period: 700 }
|
|
2450
|
+
},
|
|
2451
|
+
size: [0.022, 0.03],
|
|
2452
|
+
layout: { type: "grid", columns: 20, jitter: { y: 1 } },
|
|
2453
|
+
motion: { type: "drift", speed: [0.16, 0.3], angle: 90 },
|
|
2454
|
+
alpha: [0.6, 0.9]
|
|
2455
|
+
},
|
|
2456
|
+
{
|
|
2457
|
+
key: "heads",
|
|
2458
|
+
count: 12,
|
|
2459
|
+
sprite: {
|
|
2460
|
+
kind: "text",
|
|
2461
|
+
strings: ["\u30B1", "\u30E1", "\u30A8", "\u30E0", "\u30F2", "5", "2"],
|
|
2462
|
+
color: "#c8ffd4",
|
|
2463
|
+
font: "bold monospace",
|
|
2464
|
+
cycle: { period: 500 }
|
|
2465
|
+
},
|
|
2466
|
+
size: [0.024, 0.032],
|
|
2467
|
+
layout: { type: "grid", columns: 12, jitter: { y: 1 } },
|
|
2468
|
+
motion: { type: "drift", speed: [0.2, 0.34], angle: 90 },
|
|
2469
|
+
alpha: [0.9, 1]
|
|
2470
|
+
}
|
|
2471
|
+
]
|
|
2472
|
+
};
|
|
2473
|
+
var NOSTALGHIA_CANDLE_SPEC = {
|
|
2474
|
+
schemaVersion: 1,
|
|
2475
|
+
id: "nostalghia-candle",
|
|
2476
|
+
label: "Nostalghia's Candle",
|
|
2477
|
+
seed: 1983,
|
|
2478
|
+
motionIntensity: "calm",
|
|
2479
|
+
background: {
|
|
2480
|
+
type: "gradient",
|
|
2481
|
+
stops: [
|
|
2482
|
+
{ at: 0, color: "#050302" },
|
|
2483
|
+
{ at: 0.55, color: "#0a0704" },
|
|
2484
|
+
{ at: 1, color: "#120c08" }
|
|
2485
|
+
]
|
|
2486
|
+
},
|
|
2487
|
+
layers: [
|
|
2488
|
+
{
|
|
2489
|
+
key: "halo",
|
|
2490
|
+
count: 1,
|
|
2491
|
+
position: { x: 0.5, y: 0.52 },
|
|
2492
|
+
sprite: {
|
|
2493
|
+
kind: "circle",
|
|
2494
|
+
radius: [0.11, 0.11],
|
|
2495
|
+
color: "#c4782a",
|
|
2496
|
+
soft: true
|
|
2497
|
+
},
|
|
2498
|
+
// Base 0.04 + amp 0.02 → breathes ~0.02..0.06; never clamps to 0.
|
|
2499
|
+
// (pulse.amp is ADDED to alpha, not multiplied.) Kept subordinate to the flame.
|
|
2500
|
+
alpha: [0.04, 0.04],
|
|
2501
|
+
blend: "lighter",
|
|
2502
|
+
pulse: { amp: 0.02, period: 1e4 },
|
|
2503
|
+
grow: { amp: 0.08, period: 1e4 },
|
|
2504
|
+
motion: { type: "static" }
|
|
2505
|
+
},
|
|
2506
|
+
{
|
|
2507
|
+
key: "smoke",
|
|
2508
|
+
count: 3,
|
|
2509
|
+
sprite: {
|
|
2510
|
+
kind: "circle",
|
|
2511
|
+
radius: [0.01, 0.022],
|
|
2512
|
+
color: "#6a6258",
|
|
2513
|
+
soft: true
|
|
2514
|
+
},
|
|
2515
|
+
alpha: [0.02, 0.04],
|
|
2516
|
+
blend: "lighter",
|
|
2517
|
+
region: { x: [0.46, 0.54], y: [0.36, 0.48] },
|
|
2518
|
+
pulse: { amp: 0.015, period: 4500 },
|
|
2519
|
+
motion: { type: "rise", speed: [2e-3, 4e-3], sway: 8e-3 }
|
|
2520
|
+
},
|
|
2521
|
+
{
|
|
2522
|
+
key: "flame-glow",
|
|
2523
|
+
count: 1,
|
|
2524
|
+
sprite: {
|
|
2525
|
+
kind: "circle",
|
|
2526
|
+
radius: [0.028, 0.028],
|
|
2527
|
+
color: "#ffb040",
|
|
2528
|
+
soft: true
|
|
2529
|
+
},
|
|
2530
|
+
alpha: [0.32, 0.32],
|
|
2531
|
+
blend: "lighter",
|
|
2532
|
+
pulse: { amp: 0.12, period: 1400 },
|
|
2533
|
+
grow: { amp: 0.4, period: 1600 },
|
|
2534
|
+
// Tiny orbit = positional lean without drifting off-center (wander has vx).
|
|
2535
|
+
motion: {
|
|
2536
|
+
type: "orbit",
|
|
2537
|
+
speed: [18, 18],
|
|
2538
|
+
radius: [3e-3, 3e-3],
|
|
2539
|
+
center: { x: 0.5, y: 0.52 }
|
|
2540
|
+
}
|
|
2541
|
+
},
|
|
2542
|
+
{
|
|
2543
|
+
key: "flame-core",
|
|
2544
|
+
count: 1,
|
|
2545
|
+
sprite: {
|
|
2546
|
+
kind: "circle",
|
|
2547
|
+
radius: [0.014, 0.014],
|
|
2548
|
+
color: "#fff6e0",
|
|
2549
|
+
soft: true
|
|
2550
|
+
},
|
|
2551
|
+
alpha: [0.95, 0.95],
|
|
2552
|
+
blend: "lighter",
|
|
2553
|
+
pulse: { amp: 0.25, period: 900 },
|
|
2554
|
+
grow: { amp: 0.55, period: 1100 },
|
|
2555
|
+
motion: {
|
|
2556
|
+
type: "orbit",
|
|
2557
|
+
speed: [22, 22],
|
|
2558
|
+
radius: [25e-4, 25e-4],
|
|
2559
|
+
center: { x: 0.5, y: 0.52 }
|
|
2560
|
+
}
|
|
2561
|
+
},
|
|
2562
|
+
{
|
|
2563
|
+
key: "embers",
|
|
2564
|
+
count: 7,
|
|
2565
|
+
sprite: {
|
|
2566
|
+
kind: "circle",
|
|
2567
|
+
radius: [18e-4, 4e-3],
|
|
2568
|
+
color: "#e08a34",
|
|
2569
|
+
soft: true
|
|
2570
|
+
},
|
|
2571
|
+
alpha: [0.4, 0.8],
|
|
2572
|
+
blend: "lighter",
|
|
2573
|
+
region: { x: [0.35, 0.65], y: [0.4, 0.7] },
|
|
2574
|
+
pulse: { amp: 0.2, period: 2200 },
|
|
2575
|
+
trail: { length: 2200, fade: 1 },
|
|
2576
|
+
motion: {
|
|
2577
|
+
type: "drift",
|
|
2578
|
+
speed: [4e-3, 0.012],
|
|
2579
|
+
angle: 270,
|
|
2580
|
+
bob: 8e-3
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
]
|
|
2584
|
+
};
|
|
2585
|
+
var POLYGONS_SPEC = {
|
|
2586
|
+
schemaVersion: 1,
|
|
2587
|
+
id: "polygons",
|
|
2588
|
+
label: "Polygons",
|
|
2589
|
+
seed: 1995,
|
|
2590
|
+
motionIntensity: "moderate",
|
|
2591
|
+
ghosting: 0.95,
|
|
2592
|
+
background: { type: "solid", color: "#04040a" },
|
|
2593
|
+
layers: [
|
|
2594
|
+
{
|
|
2595
|
+
key: "poly-cyan",
|
|
2596
|
+
count: 4,
|
|
2597
|
+
sprite: { kind: "circle", radius: [25e-4, 25e-4], color: "#37e5d7" },
|
|
2598
|
+
motion: { type: "bounce", speed: [0.14, 0.24] },
|
|
2599
|
+
wrap: false,
|
|
2600
|
+
alpha: [0.9, 0.9],
|
|
2601
|
+
links: { k: 1, maxDist: 3, mode: "chain", closed: true, color: "#37e5d7", alpha: 0.85, width: 18e-4 }
|
|
2602
|
+
},
|
|
2603
|
+
{
|
|
2604
|
+
key: "poly-magenta",
|
|
2605
|
+
count: 4,
|
|
2606
|
+
sprite: { kind: "circle", radius: [25e-4, 25e-4], color: "#e83e9c" },
|
|
2607
|
+
motion: { type: "bounce", speed: [0.1, 0.2] },
|
|
2608
|
+
wrap: false,
|
|
2609
|
+
alpha: [0.9, 0.9],
|
|
2610
|
+
links: { k: 1, maxDist: 3, mode: "chain", closed: true, color: "#e83e9c", alpha: 0.85, width: 18e-4 }
|
|
2611
|
+
}
|
|
2612
|
+
]
|
|
2613
|
+
};
|
|
2614
|
+
var ORRERY_SPEC = {
|
|
2615
|
+
schemaVersion: 1,
|
|
2616
|
+
id: "orrery",
|
|
2617
|
+
label: "Orrery",
|
|
2618
|
+
seed: 7,
|
|
2619
|
+
motionIntensity: "calm",
|
|
2620
|
+
background: {
|
|
2621
|
+
type: "gradient",
|
|
2622
|
+
stops: [
|
|
2623
|
+
{ at: 0, color: "#020210" },
|
|
2624
|
+
{ at: 0.5, color: "#06051a" },
|
|
2625
|
+
{ at: 1, color: "#0a0820" }
|
|
2626
|
+
]
|
|
2627
|
+
},
|
|
2628
|
+
layers: [
|
|
2629
|
+
// Distant stars
|
|
2630
|
+
{
|
|
2631
|
+
count: 80,
|
|
2632
|
+
sprite: { kind: "circle", radius: [2778e-7, 1111e-6], color: "#8899cc" },
|
|
2633
|
+
alpha: [0.2, 0.8],
|
|
2634
|
+
pulse: { amp: 0.3, period: 3e3 },
|
|
2635
|
+
motion: { type: "static" }
|
|
2636
|
+
},
|
|
2637
|
+
// Sun corona (soft glow)
|
|
2638
|
+
{
|
|
2639
|
+
key: "corona",
|
|
2640
|
+
count: 1,
|
|
2641
|
+
sprite: { kind: "circle", radius: [0.05556, 0.05556], color: "#ffaa22", soft: true },
|
|
2642
|
+
blend: "lighter",
|
|
2643
|
+
alpha: [0.6, 0.6],
|
|
2644
|
+
grow: { amp: 0.15, period: 4e3 },
|
|
2645
|
+
motion: { type: "static" },
|
|
2646
|
+
position: { x: 0.5, y: 0.5 }
|
|
2647
|
+
},
|
|
2648
|
+
// Sun body
|
|
2649
|
+
{
|
|
2650
|
+
key: "sun",
|
|
2651
|
+
count: 1,
|
|
2652
|
+
sprite: { kind: "emoji", glyphs: ["\u2600\uFE0F"] },
|
|
2653
|
+
size: [0.04444, 0.04444],
|
|
2654
|
+
grow: { amp: 0.08, period: 4e3 },
|
|
2655
|
+
motion: { type: "static" },
|
|
2656
|
+
position: { x: 0.5, y: 0.5 }
|
|
2657
|
+
},
|
|
2658
|
+
// Inner ring — small fast planets
|
|
2659
|
+
{
|
|
2660
|
+
key: "inner",
|
|
2661
|
+
count: 3,
|
|
2662
|
+
sprite: { kind: "emoji", glyphs: ["\u{1FAA8}", "\u{1F534}", "\u{1F7E0}"] },
|
|
2663
|
+
size: [0.01481, 0.02037],
|
|
2664
|
+
spin: 30,
|
|
2665
|
+
motion: { type: "orbit", speed: [28, 42], radius: [0.07407, 0.1111] }
|
|
2666
|
+
},
|
|
2667
|
+
// Middle ring — gas giants
|
|
2668
|
+
{
|
|
2669
|
+
key: "middle",
|
|
2670
|
+
count: 2,
|
|
2671
|
+
sprite: { kind: "emoji", glyphs: ["\u{1F7E4}", "\u{1FA90}"] },
|
|
2672
|
+
size: [0.02593, 0.03519],
|
|
2673
|
+
spin: -15,
|
|
2674
|
+
motion: { type: "orbit", speed: [12, 20], radius: [0.1481, 0.1852] }
|
|
2675
|
+
},
|
|
2676
|
+
// Outer ring — ice giants
|
|
2677
|
+
{
|
|
2678
|
+
key: "outer",
|
|
2679
|
+
count: 2,
|
|
2680
|
+
sprite: { kind: "emoji", glyphs: ["\u{1F535}", "\u{1F48E}"] },
|
|
2681
|
+
size: [0.02037, 0.02778],
|
|
2682
|
+
spin: 10,
|
|
2683
|
+
motion: { type: "orbit", speed: [5, 10], radius: [0.2222, 0.2778] }
|
|
2684
|
+
},
|
|
2685
|
+
// Orbital dust ring (soft glow particles orbiting slowly)
|
|
2686
|
+
{
|
|
2687
|
+
count: 24,
|
|
2688
|
+
sprite: { kind: "circle", radius: [9259e-7, 2778e-6], color: "#ccaa66", soft: true },
|
|
2689
|
+
alpha: [0.15, 0.4],
|
|
2690
|
+
blend: "lighter",
|
|
2691
|
+
pulse: { amp: 0.2, period: 2500 },
|
|
2692
|
+
motion: { type: "orbit", speed: [2, 8], radius: [0.09259, 0.2963] }
|
|
2693
|
+
}
|
|
2694
|
+
]
|
|
2695
|
+
};
|
|
2696
|
+
var PROCESSION_SPEC = {
|
|
2697
|
+
schemaVersion: 1,
|
|
2698
|
+
id: "procession",
|
|
2699
|
+
label: "Night Procession",
|
|
2700
|
+
seed: 8,
|
|
2701
|
+
motionIntensity: "calm",
|
|
2702
|
+
background: {
|
|
2703
|
+
type: "gradient",
|
|
2704
|
+
stops: [
|
|
2705
|
+
{ at: 0, color: "#060612" },
|
|
2706
|
+
{ at: 0.8, color: "#101024" },
|
|
2707
|
+
{ at: 1, color: "#1a1428" }
|
|
2708
|
+
],
|
|
2709
|
+
drift: { period: 3e4, amount: 0.08 }
|
|
2710
|
+
},
|
|
2711
|
+
layers: [
|
|
2712
|
+
{
|
|
2713
|
+
key: "stars",
|
|
2714
|
+
count: 90,
|
|
2715
|
+
sprite: { kind: "circle", radius: [6e-4, 16e-4], color: "#f0ead8", soft: true },
|
|
2716
|
+
motion: { type: "static" },
|
|
2717
|
+
region: { y: [0, 0.6] },
|
|
2718
|
+
alpha: [0.25, 0.6],
|
|
2719
|
+
pulse: { amp: 0.15, period: 5e3 }
|
|
2720
|
+
},
|
|
2721
|
+
{
|
|
2722
|
+
key: "lanterns",
|
|
2723
|
+
count: 9,
|
|
2724
|
+
sprite: {
|
|
2725
|
+
kind: "rect",
|
|
2726
|
+
width: [0.012, 0.02],
|
|
2727
|
+
aspect: [1.3, 1.7],
|
|
2728
|
+
color: "#ffb347",
|
|
2729
|
+
colors: ["#ffb347", "#ff8c69", "#ffd97a"],
|
|
2730
|
+
colorWeights: [3, 1, 2]
|
|
2731
|
+
},
|
|
2732
|
+
motion: {
|
|
2733
|
+
type: "path",
|
|
2734
|
+
points: [
|
|
2735
|
+
{ x: 0.12, y: 0.72 },
|
|
2736
|
+
{ x: 0.38, y: 0.58 },
|
|
2737
|
+
{ x: 0.62, y: 0.78 },
|
|
2738
|
+
{ x: 0.88, y: 0.62 },
|
|
2739
|
+
{ x: 0.62, y: 0.5 },
|
|
2740
|
+
{ x: 0.38, y: 0.72 }
|
|
2741
|
+
],
|
|
2742
|
+
duration: 36e3,
|
|
2743
|
+
curve: "smooth",
|
|
2744
|
+
closed: true,
|
|
2745
|
+
scatter: 0.02
|
|
2746
|
+
},
|
|
2747
|
+
alpha: [0.65, 0.9],
|
|
2748
|
+
pulse: { amp: 0.15, period: 2600 },
|
|
2749
|
+
life: { enter: 4e3, fade: 2500 },
|
|
2750
|
+
trail: { length: 1200, fade: 1 }
|
|
2751
|
+
},
|
|
2752
|
+
{
|
|
2753
|
+
key: "bearer",
|
|
2754
|
+
count: 1,
|
|
2755
|
+
sprite: { kind: "circle", radius: [0.014, 0.014], color: "#ffe9b0", soft: true },
|
|
2756
|
+
motion: { type: "wander", speed: [8e-3, 0.012], meander: 0.08 },
|
|
2757
|
+
alpha: [0.8, 0.8],
|
|
2758
|
+
blend: "lighter",
|
|
2759
|
+
life: { enter: 4e3, fade: 2500 }
|
|
2760
|
+
},
|
|
2761
|
+
{
|
|
2762
|
+
key: "moths",
|
|
2763
|
+
count: 7,
|
|
2764
|
+
sprite: { kind: "ring", radius: [2e-3, 5e-3], color: "#d8f6ff", width: 1e-3 },
|
|
2765
|
+
motion: { type: "orbit", speed: [20, 55], radius: [0.03, 0.09], center: { layer: "bearer" } },
|
|
2766
|
+
alpha: [0.3, 0.7],
|
|
2767
|
+
life: { enter: 7e3, fade: 2e3 },
|
|
2768
|
+
trail: { length: 600 }
|
|
1218
2769
|
}
|
|
1219
2770
|
]
|
|
1220
2771
|
};
|
|
@@ -1229,8 +2780,8 @@ var RAIN_SPEC = {
|
|
|
1229
2780
|
{
|
|
1230
2781
|
count: 140,
|
|
1231
2782
|
sprite: { kind: "text", strings: ["\u2502"], color: "#9fd0ff" },
|
|
1232
|
-
size: [
|
|
1233
|
-
motion: { type: "drift", angle: 90, speed: [
|
|
2783
|
+
size: [0.01111, 0.02407],
|
|
2784
|
+
motion: { type: "drift", angle: 90, speed: [0.4815, 0.8333] }
|
|
1234
2785
|
}
|
|
1235
2786
|
]
|
|
1236
2787
|
};
|
|
@@ -1245,50 +2796,122 @@ var SAKURA_SPEC = {
|
|
|
1245
2796
|
stops: [
|
|
1246
2797
|
{ at: 0, color: "#1b1d38" },
|
|
1247
2798
|
{ at: 0.45, color: "#3a2645" },
|
|
1248
|
-
{ at: 0.
|
|
1249
|
-
{ at:
|
|
2799
|
+
{ at: 0.78, color: "#7d3d4e" },
|
|
2800
|
+
{ at: 0.92, color: "#4a2438" },
|
|
2801
|
+
{ at: 1, color: "#1c1018" }
|
|
1250
2802
|
],
|
|
1251
|
-
|
|
2803
|
+
drift: { period: 35e3, amount: 0.08 }
|
|
1252
2804
|
},
|
|
1253
2805
|
layers: [
|
|
1254
2806
|
{
|
|
2807
|
+
key: "blossom-glow",
|
|
1255
2808
|
count: 60,
|
|
1256
|
-
sprite: {
|
|
2809
|
+
sprite: {
|
|
2810
|
+
kind: "circle",
|
|
2811
|
+
radius: [5556e-7, 1481e-6],
|
|
2812
|
+
color: "#ffe3ec",
|
|
2813
|
+
soft: true
|
|
2814
|
+
},
|
|
1257
2815
|
alpha: [0.3, 0.9],
|
|
1258
2816
|
blend: "lighter",
|
|
1259
2817
|
region: { y: [0, 0.72] },
|
|
1260
|
-
|
|
1261
|
-
|
|
2818
|
+
// Shimmer travels across the sky instead of orbs twinkling independently.
|
|
2819
|
+
pulse: { amp: 0.22, period: 4e3, wave: { wavelength: 0.45, angle: 10 } },
|
|
2820
|
+
motion: { type: "drift", speed: [2778e-7, 1111e-6], bob: 9259e-7 }
|
|
1262
2821
|
},
|
|
1263
2822
|
{
|
|
2823
|
+
key: "petals-far",
|
|
1264
2824
|
count: 28,
|
|
1265
2825
|
sprite: { kind: "emoji", glyphs: ["\u{1F338}"] },
|
|
1266
|
-
size: [
|
|
2826
|
+
size: [0.01204, 0.01852],
|
|
1267
2827
|
alpha: [0.5, 0.8],
|
|
1268
|
-
|
|
2828
|
+
spin: 16,
|
|
2829
|
+
motion: {
|
|
2830
|
+
type: "wander",
|
|
2831
|
+
speed: [0.011, 0.024],
|
|
2832
|
+
angle: 100,
|
|
2833
|
+
meander: 0.025,
|
|
2834
|
+
coherence: 0.35
|
|
2835
|
+
}
|
|
1269
2836
|
},
|
|
1270
2837
|
{
|
|
2838
|
+
key: "petals-mid",
|
|
1271
2839
|
count: 18,
|
|
1272
2840
|
sprite: { kind: "emoji", glyphs: ["\u{1F338}"] },
|
|
1273
|
-
size: [
|
|
2841
|
+
size: [0.01852, 0.02963],
|
|
1274
2842
|
alpha: [0.7, 0.95],
|
|
1275
|
-
|
|
2843
|
+
spin: 24,
|
|
2844
|
+
motion: {
|
|
2845
|
+
type: "wander",
|
|
2846
|
+
speed: [0.022, 0.041],
|
|
2847
|
+
angle: 100,
|
|
2848
|
+
meander: 0.045,
|
|
2849
|
+
coherence: 0.35
|
|
2850
|
+
}
|
|
1276
2851
|
},
|
|
1277
2852
|
{
|
|
2853
|
+
key: "petals-near",
|
|
1278
2854
|
count: 10,
|
|
1279
2855
|
sprite: { kind: "emoji", glyphs: ["\u{1F338}"] },
|
|
1280
|
-
size: [
|
|
2856
|
+
size: [0.03148, 0.05],
|
|
1281
2857
|
alpha: [0.85, 1],
|
|
1282
|
-
|
|
2858
|
+
spin: 32,
|
|
2859
|
+
motion: {
|
|
2860
|
+
type: "wander",
|
|
2861
|
+
speed: [0.039, 0.063],
|
|
2862
|
+
angle: 100,
|
|
2863
|
+
meander: 0.07,
|
|
2864
|
+
coherence: 0.35
|
|
2865
|
+
}
|
|
2866
|
+
},
|
|
2867
|
+
{
|
|
2868
|
+
key: "gusts",
|
|
2869
|
+
count: 7,
|
|
2870
|
+
sprite: {
|
|
2871
|
+
kind: "streak",
|
|
2872
|
+
length: [0.02, 0.045],
|
|
2873
|
+
width: 12e-4,
|
|
2874
|
+
color: "#ffd9e6"
|
|
2875
|
+
},
|
|
2876
|
+
alpha: [0.1, 0.22],
|
|
2877
|
+
blend: "lighter",
|
|
2878
|
+
motion: { type: "drift", speed: [0.09, 0.14], angle: 100 }
|
|
1283
2879
|
},
|
|
1284
2880
|
{
|
|
2881
|
+
key: "fireflies",
|
|
2882
|
+
count: 6,
|
|
2883
|
+
sprite: {
|
|
2884
|
+
kind: "circle",
|
|
2885
|
+
radius: [9e-4, 2e-3],
|
|
2886
|
+
color: "#ffe9a8",
|
|
2887
|
+
soft: true
|
|
2888
|
+
},
|
|
2889
|
+
alpha: [0.15, 0.5],
|
|
2890
|
+
blend: "lighter",
|
|
2891
|
+
region: { y: [0.6, 0.9] },
|
|
2892
|
+
pulse: { amp: 0.3, period: 2800 },
|
|
2893
|
+
motion: { type: "wander", speed: [4e-3, 0.01], meander: 0.05 }
|
|
2894
|
+
},
|
|
2895
|
+
{
|
|
2896
|
+
key: "fallen-petals",
|
|
1285
2897
|
count: 16,
|
|
1286
|
-
sprite: {
|
|
2898
|
+
sprite: {
|
|
2899
|
+
kind: "circle",
|
|
2900
|
+
radius: [1389e-6, 3704e-6],
|
|
2901
|
+
color: "#ff9bb5",
|
|
2902
|
+
soft: true
|
|
2903
|
+
},
|
|
1287
2904
|
alpha: [0.1, 0.3],
|
|
1288
2905
|
blend: "lighter",
|
|
1289
2906
|
region: { y: [0.9, 1] },
|
|
1290
|
-
|
|
1291
|
-
|
|
2907
|
+
// Settled petals catch the last light in a slow wave along the ground.
|
|
2908
|
+
pulse: { amp: 0.15, period: 3200, wave: { wavelength: 0.3, angle: 0 } },
|
|
2909
|
+
motion: {
|
|
2910
|
+
type: "drift",
|
|
2911
|
+
speed: [2778e-7, 1389e-6],
|
|
2912
|
+
angle: 180,
|
|
2913
|
+
bob: 9259e-7
|
|
2914
|
+
}
|
|
1292
2915
|
}
|
|
1293
2916
|
]
|
|
1294
2917
|
};
|
|
@@ -1309,18 +2932,69 @@ var SNOWFALL_SPEC = {
|
|
|
1309
2932
|
layers: [
|
|
1310
2933
|
{
|
|
1311
2934
|
count: 50,
|
|
1312
|
-
sprite: { kind: "circle", radius: [
|
|
1313
|
-
motion: { type: "drift", angle: 90, speed: [
|
|
2935
|
+
sprite: { kind: "circle", radius: [9259e-7, 2315e-6], color: "#8899aa" },
|
|
2936
|
+
motion: { type: "drift", angle: 90, speed: [0.01389, 0.03704], bob: 2778e-6 }
|
|
1314
2937
|
},
|
|
1315
2938
|
{
|
|
1316
2939
|
count: 35,
|
|
1317
|
-
sprite: { kind: "circle", radius: [
|
|
1318
|
-
motion: { type: "drift", angle: 85, speed: [
|
|
2940
|
+
sprite: { kind: "circle", radius: [1852e-6, 4167e-6], color: "#c0cdd8" },
|
|
2941
|
+
motion: { type: "drift", angle: 85, speed: [0.03241, 0.07407], bob: 5556e-6 }
|
|
1319
2942
|
},
|
|
1320
2943
|
{
|
|
1321
2944
|
count: 15,
|
|
1322
|
-
sprite: { kind: "circle", radius: [
|
|
1323
|
-
motion: { type: "drift", angle: 82, speed: [
|
|
2945
|
+
sprite: { kind: "circle", radius: [3241e-6, 6481e-6], color: "#e8eff5" },
|
|
2946
|
+
motion: { type: "drift", angle: 82, speed: [0.05093, 0.1111], bob: 9259e-6 }
|
|
2947
|
+
}
|
|
2948
|
+
]
|
|
2949
|
+
};
|
|
2950
|
+
var WARP_TUNNEL_SPEC = {
|
|
2951
|
+
schemaVersion: 1,
|
|
2952
|
+
id: "warp-tunnel",
|
|
2953
|
+
label: "Warp Tunnel",
|
|
2954
|
+
seed: 1701,
|
|
2955
|
+
motionIntensity: "energetic",
|
|
2956
|
+
ghosting: 0.55,
|
|
2957
|
+
background: { type: "solid", color: "#020208" },
|
|
2958
|
+
layers: [
|
|
2959
|
+
{
|
|
2960
|
+
key: "far-stars",
|
|
2961
|
+
count: 150,
|
|
2962
|
+
sprite: {
|
|
2963
|
+
kind: "streak",
|
|
2964
|
+
length: [8e-3, 0.02],
|
|
2965
|
+
width: 15e-4,
|
|
2966
|
+
color: "#cfd8ff",
|
|
2967
|
+
colors: ["#cfd8ff", "#ffffff", "#8ab4ff", "#ffd9a0"],
|
|
2968
|
+
colorWeights: [5, 3, 1.5, 0.5]
|
|
2969
|
+
},
|
|
2970
|
+
motion: { type: "warp", speed: [0.06, 0.16] },
|
|
2971
|
+
alpha: [0.5, 0.9],
|
|
2972
|
+
blend: "lighter"
|
|
2973
|
+
},
|
|
2974
|
+
{
|
|
2975
|
+
key: "near-stars",
|
|
2976
|
+
count: 50,
|
|
2977
|
+
sprite: {
|
|
2978
|
+
kind: "streak",
|
|
2979
|
+
length: [0.025, 0.06],
|
|
2980
|
+
width: 25e-4,
|
|
2981
|
+
color: "#ffffff",
|
|
2982
|
+
colors: ["#ffffff", "#a8c8ff"],
|
|
2983
|
+
colorWeights: [3, 1]
|
|
2984
|
+
},
|
|
2985
|
+
motion: { type: "warp", speed: [0.3, 0.55] },
|
|
2986
|
+
alpha: [0.7, 1],
|
|
2987
|
+
blend: "lighter"
|
|
2988
|
+
},
|
|
2989
|
+
{
|
|
2990
|
+
key: "core-glow",
|
|
2991
|
+
count: 1,
|
|
2992
|
+
sprite: { kind: "circle", radius: [0.06, 0.06], color: "#3a4a8f", soft: true },
|
|
2993
|
+
motion: { type: "static" },
|
|
2994
|
+
position: { x: 0.5, y: 0.5 },
|
|
2995
|
+
alpha: [0.35, 0.35],
|
|
2996
|
+
pulse: { amp: 0.15, period: 5e3 },
|
|
2997
|
+
blend: "lighter"
|
|
1324
2998
|
}
|
|
1325
2999
|
]
|
|
1326
3000
|
};
|
|
@@ -1330,7 +3004,16 @@ var SCHEMA_EXAMPLES = [
|
|
|
1330
3004
|
{ id: "snowfall", label: "Snowfall", spec: SNOWFALL_SPEC },
|
|
1331
3005
|
{ id: "lanterns", label: "Night Lanterns", spec: LANTERNS_SPEC },
|
|
1332
3006
|
{ id: "sakura", label: "Sakura Drift", spec: SAKURA_SPEC },
|
|
1333
|
-
{ id: "dev-dashboard", label: "
|
|
3007
|
+
{ id: "dev-dashboard", label: "Control Center", spec: DASHBOARD_SPEC },
|
|
3008
|
+
{ id: "orrery", label: "Orrery", spec: ORRERY_SPEC },
|
|
3009
|
+
{ id: "constellation", label: "Constellation", spec: CONSTELLATION_SPEC },
|
|
3010
|
+
{ id: "comets", label: "Comet Shower", spec: COMETS_SPEC },
|
|
3011
|
+
{ id: "aurora", label: "Aurora", spec: AURORA_SPEC },
|
|
3012
|
+
{ id: "warp-tunnel", label: "Warp Tunnel", spec: WARP_TUNNEL_SPEC },
|
|
3013
|
+
{ id: "polygons", label: "Polygons", spec: POLYGONS_SPEC },
|
|
3014
|
+
{ id: "matrix-rain", label: "Matrix Rain", spec: MATRIX_RAIN_SPEC },
|
|
3015
|
+
{ id: "procession", label: "Night Procession", spec: PROCESSION_SPEC },
|
|
3016
|
+
{ id: "nostalghia-candle", label: "Nostalghia's Candle", spec: NOSTALGHIA_CANDLE_SPEC }
|
|
1334
3017
|
];
|
|
1335
3018
|
var EXAMPLE_SPECS = SCHEMA_EXAMPLES.map((e) => e.spec);
|
|
1336
3019
|
var EXAMPLE_BY_ID = Object.fromEntries(
|
|
@@ -1349,7 +3032,8 @@ runIdleWorker(
|
|
|
1349
3032
|
[pipes.manifest.id]: pipes,
|
|
1350
3033
|
[flurry.manifest.id]: flurry,
|
|
1351
3034
|
[fluid.manifest.id]: fluid,
|
|
1352
|
-
[reactionDiffusion.manifest.id]: reactionDiffusion
|
|
3035
|
+
[reactionDiffusion.manifest.id]: reactionDiffusion,
|
|
3036
|
+
[messages.manifest.id]: messages
|
|
1353
3037
|
},
|
|
1354
3038
|
{ compiler: compileSaver }
|
|
1355
3039
|
);
|