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