@wave3d/core 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/model.d.ts +30 -2
- package/dist/config/model.js +4 -1
- package/dist/config/model.js.map +1 -1
- package/dist/presets.js +35 -0
- package/dist/presets.js.map +1 -1
- package/dist/renderer/WaveRenderer.d.ts +4 -2
- package/dist/renderer/WaveRenderer.js +11 -5
- package/dist/renderer/WaveRenderer.js.map +1 -1
- package/dist/renderer/particleField.d.ts +35 -4
- package/dist/renderer/particleField.js +150 -13
- package/dist/renderer/particleField.js.map +1 -1
- package/dist/renderer/shaders.js +178 -86
- package/dist/renderer/shaders.js.map +1 -1
- package/dist/standalone/wave3d.standalone.js +2321 -2248
- package/package.json +1 -1
- package/skills/wave3d/SKILL.md +1 -1
package/dist/config/model.d.ts
CHANGED
|
@@ -309,8 +309,10 @@ interface SceneInteractionConfig {
|
|
|
309
309
|
* scrub / loopSeconds / paused all hold). Particles spawn on the OWNING wave's DEFORMED surface / edge
|
|
310
310
|
* (via the shared waveShape) and drift outward from the wave centre.
|
|
311
311
|
*/
|
|
312
|
-
/** How each particle sprite is drawn (a per-field render style, not per-particle).
|
|
313
|
-
|
|
312
|
+
/** How each particle sprite is drawn (a per-field render style, not per-particle). All but
|
|
313
|
+
* "sprite" are drawn procedurally from `gl_PointCoord`; "sprite" samples {@link
|
|
314
|
+
* ParticlesConfig.spriteUrl} and falls back to "glitter" until that image has rasterized. */
|
|
315
|
+
type ParticleShape = "glitter" | "soft" | "ring" | "star" | "streak" | "sprite";
|
|
314
316
|
declare const PARTICLE_SHAPES: readonly ParticleShape[];
|
|
315
317
|
interface ParticlesConfig {
|
|
316
318
|
count: number;
|
|
@@ -340,6 +342,32 @@ interface ParticlesConfig {
|
|
|
340
342
|
wander?: number;
|
|
341
343
|
/** Sprite render style. Default "glitter" (the soft round additive disc). */
|
|
342
344
|
shape?: ParticleShape;
|
|
345
|
+
/**
|
|
346
|
+
* Artwork for `shape: "sprite"` — an SVG (or raster) `data:` URI or URL, rasterized ONCE into a
|
|
347
|
+
* square texture shared by every particle in the field, so the cost is one texture per field and
|
|
348
|
+
* not per particle. Ignored unless `shape` is "sprite"; until it has loaded the field draws
|
|
349
|
+
* "glitter", so a slow or broken image degrades instead of blanking.
|
|
350
|
+
*
|
|
351
|
+
* The sprite is TINTED by `color` / `color2` (multiplied), so the field's colour knobs keep
|
|
352
|
+
* working — supply WHITE artwork to take the tint literally, or coloured artwork to modulate it.
|
|
353
|
+
* Non-square art is letterboxed, because a point sprite is always square.
|
|
354
|
+
*
|
|
355
|
+
* Prefer SVG: it is a fraction of the bytes of an equivalent PNG, and the whole config (this
|
|
356
|
+
* string included) is embedded in save-states and share links.
|
|
357
|
+
*/
|
|
358
|
+
spriteUrl?: string;
|
|
359
|
+
/**
|
|
360
|
+
* How hard the cursor shoves dust that has already drifted OFF the surface, as a multiple of the
|
|
361
|
+
* displacement the wave's own {@link WaveHoverConfig} field applies. Default 1; 0 = airborne motes
|
|
362
|
+
* ignore the pointer. Only ever reads when the owning wave has a pointer field of its own — with
|
|
363
|
+
* no `interaction.hover` there is nothing to shove with, and the point program compiles without
|
|
364
|
+
* the pointer path at all.
|
|
365
|
+
*
|
|
366
|
+
* Dust still ATTACHED to the surface is not governed by this: a mote sitting on the ribbon always
|
|
367
|
+
* takes the ribbon's own displacement (weighted by how far it has drifted), because otherwise a
|
|
368
|
+
* cursor poke would lift the surface out from under its own glitter.
|
|
369
|
+
*/
|
|
370
|
+
pointerShove?: number;
|
|
343
371
|
}
|
|
344
372
|
/**
|
|
345
373
|
* Scene-level settings shared by every wave: output/background/camera/lights, the post-fx
|
package/dist/config/model.js
CHANGED
|
@@ -147,7 +147,8 @@ const PARTICLE_SHAPES = [
|
|
|
147
147
|
"soft",
|
|
148
148
|
"ring",
|
|
149
149
|
"star",
|
|
150
|
-
"streak"
|
|
150
|
+
"streak",
|
|
151
|
+
"sprite"
|
|
151
152
|
];
|
|
152
153
|
/** Spread a base wave into `count` overlapping waves — each with a slightly varied hue, width,
|
|
153
154
|
* speed, phase, vertical offset and roll so a stack reads as one composition. `count === 1`
|
|
@@ -735,6 +736,8 @@ function normalizeParticles(wave) {
|
|
|
735
736
|
if (p.swirl !== void 0) p.swirl = num(p.swirl, 0);
|
|
736
737
|
if (p.wander !== void 0) p.wander = num(p.wander, 0);
|
|
737
738
|
if (p.shape !== void 0 && !PARTICLE_SHAPES.includes(p.shape)) p.shape = "glitter";
|
|
739
|
+
if (p.spriteUrl !== void 0 && typeof p.spriteUrl !== "string") delete p.spriteUrl;
|
|
740
|
+
if (p.pointerShove !== void 0) p.pointerShove = clampNumber(p.pointerShove, 0, 4, 1);
|
|
738
741
|
}
|
|
739
742
|
/** Normalize an ingested config to the wave model: backfill the scene + every wave, and drop in
|
|
740
743
|
* a default wave if none are present. Idempotent, so it is safe on the renderer's own config as
|
package/dist/config/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","names":[],"sources":["../../src/config/model.ts"],"sourcesContent":["/**\n * Configuration schema for the wave: a flat sheet displaced by noise (X/Z frequency\n * + amount) then twisted by three axis-rotations (twistFrequency + twistPower per\n * axis), then scaled / rotated / positioned. Plain JSON — doubles as the save-state\n * format.\n */\n\nimport { clamp, clamp01 } from \"../util/math\";\n\nexport const MAX_COLORS = 8;\nexport const MAX_MESH_POINTS = 8;\nexport const MAX_LIGHTS = 8;\nexport const MAX_NOISE_BANDS = 4;\n/** Cap on stacked waves (keeps total geometry bounded — see WaveRenderer segment scaling). */\nexport const MAX_WAVES = 6;\n\nexport interface Vec2 {\n x: number;\n y: number;\n}\n\nexport interface Vec3 {\n x: number;\n y: number;\n z: number;\n}\n\n// \"squared\" = the hero material blend: SrcColor × Zero (framebuffer = fragColor²), which\n// deepens the colours — the faithful default. \"normal\"/\"additive\"/\"multiply\" are authoring\n// overrides (\"multiply\" darkens where waves/background overlap).\nexport type BlendMode = \"squared\" | \"normal\" | \"additive\" | \"multiply\";\n\n/** How the palette is mapped across the surface. */\nexport type BasicGradientType = \"linear\" | \"radial\" | \"conic\";\nexport type GradientType = BasicGradientType | \"mesh\";\n\nexport type BackgroundMode = \"color\" | \"gradient\" | \"image\";\nexport type BackgroundImageFit = \"cover\" | \"contain\" | \"stretch\";\n\n/** How the authored reference frame (FRAME_W × FRAME_H, a 16:9 rectangle centred on cameraTarget)\n * is mapped onto a canvas of a different aspect:\n * - `cover` — fill both axes, crop the overflow. The default and the hero look.\n * - `contain` — fit the whole frame, revealing world beyond it on the long axis.\n * - `width` — always bind on width, so the horizontal composition is identical at every aspect.\n * Above 16:9 this is exactly `cover`; below it, it reveals vertically instead of cropping.\n * - `height` — always bind on height (the mirror of `width`).\n * Pair with `cameraMinVisibleWidth` to land between `cover` and `width`. */\nexport type CameraFit = \"cover\" | \"contain\" | \"width\" | \"height\";\n\n/** Runtime whitelist for {@link CameraFit} (validating imported/serialized configs). */\nexport const CAMERA_FITS: readonly CameraFit[] = [\"cover\", \"contain\", \"width\", \"height\"];\n\n/** What fills the 2D palette texture: the baked hero LUT, our editable stops, or\n * a named built-in map (see PALETTE_MAPS). Any string is allowed for forward-compat. */\nexport type PaletteSource = \"hero\" | \"stops\" | (string & {});\n\n/** A positionable light. `position` lives in the same 3D space as the wave. */\nexport interface LightConfig {\n position: Vec3;\n color: string;\n intensity: number;\n}\n\n/** A default light; pass overrides for added fill lights. */\nexport function createLight(\n position: Vec3 = { x: 300, y: 500, z: 800 },\n intensity = 1,\n): LightConfig {\n return { position: { ...position }, color: \"#ffffff\", intensity };\n}\n\n/** Where the first light lands when you engage lights from an empty scene. Shared by the\n * \"drag in 3D\" control and the camera-rig minimap, which previews a light marker here so the\n * rig always shows the light — even before one has been explicitly added. */\nexport const DEFAULT_LIGHT_POSITION: Vec3 = { x: 800, y: 900, z: 1100 };\n\n/**\n * A noise band: inside a rectangular uv region, softened by `feather`, the fiber streaks\n * are overridden — strength, frequency (density), colourAttenuation (how much the local\n * colour suppresses them), and the edge-weighting parabolaPower. Lets the fibers vary\n * per region instead of uniform.\n *\n * Mind the axes, which are the reverse of what the names suggest: the bounds gate on uv,\n * and uv.x is the folded WIDTH while uv.y is the LENGTH (see WaveGeometry's UV AXES note).\n * So startX..endX span the SHORT axis and startY..endY run end to end.\n */\nexport interface NoiseBand {\n startX: number;\n endX: number;\n startY: number;\n endY: number;\n feather: number;\n strength: number;\n frequency: number;\n colorAttenuation: number;\n parabolaPower: number;\n}\n\n/** A default band: a strong, coarse streak region over the first half. */\nexport function createNoiseBand(): NoiseBand {\n return {\n startX: 0.0,\n endX: 0.5,\n startY: 0.0,\n endY: 1.0,\n feather: 0.3,\n strength: 1.0,\n frequency: 220,\n colorAttenuation: 0.0,\n parabolaPower: 2.0,\n };\n}\n\n/** One gradient stop: a colour at a normalized position (0–1) along the gradient ramp, whose\n * direction on the ribbon is set by `gradientType` / `gradientAngle`. */\nexport interface ColorStop {\n color: string;\n pos: number;\n}\n\n/** One colour influence point in the 2D mesh-gradient field. */\nexport interface MeshGradientPoint {\n color: string;\n /** Horizontal UV position (0–1). */\n x: number;\n /** Vertical UV position (0–1). */\n y: number;\n /** Relative reach of this point's colour field. */\n influence: number;\n}\n\n/** Build evenly-spaced stops from a plain list of colours. */\nexport function makeStops(colors: string[]): ColorStop[] {\n const n = colors.length;\n return colors.map((color, i) => ({ color, pos: n > 1 ? i / (n - 1) : 0 }));\n}\n\n/** A balanced iOS-style field shown the first time Mesh is selected. */\nexport function createDefaultMeshPoints(): MeshGradientPoint[] {\n return [\n { color: \"#5e5ce6\", x: 0.08, y: 0.12, influence: 0.78 },\n { color: \"#64d2ff\", x: 0.88, y: 0.08, influence: 0.72 },\n { color: \"#ff375f\", x: 0.12, y: 0.88, influence: 0.72 },\n { color: \"#ff9f0a\", x: 0.9, y: 0.86, influence: 0.78 },\n { color: \"#bf5af2\", x: 0.5, y: 0.48, influence: 0.58 },\n ];\n}\n\n/**\n * A single wave: a COMPLETE, self-contained wave — its own shape, twist, colour, finish,\n * transform and blend. Stacking waves composites independent waves; there is no shared\n * \"base wave\" any more, so nothing is duplicated between a global section and the waves.\n * Field names mirror the legacy top-level wave fields so migration + the per-section helpers\n * (normalizeWaveColour, randomize*) map 1:1.\n */\nexport interface WaveConfig {\n // Colour & gradient\n palette: ColorStop[];\n gradientType: GradientType;\n gradientAngle: number;\n gradientShift: number;\n meshGradientPoints: MeshGradientPoint[];\n meshGradientSoftness: number;\n usePaletteTexture: boolean;\n paletteSource: PaletteSource;\n paletteImageUrl?: string;\n paletteVideoUrl?: string;\n paletteTextureScale: Vec2;\n paletteTextureOffset: Vec2;\n paletteTextureRotation: number;\n /** Palette-offset drift per second (animates colour independently of the geometry; 0 = static).\n * Applies to any texture palette (not mesh / procedural stops). */\n paletteDriftX: number;\n paletteDriftY: number;\n paletteEdgeColor: string;\n paletteEdgeAmount: number;\n hueShift: number;\n colorContrast: number;\n colorSaturation: number;\n // Surface finish\n fiberCount: number;\n fiberStrength: number;\n noiseBands: NoiseBand[];\n texture: number;\n creaseLight: number;\n creaseSharpness: number;\n creaseSoftness: number;\n sheen: number;\n roundness: number;\n /** Thin-film / holographic hue response that shifts with view angle (0 = off). */\n iridescence: number;\n edgeFade: number;\n /** Softness of the ribbon's two ENDS — it smoothsteps on uv.y, which is the length, not the\n * long edges. 0.1 = the original hardcoded value; smaller = razor-crisp graphic ribbons,\n * larger = soft vapor. */\n edgeFeather: number;\n /** Depth tint (solid theme): fade far fragments toward depthTintColor for atmospheric\n * separation in multi-wave stacks (0 = off). */\n depthTint: number;\n depthTintColor: string;\n // Displacement + twist (the wave shape)\n displaceFrequency: Vec2;\n displaceAmount: number;\n /** Optional 2nd displacement octave: finer ripples riding on the broad swell (amount 0 = off). */\n detailFrequency: number;\n detailAmount: number;\n twistFrequency: Vec3;\n twistPower: Vec3;\n twistMotion?: boolean;\n /** Helix: sweep the ribbon around its OWN length axis, `helixTurns` full turns from end to end.\n * The three twists above can't express this — their axes sit 45°/90° off the length, and\n * `expStep` is a monotone falloff, so nothing they do ever repeats. This angle is periodic in the\n * length coordinate instead, which is what makes a helix (and a DNA ladder) reachable.\n * 0 turns still leaves the block inert unless radius or roll is non-zero. */\n helixTurns?: number;\n /** Carries the WHOLE ribbon around the axis at this radius (world units, pre-scale), keeping its\n * orientation. A narrow ribbon then reads as a single strand — two waves half a turn apart in\n * `helixPhase` are the two strands of a double helix. 0 = off. */\n helixRadius?: number;\n /** Rolls the ribbon's own cross-section about the axis as it advances, as a fraction of\n * `helixTurns` (1 = rolls exactly in step, a rigid twisted ribbon). That swings the ribbon's two\n * long edges onto opposite sides of the axis, so ONE wave becomes a ladder whose edges are both\n * strands — pair it with `rungAmount` for the rungs between them. 0 = off. */\n helixRoll?: number;\n /** Phase offset in degrees — where along the turn the ribbon starts. The per-wave knob that puts\n * a second wave on the opposite side of the same helix (180). */\n helixPhase?: number;\n /** Radial fan (optional): sweep the ribbon's length into a plume/peacock spread from the local\n * origin. The three twists and the helix can't reach it — this maps the ribbon to polar so the\n * combed fibers ({@link fiberCount}) read as the individual radial strands. Placement is the wave's\n * `position` transform (there is no separate pivot). Runs AFTER displace/helix/twist, behind\n * `#ifdef RADIAL`, so `radialAmount` 0 leaves the block uncompiled and the wave byte-identical. */\n radialAmount?: number; // 0..1 gate + blend (0 = off / identity)\n radialArc?: number; // fan spread, degrees\n radialSpread?: number; // along-length → radius scale\n radialRadius?: number; // source / inner radius (world units, pre-scale)\n radialCenter?: number; // base angle, degrees\n // Material (\"solid\" surface vs \"wireframe\" line shader)\n theme?: \"solid\" | \"wireframe\";\n lineAmount?: number;\n lineThickness?: number;\n lineDerivativePower?: number;\n /** Wireframe RUNGS: a second line family carved at constant uv.y, so these run ACROSS the ribbon\n * where `lineAmount`'s run along it — the two cross into a ladder. Frequency, like `lineAmount`\n * (rungs ≈ amount / π). 0 = off, and the cross-wise path isn't compiled. */\n rungAmount?: number;\n /** Rung line width, in pixels (screen-space, so it holds at any zoom). */\n rungThickness?: number;\n maxWidth?: number;\n // Transform (absolute — no shared base to offset from)\n position: Vec3;\n rotation: Vec3;\n scale: Vec3;\n // Compositing\n blendMode: BlendMode;\n /** Absolute animation speed for this wave (legacy global speed × per-layer multiplier). */\n speed: number;\n /** Overall opacity of this wave. */\n opacity: number;\n /** Phase/seed so waves don't move in lockstep. */\n seed: number;\n /** Optional per-wave interactivity: how THIS wave reacts to the shared pointer + inputs (hover\n * field, click ripples, param bindings). ABSENT = this wave is inert / byte-identical. */\n interaction?: WaveInteractionConfig;\n /** Optional per-wave particle / dust field emitted off THIS wave's deformed surface / edge.\n * ABSENT ⇒ off (no THREE.Points for this wave, byte-identical). See {@link ParticlesConfig}. */\n particles?: ParticlesConfig;\n}\n\n// ---------------------------------------------------------------------------------------------\n// Interactivity layer (optional, additive, default-off). Split by concern: the SHARED inputs (one\n// cursor + scroll + smoothing/touch) and scene-param effects live on SceneConfig.interaction; each\n// wave's own RESPONSE (hover field, click ripples, param bindings) lives on WaveConfig.interaction.\n// ABSENT blocks mean fully off — the compiled shader and rendered pixels stay byte-identical to a\n// non-interactive wave (the normalizers below run present-only; ensureSceneDefaults never calls them).\n// ---------------------------------------------------------------------------------------------\n\n/** The built-in interaction input names (the open-ended `custom:*` family is handled separately).\n * Kept in sync by hand with the {@link InteractionSource} union below. */\nconst INTERACTION_SOURCE_NAMES = [\n \"scroll\",\n \"hover\",\n \"pointerX\",\n \"pointerY\",\n \"pointerSpeed\",\n \"press\",\n \"scrollVelocity\",\n \"appear\",\n] as const;\n\n/**\n * An interaction INPUT: a normalized signal that can smoothly drive config params through an\n * {@link InteractionBinding}. Every source is exponentially smoothed before it is applied.\n */\nexport type InteractionSource =\n | \"scroll\" // container progress through the viewport, 0 (entering) .. 1 (scrolled past)\n | \"hover\" // smoothed pointer presence over the container, 0..1\n | \"pointerX\" // smoothed pointer X across the container, 0..1; relaxes to 0.5 on leave\n | \"pointerY\" // smoothed pointer Y across the container, 0..1; relaxes to 0.5 on leave\n | \"pointerSpeed\" // normalized smoothed pointer speed, 0..1\n | \"press\" // pointer button / touch held, smoothed 0..1\n | \"scrollVelocity\" // normalized smoothed |d(scroll progress)/dt|, 0..1\n | \"appear\" // one-shot 0→1 latch on first visibility (entrance choreography)\n | `custom:${string}`; // developer-fed each frame via setInteractionInput(name, value)\n\n/** Per-WAVE params a binding may drive. Single source of truth for WAVE_APPLIERS in\n * renderer/interaction.ts (checked via `satisfies`) and validated by normalizeWaveInteraction. */\nconst WAVE_TARGET_NAMES = [\n \"displaceAmount\",\n \"detailAmount\",\n \"twistPowerX\",\n \"twistPowerY\",\n \"twistPowerZ\",\n \"twistFrequencyX\",\n \"twistFrequencyY\",\n \"twistFrequencyZ\",\n \"helixPhase\",\n \"helixTurns\",\n \"helixRadius\",\n \"hueShift\",\n \"gradientShift\",\n \"colorSaturation\",\n \"opacity\",\n \"lineThickness\",\n \"lineAmount\",\n \"fiberStrength\",\n \"sheen\",\n \"iridescence\",\n \"positionX\",\n \"positionY\",\n] as const;\n/** A per-wave param a {@link WaveInteractionBinding} can drive. */\nexport type WaveInteractionTarget = (typeof WAVE_TARGET_NAMES)[number];\n\n/** SCENE params a binding may drive (post / camera / time — shared, not per wave). Single source of\n * truth for SCENE_APPLIERS in renderer/interaction.ts, validated by normalizeSceneInteraction. */\nconst SCENE_TARGET_NAMES = [\"timeOffset\", \"cameraZoom\", \"blur\", \"grain\"] as const;\n/** A scene-level param a {@link SceneInteractionBinding} can drive. */\nexport type SceneInteractionTarget = (typeof SCENE_TARGET_NAMES)[number];\n\n/** Shared fields of an input→param binding: per frame `value = mix(from ?? authoredBase, to,\n * smoothedSource)`, written straight to uniforms — never mutates config, so any refresh restores\n * the authored base (removal needs no undo step). */\ninterface InteractionBindingBase {\n /** The input signal driving this binding. */\n source: InteractionSource;\n /** Value at source = 0. OMITTED = the authored base value, so at rest the authored look shows. */\n from?: number;\n /** Value at source = 1. */\n to: number;\n /** Exponential smoothing time constant, seconds (default 0.25); also shapes the `appear` ramp. */\n smoothing?: number;\n}\n/** A binding on a wave, driving one of that wave's params. */\nexport interface WaveInteractionBinding extends InteractionBindingBase {\n target: WaveInteractionTarget;\n}\n/** A scene-level binding, driving a shared scene param. */\nexport interface SceneInteractionBinding extends InteractionBindingBase {\n target: SceneInteractionTarget;\n}\n\n/** Hover pointer-field: localized effects that follow the cursor over this wave. Present ⇒ the\n * POINTER_FX shader path compiles for this wave; an absent effect is 0 (inert). */\nexport interface WaveHoverConfig {\n /** Local churn-octave amplitude near the cursor — the wave agitates under the pointer. The studio\n * defaults this positive when you enable a hover field, so a fresh hover reacts out of the box. */\n agitate?: number;\n /** Membrane push/pull: a smooth dome at the cursor that swells toward you (repel, +) or dents away\n * (attract, −), carried by the sprung field so it drags like a poke under fabric. World units;\n * 0 = off. */\n push?: number;\n /** Drag-wake: while the cursor moves, the surface just BEHIND it is pulled into a trailing trough\n * that heals once you stop; scales with pointer speed. World units; 0 = off. */\n wake?: number;\n /** 0..1 — wireframe strands taper to hairlines; solid gains local translucency. */\n thin?: number;\n /** Local hue rotation near the cursor, degrees. */\n hueShift?: number;\n /** Local brightness lift near the cursor, -1..1. */\n lighten?: number;\n /** Pointer-follow smoothing for THIS wave's hover field, seconds — how quickly the swell trails\n * the cursor. Vary it across a stack so strands lag at different rates (a parallax drag).\n * Default 0.12. */\n smoothing?: number;\n}\n\n/** Click / touch pointer-field: what a tap or click on this wave triggers. */\nexport interface WavePressConfig {\n /** Click-ripple amplitude; 0 keeps this wave's POINTER_RIPPLES path uncompiled. */\n ripple?: number;\n}\n\n/** Per-wave interactivity: this wave's own reaction to the shared pointer + inputs. ABSENT ⇒ inert. */\nexport interface WaveInteractionConfig {\n /** Hover field (cursor-follow agitation / thinning / hue-lighten). */\n hover?: WaveHoverConfig;\n /** Click & touch (ripples radiating from a tap/click on this wave). */\n press?: WavePressConfig;\n /** Input→param bindings driving THIS wave's params (any source, incl. scroll / hover / custom). */\n bindings?: WaveInteractionBinding[];\n}\n\n/** Scene-level interactivity: the SHARED inputs (one cursor + scroll, touch) plus bindings that\n * drive shared scene params. Pointer-follow smoothing is per-wave (see WaveHoverConfig.smoothing).\n * ABSENT ⇒ inputs use defaults; `enabled: false` is the master OFF switch for the whole layer. */\nexport interface SceneInteractionConfig {\n /** Master switch for the whole interaction layer. Default true (only `false` turns it all off). */\n enabled?: boolean;\n /** Pointer falloff radius, as a fraction of viewport height. Default 0.3. */\n radius?: number;\n /** Ribbon flow (0..1, default 0.8): stretch the pointer footprint along each wave's own length axis\n * so the influence reaches ALONG the ribbon instead of as a circular screen disc. On by default;\n * set 0 for the plain circle. Scene-level (shared like `radius`); each wave uses its own length\n * tangent. Only affects waves that already react to the cursor (non-interactive waves are inert). */\n ribbonFlow?: number;\n /** Follow coarse (touch) pointers. Default false — touch is ignored unless this is true. */\n touch?: boolean;\n /** Input→param bindings driving SCENE params (timeOffset, cameraZoom, blur, grain). */\n bindings?: SceneInteractionBinding[];\n}\n\n/**\n * A WAVE's field of additive GPU sprites (dust / sparkle). Lives on {@link WaveConfig} — particles\n * belong to a wave, not the scene. ABSENT ⇒ off: no THREE.Points node is created for that wave and its\n * render is byte-identical; present ⇒ {@link normalizeParticles} clamps it. Every particle's motion is a\n * pure function of `uTime` + a per-particle seed baked from `seed`, so it is deterministic (timeOffset\n * scrub / loopSeconds / paused all hold). Particles spawn on the OWNING wave's DEFORMED surface / edge\n * (via the shared waveShape) and drift outward from the wave centre.\n */\n/** How each particle sprite is drawn (a per-field render style, not per-particle). */\nexport type ParticleShape = \"glitter\" | \"soft\" | \"ring\" | \"star\" | \"streak\";\nexport const PARTICLE_SHAPES: readonly ParticleShape[] = [\n \"glitter\",\n \"soft\",\n \"ring\",\n \"star\",\n \"streak\",\n];\n\nexport interface ParticlesConfig {\n count: number; // total sprites (clamped in normalizeParticles)\n size: number; // base sprite size, px\n seed: number; // PRNG seed → reproducible layout\n sizeJitter?: number; // 0..1 per-particle size variance\n color?: string; // sprite colour (warm gold default)\n /** Second sprite colour — particles interpolate between `color` and this by their seed (two-tone dust). */\n color2?: string;\n life?: number; // seconds per birth→death cycle\n /** Motion-speed multiplier for the dust: how fast particles cycle + drift (1 = default, 0 = frozen).\n * Independent of the wave's own `speed` (which animates the surface the dust rides). Under a seamless\n * `loopSeconds` it snaps to a whole number of cycles so the loop stays seamless. */\n speed?: number;\n twinkle?: number; // 0..1 brightness flicker\n /** Where on the wave particles spawn: 0 = across the whole SURFACE, 1 = the outer rim / EDGE only. */\n edgeBias?: number;\n /** How far particles drift outward from the wave centre as they age (world units). */\n drift?: number;\n /** −1..1 skew of the spawn along the edge width toward one flank (0 = even, −1 → one side, +1 → other). */\n bias?: number;\n /** Screen-vertical buoyancy over a lifetime, world units: + rises (embers), − falls (snow / ash). */\n rise?: number;\n /** Orbit around the wave centre in the screen plane, turns per lifetime (swirls the dust). */\n swirl?: number;\n /** Curl-noise turbulence: particles meander (fireflies / motes) instead of moving in straight lines. */\n wander?: number;\n /** Sprite render style. Default \"glitter\" (the soft round additive disc). */\n shape?: ParticleShape;\n}\n\n/**\n * Scene-level settings shared by every wave: output/background/camera/lights, the post-fx\n * pass (grain/blur), playback, quality, and the whole-composition mirror. Everything that\n * describes an individual wave lives on WaveConfig instead.\n */\nexport interface SceneConfig {\n background: string;\n transparentBackground: boolean;\n backgroundMode: BackgroundMode;\n backgroundPalette: ColorStop[];\n backgroundGradientType: GradientType;\n backgroundGradientAngle: number;\n backgroundGradientSource: PaletteSource;\n backgroundMeshPoints: MeshGradientPoint[];\n backgroundMeshSoftness: number;\n backgroundImageSource: PaletteSource;\n backgroundImageUrl?: string;\n backgroundVideoUrl?: string;\n backgroundImageFit: BackgroundImageFit;\n backgroundImageZoom: number;\n backgroundImagePosition: Vec2;\n /** Number of stacked waves (kept in sync with waves.length). */\n waveCount: number;\n quality: number;\n dprMax: number;\n paused: boolean;\n /** Noise phase offset — scrubs the noise pattern to pick a still frame. */\n timeOffset?: number;\n /** Seamless-loop period in seconds (0 = off). When >0, the motion is mapped onto a circle in\n * noise space so it repeats exactly every `loopSeconds` — scene-level so a multi-wave stack\n * shares one period and the whole composite loops. */\n loopSeconds?: number;\n introRamp?: boolean;\n showCameraRig: boolean;\n cameraDistance: number;\n cameraZoom: number;\n cameraPosition: Vec3;\n cameraTarget: Vec3;\n /** How the authored reference frame maps onto the canvas when their aspects differ.\n * Default `\"cover\"`. See {@link CameraFit}. */\n cameraFit?: CameraFit;\n /** Floor on how much of the authored frame's WIDTH stays on screen, as a fraction (0..1).\n * A ceiling on zoom applied AFTER {@link cameraFit}, so the two compose instead of fighting:\n * it only ever zooms out, and is inert for fits that already do (`contain`, `width`).\n *\n * This is the narrow-screen crop control. `cameraFit: \"cover\"` binds on height once the canvas\n * is narrower than the 16:9 reference, so a portrait phone (390×844 @ dpr 2) zooms 2.25× and\n * shows only ~26% of the authored width. `0.6` holds 60% of it on screen; `1` is equivalent to\n * `\"width\"`. Default 0 (off) — existing configs frame exactly as before.\n *\n * It clamps the BASE zoom, before the cameraZoom multiplier, which makes the fraction read\n * against your own composition rather than the raw constant: `1` shows exactly the horizontal\n * span you see at 16:9 whatever cameraZoom you authored at, and `0.6` shows 60% of that. */\n cameraMinVisibleWidth?: number;\n /** Film grain amount (post pass). */\n grain: number;\n /** Soft-focus / spin blur amount (post pass). */\n blur: number;\n blurSamples?: number;\n /** Bloom (post pass, UnrealBloomPass). strength 0 removes the pass entirely, so cost and pixels\n * are identical to bloom-off; radius/threshold only take effect once strength > 0. */\n bloomStrength?: number;\n bloomRadius?: number;\n bloomThreshold?: number;\n /** Ordered (Bayer) dithering over the finished composite — a self-contained \"layered\" post\n * shader in the spirit of paper-design/shaders. 0 removes the pass entirely (cost/pixels match\n * dither-off); scale & steps only bite once dither > 0. Runs last, after tone-map + sRGB. */\n dither?: number;\n /** Dither cell size in device pixels (>=1) — larger = chunkier pattern. */\n ditherScale?: number;\n /** Quantization levels per channel (>=2) — lower = heavier posterization. */\n ditherSteps?: number;\n /** Volumetric light streaks (innerLight) scattered from the bright wave toward a light point\n * (innerLightX/Y in UV). 0 removes the pass; density/decay/centre only bite once innerLight > 0.\n * Scene-zone (scatters the raw wave, like bloom). */\n innerLight?: number;\n innerLightDensity?: number;\n innerLightDecay?: number;\n innerLightX?: number;\n innerLightY?: number;\n /** Halftone: a rotated dot screen (dot size scales with local brightness) over the final image.\n * 0 removes the pass; cell/angle only bite once halftone > 0. Finish-zone stylization. */\n halftone?: number;\n halftoneCell?: number;\n halftoneAngle?: number;\n /** Heatmap recolour (luminance → thermal palette). 0 removes the pass. Finish-zone. */\n heatmap?: number;\n /** Paper-texture overlay (fibrous substrate shading). 0 removes the pass; scale = grain size. */\n paperTexture?: number;\n paperTextureScale?: number;\n /** CMYK halftone (four rotated dot screens). 0 removes the pass; cell = dot size px. */\n halftoneCmyk?: number;\n halftoneCmykCell?: number;\n /** Base ambient light level (0–1). */\n ambient: number;\n lights: LightConfig[];\n /** Mirror the whole composition on screen (world-space flip). */\n mirrorH: boolean;\n mirrorV: boolean;\n /** Shared interaction inputs (one cursor + scroll) + scene-param bindings. Per-wave response\n * lives on each WaveConfig.interaction. ABSENT = defaults; `enabled:false` disables the layer. */\n interaction?: SceneInteractionConfig;\n}\n\n/** The full save-state: scene settings + one or more complete waves. */\nexport interface StudioConfig extends SceneConfig {\n waves: WaveConfig[];\n}\n\n/** Spread a base wave into `count` overlapping waves — each with a slightly varied hue, width,\n * speed, phase, vertical offset and roll so a stack reads as one composition. `count === 1`\n * returns the base unchanged. Used to author multi-wave presets. */\nexport function makeWaveSpread(base: WaveConfig, count: number): WaveConfig[] {\n if (count <= 1) return [structuredClone(base)];\n const out: WaveConfig[] = [];\n for (let i = 0; i < count; i++) {\n const f = i / (count - 1);\n const w = structuredClone(base);\n w.opacity = 1.0 - f * 0.3;\n w.hueShift = base.hueShift + i * 18;\n w.scale = { x: base.scale.x, y: base.scale.y * (1 - f * 0.2), z: base.scale.z };\n w.speed = base.speed * (1 + f * 0.15);\n w.seed = i * 3.3;\n w.position = {\n x: base.position.x,\n y: base.position.y + (f - 0.5) * 1.5,\n z: base.position.z - i * 0.8,\n };\n w.rotation = { x: base.rotation.x, y: base.rotation.y, z: base.rotation.z + i * 20 };\n out.push(w);\n }\n return out;\n}\n\n/** The hero wave (a single complete wave) — the base for the default config and most presets. */\nfunction defaultWave(): WaveConfig {\n return {\n // The hero palette: a periwinkle tip/edge, a dominant orange core, then coral → magenta →\n // pink, with a violet twist tip. gradientShift warps it to mimic a baked 2D palette texture.\n palette: [\n { color: \"#8e9dff\", pos: 0 }, // periwinkle (blue tip/edge)\n { color: \"#c98fd0\", pos: 0.14 }, // lavender transition\n { color: \"#ff9326\", pos: 0.3 }, // orange (rising)\n { color: \"#fd8108\", pos: 0.52 }, // orange core\n { color: \"#fb7a36\", pos: 0.64 }, // orange-coral (keeps orange dominant)\n { color: \"#d24ecc\", pos: 0.78 }, // true magenta (hue ~303, not pink)\n { color: \"#e95cae\", pos: 0.9 }, // pink-magenta\n { color: \"#9b6ae0\", pos: 1.0 }, // violet (twist tip)\n ],\n gradientType: \"linear\",\n gradientAngle: 90, // 90° = the gradient runs ALONG the length (uv.x)\n gradientShift: 0.15,\n meshGradientPoints: createDefaultMeshPoints(),\n meshGradientSoftness: 0.62,\n usePaletteTexture: true, // default to the baked hero LUT\n paletteSource: \"hero\",\n paletteTextureScale: { x: 1, y: 1 },\n paletteTextureOffset: { x: 0, y: 0 },\n paletteTextureRotation: 0,\n paletteDriftX: 0,\n paletteDriftY: 0,\n paletteEdgeColor: \"#8e9dff\",\n paletteEdgeAmount: 0.3,\n hueShift: -1.81, // hero colorHueShift ≈ -1.81°\n colorContrast: 1.0,\n colorSaturation: 1.15,\n // Hero fibers: the surfaceColor fragment hardcodes freq 600 / strength 0.2; the line* fields\n // feed the wireframe theme (unused by the solid hero).\n fiberCount: 600,\n fiberStrength: 0.2,\n noiseBands: [],\n texture: 0,\n creaseLight: 0.6,\n creaseSharpness: 0.589,\n creaseSoftness: 1.0,\n // sheen 0 + roundness 0: the ortho crop makes crease low, so the hero look comes from the\n // SrcColor² blend + the palette, not the derivative white-lift.\n sheen: 0.0,\n roundness: 0.0,\n iridescence: 0,\n edgeFade: 0.04,\n edgeFeather: 0.1, // the original hardcoded ribbon-edge softness\n depthTint: 0,\n depthTintColor: \"#0a2540\",\n // Hero deformation on the native 400-unit folded() geometry.\n displaceFrequency: { x: 0.003234, y: 0.00799 },\n displaceAmount: 6.051,\n detailFrequency: 0.04, // finer than the base swell; only bites once detailAmount > 0\n detailAmount: 0,\n // Small twist frequencies + high powers — a gentle twist; the drama is the ortho crop.\n twistFrequency: { x: -0.055, y: 0.077, z: -0.518 },\n twistPower: { x: 3.95, y: 5.85, z: 6.33 },\n twistMotion: false,\n // Helix off: radius and roll both 0 leave the whole block uncompiled (see waveDefines).\n helixTurns: 0,\n helixRadius: 0,\n helixRoll: 0,\n helixPhase: 0,\n // Radial off: amount 0 leaves the RADIAL block uncompiled (see waveDefines).\n radialAmount: 0,\n radialArc: 160,\n radialSpread: 1,\n radialRadius: 40,\n radialCenter: 0,\n theme: \"solid\",\n lineAmount: 425, // wireframe-theme line params (defaults)\n lineThickness: 1,\n lineDerivativePower: 0.95,\n rungAmount: 0, // cross-wise rungs off\n rungThickness: 1,\n maxWidth: 1232,\n // Hero mesh transform at FULL scale (the ortho camera frames in pixels).\n position: { x: -24.3, y: -56.4, z: -11.1 },\n rotation: { x: -9.14, y: -16.25, z: -161.32 },\n scale: { x: 10, y: 10, z: 7 },\n blendMode: \"squared\", // the hero squaring blend (SrcColor²)\n speed: 0.04, // hero speed: 4e-5 vs ms-time ≈ 0.04/s\n opacity: 1,\n seed: 0,\n };\n}\n\n/** A fresh default wave (the hero wave as one complete wave). */\nexport function makeWave(): WaveConfig {\n return defaultWave();\n}\n\n/** Resize `waves` to match `waveCount`. New waves CLONE the last one (inherit every\n * property of the preceding wave); extras are dropped. */\nexport function resizeWaves(config: StudioConfig): void {\n const target = Math.max(1, Math.round(config.waveCount) || 1);\n if (!Array.isArray(config.waves) || config.waves.length === 0) {\n config.waves = [makeWave()];\n }\n while (config.waves.length < target) {\n config.waves.push(structuredClone(config.waves[config.waves.length - 1]));\n }\n while (config.waves.length > target) config.waves.pop();\n config.waveCount = config.waves.length;\n}\n\n/** The default studio config: the hero wave + its scene, in the canonical wave model. */\nexport function createDefaultConfig(): StudioConfig {\n return {\n background: \"#ffffff\",\n transparentBackground: true,\n backgroundMode: \"color\",\n backgroundPalette: makeStops([\"#0a2540\", \"#425466\", \"#7a73ff\", \"#f6f9fc\"]),\n backgroundGradientType: \"linear\",\n backgroundGradientAngle: 135,\n backgroundGradientSource: \"stops\",\n backgroundMeshPoints: createDefaultMeshPoints(),\n backgroundMeshSoftness: 0.62,\n backgroundImageSource: \"vaporwave\",\n backgroundImageFit: \"cover\",\n backgroundImageZoom: 1,\n backgroundImagePosition: { x: 0, y: 0 },\n waveCount: 1,\n quality: 1,\n dprMax: 2,\n paused: false,\n timeOffset: 0, // noise phase (scrub to pick a still)\n introRamp: true, // ease the animation in over ~1s on load (skipped in dev; see WaveRenderer.updateTime)\n showCameraRig: false,\n // The hero camera: ORTHOGRAPHIC at (100,0,5000) looking at the origin. The mesh is ×10 so\n // the wave overflows the frame and only the twist shows. cameraZoom is a user multiplier on\n // the responsive base zoom (1 = the hero crop); cameraTarget pans the look-at to the twist.\n cameraDistance: 5001,\n cameraPosition: { x: 100, y: 0, z: 5000 },\n cameraTarget: { x: -44, y: -250, z: 0 },\n cameraZoom: 1.0,\n cameraFit: \"cover\",\n cameraMinVisibleWidth: 0, // off — see the field docs for the narrow-screen crop control\n // Post (one pass over the whole composite): hero grain 1.1, blur 0.02.\n grain: 1.1,\n blur: 0.02,\n blurSamples: 6,\n dither: 0, // off by default — the hero look is unchanged (the pass isn't inserted)\n ditherScale: 2,\n ditherSteps: 4,\n innerLight: 0,\n innerLightDensity: 0.5,\n innerLightDecay: 0.95,\n innerLightX: 0.5,\n innerLightY: 0.15,\n halftone: 0,\n halftoneCell: 6,\n halftoneAngle: 0.4,\n heatmap: 0,\n paperTexture: 0,\n paperTextureScale: 2,\n halftoneCmyk: 0,\n halftoneCmykCell: 6,\n // particles is deliberately absent (off = byte-identical).\n ambient: 0.45,\n lights: [], // hero has no lights — colour is the palette + the SrcColor² blend\n mirrorH: false,\n mirrorV: false,\n waves: [defaultWave()],\n };\n}\n\n/** Clamp/backfill a single wave's colour + palette fields (legacy `string[]` palettes become\n * ColorStop[]; mesh points + texture transform are clamped). */\nfunction normalizeWaveColour(config: WaveConfig): void {\n const p = config.palette as unknown as Array<string | ColorStop> | undefined;\n if (!Array.isArray(p) || p.length === 0) {\n // A wave with no usable palette at all (`\"waves\": [{}]`) used to throw right here, out of the\n // very normalizer whose job is to make an untrusted config safe to render.\n config.palette = defaultWave().palette;\n } else if (typeof p[0] === \"string\") {\n config.palette = makeStops(p as string[]);\n }\n if (\n config.gradientType !== \"radial\" &&\n config.gradientType !== \"conic\" &&\n config.gradientType !== \"mesh\" &&\n config.gradientType !== \"linear\"\n ) {\n config.gradientType = \"linear\";\n }\n const rawMeshPoints = config.meshGradientPoints as MeshGradientPoint[] | undefined;\n if (!Array.isArray(rawMeshPoints) || rawMeshPoints.length < 2) {\n config.meshGradientPoints = createDefaultMeshPoints();\n } else {\n const defaults = createDefaultMeshPoints();\n config.meshGradientPoints = rawMeshPoints.slice(0, MAX_MESH_POINTS).map((point, index) => {\n const fallback = defaults[index] ?? defaults[defaults.length - 1];\n const x = Number(point.x);\n const y = Number(point.y);\n const influence = Number(point.influence);\n return {\n color: typeof point.color === \"string\" ? point.color : fallback.color,\n x: clamp01(Number.isFinite(x) ? x : fallback.x),\n y: clamp01(Number.isFinite(y) ? y : fallback.y),\n influence: clamp(Number.isFinite(influence) ? influence : fallback.influence, 0.15, 1.5),\n };\n });\n }\n if (!Number.isFinite(config.meshGradientSoftness)) config.meshGradientSoftness = 0.62;\n config.meshGradientSoftness = clamp01(config.meshGradientSoftness);\n if (!config.paletteTextureScale) config.paletteTextureScale = { x: 1, y: 1 };\n if (!config.paletteTextureOffset) config.paletteTextureOffset = { x: 0, y: 0 };\n config.paletteTextureScale.x = clamp(Number(config.paletteTextureScale.x) || 1, 0.1, 8);\n config.paletteTextureScale.y = clamp(Number(config.paletteTextureScale.y) || 1, 0.1, 8);\n config.paletteTextureOffset.x = clamp(Number(config.paletteTextureOffset.x) || 0, -4, 4);\n config.paletteTextureOffset.y = clamp(Number(config.paletteTextureOffset.y) || 0, -4, 4);\n config.paletteTextureRotation = clamp(Number(config.paletteTextureRotation) || 0, -180, 180);\n}\n\n/** Backfill background styling for states saved before gradient/image backgrounds existed. */\nexport function normalizeBackground(config: StudioConfig): void {\n if (typeof config.background !== \"string\") config.background = \"#ffffff\";\n if (typeof config.transparentBackground !== \"boolean\") config.transparentBackground = true;\n if (\n config.backgroundMode !== \"gradient\" &&\n config.backgroundMode !== \"image\" &&\n config.backgroundMode !== \"color\"\n ) {\n config.backgroundMode = \"color\";\n }\n const palette = config.backgroundPalette as unknown as Array<string | ColorStop> | undefined;\n if (!palette || palette.length < 2) {\n config.backgroundPalette = makeStops([\"#0a2540\", \"#425466\", \"#7a73ff\", \"#f6f9fc\"]);\n } else if (typeof palette[0] === \"string\") {\n config.backgroundPalette = makeStops(palette as string[]);\n }\n if (\n config.backgroundGradientType !== \"radial\" &&\n config.backgroundGradientType !== \"conic\" &&\n config.backgroundGradientType !== \"mesh\" &&\n config.backgroundGradientType !== \"linear\"\n ) {\n config.backgroundGradientType = \"linear\";\n }\n const bgMesh = config.backgroundMeshPoints as MeshGradientPoint[] | undefined;\n if (!Array.isArray(bgMesh) || bgMesh.length < 2) {\n config.backgroundMeshPoints = createDefaultMeshPoints();\n }\n if (!Number.isFinite(config.backgroundMeshSoftness)) config.backgroundMeshSoftness = 0.62;\n config.backgroundMeshSoftness = clamp01(config.backgroundMeshSoftness);\n if (!Number.isFinite(config.backgroundGradientAngle)) config.backgroundGradientAngle = 135;\n if (typeof config.backgroundGradientSource !== \"string\")\n config.backgroundGradientSource = \"stops\";\n if (typeof config.backgroundImageSource !== \"string\") config.backgroundImageSource = \"vaporwave\";\n if (\n config.backgroundImageFit !== \"contain\" &&\n config.backgroundImageFit !== \"stretch\" &&\n config.backgroundImageFit !== \"cover\"\n ) {\n config.backgroundImageFit = \"cover\";\n }\n if (!Number.isFinite(config.backgroundImageZoom)) config.backgroundImageZoom = 1;\n config.backgroundImageZoom = clamp(config.backgroundImageZoom, 0.1, 8);\n if (!config.backgroundImagePosition) config.backgroundImagePosition = { x: 0, y: 0 };\n if (typeof config.backgroundImagePosition.x !== \"number\") config.backgroundImagePosition.x = 0;\n if (typeof config.backgroundImagePosition.y !== \"number\") config.backgroundImagePosition.y = 0;\n config.backgroundImagePosition.x = clamp(config.backgroundImagePosition.x, -100, 100);\n config.backgroundImagePosition.y = clamp(config.backgroundImagePosition.y, -100, 100);\n}\n\n/** Backfill camera position/target for states saved before they existed. */\nexport function ensureCamera(config: StudioConfig): void {\n if (!config.cameraPosition)\n config.cameraPosition = { x: 0, y: 0, z: config.cameraDistance ?? 62 };\n if (!config.cameraTarget) config.cameraTarget = { x: 0, y: 0, z: 0 };\n if (!Number.isFinite(config.cameraZoom)) config.cameraZoom = 1;\n // Framing policy: absent → the historical cover framing, so every saved config/preset that\n // predates these fields reproduces byte-identically.\n if (!CAMERA_FITS.includes(config.cameraFit as CameraFit)) config.cameraFit = \"cover\";\n config.cameraMinVisibleWidth =\n typeof config.cameraMinVisibleWidth === \"number\"\n ? clamp(config.cameraMinVisibleWidth, 0, 1)\n : 0;\n}\n\n/** Backfill/repair a wave so the renderer can consume it (covers partial wave-model JSON). */\nexport function normalizeWave(s: WaveConfig): void {\n normalizeWaveColour(s);\n if (!Number.isFinite(s.gradientAngle)) s.gradientAngle = 90;\n if (!Number.isFinite(s.gradientShift)) s.gradientShift = 0.15;\n if (typeof s.usePaletteTexture !== \"boolean\") s.usePaletteTexture = true;\n if (typeof s.paletteSource !== \"string\") s.paletteSource = \"hero\";\n if (typeof s.paletteEdgeColor !== \"string\") s.paletteEdgeColor = \"#8e9dff\";\n if (!Number.isFinite(s.paletteEdgeAmount)) s.paletteEdgeAmount = 0.3;\n if (!Number.isFinite(s.paletteDriftX)) s.paletteDriftX = 0;\n if (!Number.isFinite(s.paletteDriftY)) s.paletteDriftY = 0;\n if (!Number.isFinite(s.hueShift)) s.hueShift = 0;\n if (!Number.isFinite(s.colorContrast)) s.colorContrast = 1;\n if (!Number.isFinite(s.colorSaturation)) s.colorSaturation = 1;\n if (!Number.isFinite(s.fiberCount)) s.fiberCount = 600;\n if (!Number.isFinite(s.fiberStrength)) s.fiberStrength = 0.2;\n if (!Array.isArray(s.noiseBands)) s.noiseBands = [];\n normalizeNoiseBands(s);\n if (!Number.isFinite(s.texture)) s.texture = 0;\n if (!Number.isFinite(s.creaseLight)) s.creaseLight = 0.6;\n if (!Number.isFinite(s.creaseSharpness)) s.creaseSharpness = 0.589;\n if (!Number.isFinite(s.creaseSoftness)) s.creaseSoftness = 1;\n if (!Number.isFinite(s.sheen)) s.sheen = 0;\n if (!Number.isFinite(s.roundness)) s.roundness = 0;\n if (!Number.isFinite(s.iridescence)) s.iridescence = 0;\n if (!Number.isFinite(s.edgeFade)) s.edgeFade = 0.04;\n if (!Number.isFinite(s.edgeFeather)) s.edgeFeather = 0.1;\n if (!Number.isFinite(s.depthTint)) s.depthTint = 0;\n if (typeof s.depthTintColor !== \"string\") s.depthTintColor = \"#0a2540\";\n if (!s.displaceFrequency) s.displaceFrequency = { x: 0.003234, y: 0.00799 };\n if (!Number.isFinite(s.displaceAmount)) s.displaceAmount = 6.051;\n if (!Number.isFinite(s.detailFrequency)) s.detailFrequency = 0.04;\n if (!Number.isFinite(s.detailAmount)) s.detailAmount = 0;\n if (!s.twistFrequency) s.twistFrequency = { x: -0.055, y: 0.077, z: -0.518 };\n if (!s.twistPower) s.twistPower = { x: 3.95, y: 5.85, z: 6.33 };\n // false, not absent: the panel binds this directly, and a wave that omits it can't be edited.\n if (typeof s.twistMotion !== \"boolean\") s.twistMotion = false;\n if (!Number.isFinite(s.helixTurns)) s.helixTurns = 0;\n if (!Number.isFinite(s.helixRadius)) s.helixRadius = 0;\n if (!Number.isFinite(s.helixRoll)) s.helixRoll = 0;\n if (!Number.isFinite(s.helixPhase)) s.helixPhase = 0;\n if (!Number.isFinite(s.radialAmount)) s.radialAmount = 0;\n if (!Number.isFinite(s.radialArc)) s.radialArc = 160;\n if (!Number.isFinite(s.radialSpread)) s.radialSpread = 1;\n if (!Number.isFinite(s.radialRadius)) s.radialRadius = 40;\n if (!Number.isFinite(s.radialCenter)) s.radialCenter = 0;\n if (typeof s.theme !== \"string\") s.theme = \"solid\";\n if (!Number.isFinite(s.lineAmount)) s.lineAmount = 425;\n if (!Number.isFinite(s.lineThickness)) s.lineThickness = 1;\n if (!Number.isFinite(s.lineDerivativePower)) s.lineDerivativePower = 0.95;\n if (!Number.isFinite(s.rungAmount)) s.rungAmount = 0;\n if (!Number.isFinite(s.rungThickness)) s.rungThickness = 1;\n if (!Number.isFinite(s.maxWidth)) s.maxWidth = 1232;\n if (!s.position) s.position = { x: 0, y: 0, z: 0 };\n if (!s.rotation) s.rotation = { x: 0, y: 0, z: 0 };\n if (!s.scale) s.scale = { x: 10, y: 10, z: 7 };\n if (typeof s.blendMode !== \"string\") s.blendMode = \"squared\";\n if (!Number.isFinite(s.speed)) s.speed = 0.04;\n if (!Number.isFinite(s.opacity)) s.opacity = 1;\n if (!Number.isFinite(s.seed)) s.seed = 0;\n if (s.interaction) normalizeWaveInteraction(s); // present-only; absence stays inert\n if (s.particles) normalizeParticles(s); // present-only; absence = no field for this wave\n}\n\n/** Backfill scene-level defaults (background/camera/post/lights/quality/mirror). */\nexport function ensureSceneDefaults(config: StudioConfig): void {\n normalizeBackground(config);\n ensureCamera(config);\n if (!Number.isFinite(config.ambient)) config.ambient = 0.45;\n if (!Array.isArray(config.lights)) config.lights = [];\n normalizeLights(config);\n if (!Number.isFinite(config.quality)) config.quality = 1;\n if (!Number.isFinite(config.dprMax)) config.dprMax = 2;\n if (!Number.isFinite(config.grain)) config.grain = 1.1;\n if (!Number.isFinite(config.blur)) config.blur = 0.02;\n if (!Number.isFinite(config.blurSamples)) config.blurSamples = 6;\n if (!Number.isFinite(config.bloomStrength)) config.bloomStrength = 0;\n if (!Number.isFinite(config.bloomRadius)) config.bloomRadius = 0.4;\n if (!Number.isFinite(config.bloomThreshold)) config.bloomThreshold = 0.85;\n if (!Number.isFinite(config.dither)) config.dither = 0;\n if (!Number.isFinite(config.ditherScale)) config.ditherScale = 2;\n if (!Number.isFinite(config.ditherSteps)) config.ditherSteps = 4;\n if (!Number.isFinite(config.innerLight)) config.innerLight = 0;\n if (!Number.isFinite(config.innerLightDensity)) config.innerLightDensity = 0.5;\n if (!Number.isFinite(config.innerLightDecay)) config.innerLightDecay = 0.95;\n if (!Number.isFinite(config.innerLightX)) config.innerLightX = 0.5;\n if (!Number.isFinite(config.innerLightY)) config.innerLightY = 0.15;\n if (!Number.isFinite(config.halftone)) config.halftone = 0;\n if (!Number.isFinite(config.halftoneCell)) config.halftoneCell = 6;\n if (!Number.isFinite(config.halftoneAngle)) config.halftoneAngle = 0.4;\n if (!Number.isFinite(config.heatmap)) config.heatmap = 0;\n if (!Number.isFinite(config.paperTexture)) config.paperTexture = 0;\n if (!Number.isFinite(config.paperTextureScale)) config.paperTextureScale = 2;\n if (!Number.isFinite(config.halftoneCmyk)) config.halftoneCmyk = 0;\n if (!Number.isFinite(config.halftoneCmykCell)) config.halftoneCmykCell = 6;\n // particles is present-only (like interaction): NOT backfilled here — absence is off.\n if (typeof config.showCameraRig !== \"boolean\") config.showCameraRig = false;\n if (typeof config.paused !== \"boolean\") config.paused = false;\n // Not clamped to the studio slider's 0..60: a driver stepping a paused scene frame by frame\n // (the embed's timeOffset drive) legitimately passes any finite phase.\n if (!Number.isFinite(config.timeOffset)) config.timeOffset = 0;\n if (!Number.isFinite(config.loopSeconds)) config.loopSeconds = 0;\n if (typeof config.mirrorH !== \"boolean\") config.mirrorH = false;\n if (typeof config.mirrorV !== \"boolean\") config.mirrorV = false;\n // NOTE: `interaction` (scene + per-wave) is deliberately NOT backfilled — absence is semantically\n // \"off\" and keeps the compiled shader byte-identical. The present-only normalizers below run from\n // ensureStudioConfig / normalizeWave only when a block is actually present.\n}\n\n/** Clamp an untrusted numeric field, falling back to `dflt` when it isn't a finite number. */\nfunction clampNumber(v: unknown, min: number, max: number, dflt: number): number {\n const n = Number(v);\n return Number.isFinite(n) ? clamp(n, min, max) : dflt;\n}\n\n/** Coerce an untrusted field to a finite number, falling back to `dflt`. Deliberately does NOT\n * clamp — it repairs broken values without reinterpreting out-of-range ones that a saved config\n * may legitimately rely on. */\nfunction num(v: unknown, dflt: number): number {\n const n = Number(v);\n return Number.isFinite(n) ? n : dflt;\n}\n\n/**\n * Repair the ELEMENTS of the scene's `lights` and a wave's `noiseBands`. Both arrays are\n * type-checked where they're backfilled, but their entries never were — and the studio binds every\n * field below directly, so one hand-authored `\"lights\": [{}]` was enough to make the whole control\n * panel unbuildable. Entries that aren't objects at all are dropped.\n */\nfunction normalizeLights(config: StudioConfig): void {\n config.lights = config.lights.filter((l) => typeof l === \"object\" && l !== null);\n for (const l of config.lights) {\n if (typeof l.position !== \"object\" || l.position === null) {\n l.position = { ...DEFAULT_LIGHT_POSITION };\n }\n l.position.x = num(l.position.x, DEFAULT_LIGHT_POSITION.x);\n l.position.y = num(l.position.y, DEFAULT_LIGHT_POSITION.y);\n l.position.z = num(l.position.z, DEFAULT_LIGHT_POSITION.z);\n if (typeof l.color !== \"string\") l.color = \"#ffffff\";\n l.intensity = num(l.intensity, 1);\n }\n}\n\nfunction normalizeNoiseBands(s: WaveConfig): void {\n s.noiseBands = s.noiseBands.filter((b) => typeof b === \"object\" && b !== null);\n const d = createNoiseBand();\n for (const b of s.noiseBands) {\n b.startX = num(b.startX, d.startX);\n b.endX = num(b.endX, d.endX);\n b.startY = num(b.startY, d.startY);\n b.endY = num(b.endY, d.endY);\n b.feather = num(b.feather, d.feather);\n b.strength = num(b.strength, d.strength);\n b.frequency = num(b.frequency, d.frequency);\n b.colorAttenuation = num(b.colorAttenuation, d.colorAttenuation);\n b.parabolaPower = num(b.parabolaPower, d.parabolaPower);\n }\n}\n\n/** True for a valid interaction source string: a built-in name or a non-empty `custom:<name>`. */\nfunction isInteractionSource(v: unknown): v is InteractionSource {\n return (\n typeof v === \"string\" &&\n ((INTERACTION_SOURCE_NAMES as readonly string[]).includes(v) ||\n (v.startsWith(\"custom:\") && v.length > \"custom:\".length))\n );\n}\n\n/** Rebuild an untrusted bindings array into valid bindings for `valid` targets (loaded share-links /\n * presets are untrusted JSON; we validate source/target/to and rebuild clean objects). */\nfunction cleanBindings<T extends string>(\n raw: unknown,\n valid: readonly string[],\n): Array<InteractionBindingBase & { target: T }> {\n const out: Array<InteractionBindingBase & { target: T }> = [];\n if (!Array.isArray(raw)) return out;\n for (const item of raw) {\n if (!item || typeof item !== \"object\") continue;\n const b = item as Record<string, unknown>;\n if (!isInteractionSource(b.source)) continue;\n if (!valid.includes(b.target as string)) continue;\n const to = Number(b.to);\n if (!Number.isFinite(to)) continue;\n const clean: InteractionBindingBase & { target: T } = {\n source: b.source,\n target: b.target as T,\n to,\n };\n if (b.from !== undefined) {\n const f = Number(b.from);\n if (Number.isFinite(f)) clean.from = f;\n }\n if (b.smoothing !== undefined) clean.smoothing = clampNumber(b.smoothing, 0, 2, 0.25);\n out.push(clean);\n }\n return out;\n}\n\n/**\n * Present-only normalizer for a WAVE's interaction block: clamp the hover/press numerics that are\n * present (absent fields stay absent, so the block stays lean and the renderer's defaults apply) and\n * drop bindings with an unknown source/target or a non-finite `to`. NEVER call when the block is\n * absent — absence is inert and byte-identical (normalizeWave gates on presence).\n */\nexport function normalizeWaveInteraction(wave: WaveConfig): void {\n const it = wave.interaction;\n if (!it) return;\n const h = it.hover;\n if (h) {\n if (h.agitate !== undefined) h.agitate = clampNumber(h.agitate, 0, 60, 0);\n if (h.push !== undefined) h.push = clampNumber(h.push, -40, 40, 0);\n if (h.wake !== undefined) h.wake = clampNumber(h.wake, 0, 40, 0);\n if (h.thin !== undefined) h.thin = clampNumber(h.thin, 0, 1, 0);\n if (h.hueShift !== undefined) h.hueShift = clampNumber(h.hueShift, -360, 360, 0);\n if (h.lighten !== undefined) h.lighten = clampNumber(h.lighten, -1, 1, 0);\n if (h.smoothing !== undefined) h.smoothing = clampNumber(h.smoothing, 0, 2, 0.12);\n }\n if (it.press && it.press.ripple !== undefined) {\n it.press.ripple = clampNumber(it.press.ripple, 0, 60, 0);\n }\n if (it.bindings !== undefined) {\n it.bindings = cleanBindings<WaveInteractionTarget>(it.bindings, WAVE_TARGET_NAMES);\n }\n}\n\n/** Present-only normalizer for the SCENE interaction block: clamp the shared pointer inputs and drop\n * invalid scene bindings. NEVER call when the block is absent. */\nexport function normalizeSceneInteraction(config: StudioConfig): void {\n const it = config.interaction;\n if (!it) return;\n if (it.radius !== undefined) it.radius = clampNumber(it.radius, 0.02, 2, 0.3);\n if (it.ribbonFlow !== undefined) it.ribbonFlow = clampNumber(it.ribbonFlow, 0, 1, 0.8);\n if (it.bindings !== undefined) {\n it.bindings = cleanBindings<SceneInteractionTarget>(it.bindings, SCENE_TARGET_NAMES);\n }\n}\n\n/**\n * Present-only normalizer for the scene PARTICLES block: clamp the numerics that are present and\n * repair the required fields, leaving absent optionals absent (so the block stays lean). NEVER call\n * when the block is absent — absence is off and byte-identical (ensureStudioConfig gates on presence).\n */\nexport function normalizeParticles(wave: WaveConfig): void {\n const p = wave.particles;\n if (!p) return;\n p.count = clampNumber(p.count, 0, 40000, 0);\n p.size = clampNumber(p.size, 0, 200, 2);\n p.seed = num(p.seed, 0);\n if (p.sizeJitter !== undefined) p.sizeJitter = clampNumber(p.sizeJitter, 0, 1, 0);\n if (p.color !== undefined && typeof p.color !== \"string\") p.color = \"#ffcf8a\";\n if (p.life !== undefined) p.life = clampNumber(p.life, 0.1, 60, 6);\n if (p.speed !== undefined) p.speed = clampNumber(p.speed, 0, 8, 1);\n if (p.twinkle !== undefined) p.twinkle = clampNumber(p.twinkle, 0, 1, 0);\n if (p.color2 !== undefined && typeof p.color2 !== \"string\") p.color2 = \"#ffcf8a\";\n if (p.edgeBias !== undefined) p.edgeBias = clampNumber(p.edgeBias, 0, 1, 1);\n if (p.drift !== undefined) p.drift = num(p.drift, 0);\n if (p.bias !== undefined) p.bias = clampNumber(p.bias, -1, 1, 0);\n if (p.rise !== undefined) p.rise = num(p.rise, 0);\n if (p.swirl !== undefined) p.swirl = num(p.swirl, 0);\n if (p.wander !== undefined) p.wander = num(p.wander, 0);\n if (p.shape !== undefined && !PARTICLE_SHAPES.includes(p.shape)) p.shape = \"glitter\";\n}\n\n/** Normalize an ingested config to the wave model: backfill the scene + every wave, and drop in\n * a default wave if none are present. Idempotent, so it is safe on the renderer's own config as\n * well as freshly loaded save-states / share links. */\nexport function ensureStudioConfig(input: StudioConfig): StudioConfig {\n const config = input;\n ensureSceneDefaults(config);\n if (!Array.isArray(config.waves) || config.waves.length === 0) {\n config.waves = [makeWave()];\n }\n // each wave's normalizeWave runs normalizeWaveInteraction + normalizeParticles (both present-only)\n config.waves.forEach(normalizeWave);\n config.waveCount = config.waves.length;\n // Present-only: a config without a scene `interaction` block is left untouched (\"off\").\n if (config.interaction) normalizeSceneInteraction(config);\n return config;\n}\n"],"mappings":";;;;;;;;AASA,MAAa,aAAa;AAC1B,MAAa,kBAAkB;AAC/B,MAAa,aAAa;AAC1B,MAAa,kBAAkB;;AAE/B,MAAa,YAAY;;AAoCzB,MAAa,cAAoC;CAAC;CAAS;CAAW;CAAS;AAAQ;;AAcvF,SAAgB,YACd,WAAiB;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;AAAI,GAC1C,YAAY,GACC;CACb,OAAO;EAAE,UAAU,EAAE,GAAG,SAAS;EAAG,OAAO;EAAW;CAAU;AAClE;;;;AAKA,MAAa,yBAA+B;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;AAAK;;AAyBtE,SAAgB,kBAA6B;CAC3C,OAA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I,CAAC,MAAM,QAAQ,OAAO,KAAK,KAAK,OAAO,MAAM,WAAW,GAC1D,OAAO,QAAQ,CAAC,SAAS,CAAC;CAG5B,OAAO,MAAM,QAAQ,aAAa;CAClC,OAAO,YAAY,OAAO,MAAM;CAEhC,IAAI,OAAO,aAAa,0BAA0B,MAAM;CACxD,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"model.js","names":[],"sources":["../../src/config/model.ts"],"sourcesContent":["/**\n * Configuration schema for the wave: a flat sheet displaced by noise (X/Z frequency\n * + amount) then twisted by three axis-rotations (twistFrequency + twistPower per\n * axis), then scaled / rotated / positioned. Plain JSON — doubles as the save-state\n * format.\n */\n\nimport { clamp, clamp01 } from \"../util/math\";\n\nexport const MAX_COLORS = 8;\nexport const MAX_MESH_POINTS = 8;\nexport const MAX_LIGHTS = 8;\nexport const MAX_NOISE_BANDS = 4;\n/** Cap on stacked waves (keeps total geometry bounded — see WaveRenderer segment scaling). */\nexport const MAX_WAVES = 6;\n\nexport interface Vec2 {\n x: number;\n y: number;\n}\n\nexport interface Vec3 {\n x: number;\n y: number;\n z: number;\n}\n\n// \"squared\" = the hero material blend: SrcColor × Zero (framebuffer = fragColor²), which\n// deepens the colours — the faithful default. \"normal\"/\"additive\"/\"multiply\" are authoring\n// overrides (\"multiply\" darkens where waves/background overlap).\nexport type BlendMode = \"squared\" | \"normal\" | \"additive\" | \"multiply\";\n\n/** How the palette is mapped across the surface. */\nexport type BasicGradientType = \"linear\" | \"radial\" | \"conic\";\nexport type GradientType = BasicGradientType | \"mesh\";\n\nexport type BackgroundMode = \"color\" | \"gradient\" | \"image\";\nexport type BackgroundImageFit = \"cover\" | \"contain\" | \"stretch\";\n\n/** How the authored reference frame (FRAME_W × FRAME_H, a 16:9 rectangle centred on cameraTarget)\n * is mapped onto a canvas of a different aspect:\n * - `cover` — fill both axes, crop the overflow. The default and the hero look.\n * - `contain` — fit the whole frame, revealing world beyond it on the long axis.\n * - `width` — always bind on width, so the horizontal composition is identical at every aspect.\n * Above 16:9 this is exactly `cover`; below it, it reveals vertically instead of cropping.\n * - `height` — always bind on height (the mirror of `width`).\n * Pair with `cameraMinVisibleWidth` to land between `cover` and `width`. */\nexport type CameraFit = \"cover\" | \"contain\" | \"width\" | \"height\";\n\n/** Runtime whitelist for {@link CameraFit} (validating imported/serialized configs). */\nexport const CAMERA_FITS: readonly CameraFit[] = [\"cover\", \"contain\", \"width\", \"height\"];\n\n/** What fills the 2D palette texture: the baked hero LUT, our editable stops, or\n * a named built-in map (see PALETTE_MAPS). Any string is allowed for forward-compat. */\nexport type PaletteSource = \"hero\" | \"stops\" | (string & {});\n\n/** A positionable light. `position` lives in the same 3D space as the wave. */\nexport interface LightConfig {\n position: Vec3;\n color: string;\n intensity: number;\n}\n\n/** A default light; pass overrides for added fill lights. */\nexport function createLight(\n position: Vec3 = { x: 300, y: 500, z: 800 },\n intensity = 1,\n): LightConfig {\n return { position: { ...position }, color: \"#ffffff\", intensity };\n}\n\n/** Where the first light lands when you engage lights from an empty scene. Shared by the\n * \"drag in 3D\" control and the camera-rig minimap, which previews a light marker here so the\n * rig always shows the light — even before one has been explicitly added. */\nexport const DEFAULT_LIGHT_POSITION: Vec3 = { x: 800, y: 900, z: 1100 };\n\n/**\n * A noise band: inside a rectangular uv region, softened by `feather`, the fiber streaks\n * are overridden — strength, frequency (density), colourAttenuation (how much the local\n * colour suppresses them), and the edge-weighting parabolaPower. Lets the fibers vary\n * per region instead of uniform.\n *\n * Mind the axes, which are the reverse of what the names suggest: the bounds gate on uv,\n * and uv.x is the folded WIDTH while uv.y is the LENGTH (see WaveGeometry's UV AXES note).\n * So startX..endX span the SHORT axis and startY..endY run end to end.\n */\nexport interface NoiseBand {\n startX: number;\n endX: number;\n startY: number;\n endY: number;\n feather: number;\n strength: number;\n frequency: number;\n colorAttenuation: number;\n parabolaPower: number;\n}\n\n/** A default band: a strong, coarse streak region over the first half. */\nexport function createNoiseBand(): NoiseBand {\n return {\n startX: 0.0,\n endX: 0.5,\n startY: 0.0,\n endY: 1.0,\n feather: 0.3,\n strength: 1.0,\n frequency: 220,\n colorAttenuation: 0.0,\n parabolaPower: 2.0,\n };\n}\n\n/** One gradient stop: a colour at a normalized position (0–1) along the gradient ramp, whose\n * direction on the ribbon is set by `gradientType` / `gradientAngle`. */\nexport interface ColorStop {\n color: string;\n pos: number;\n}\n\n/** One colour influence point in the 2D mesh-gradient field. */\nexport interface MeshGradientPoint {\n color: string;\n /** Horizontal UV position (0–1). */\n x: number;\n /** Vertical UV position (0–1). */\n y: number;\n /** Relative reach of this point's colour field. */\n influence: number;\n}\n\n/** Build evenly-spaced stops from a plain list of colours. */\nexport function makeStops(colors: string[]): ColorStop[] {\n const n = colors.length;\n return colors.map((color, i) => ({ color, pos: n > 1 ? i / (n - 1) : 0 }));\n}\n\n/** A balanced iOS-style field shown the first time Mesh is selected. */\nexport function createDefaultMeshPoints(): MeshGradientPoint[] {\n return [\n { color: \"#5e5ce6\", x: 0.08, y: 0.12, influence: 0.78 },\n { color: \"#64d2ff\", x: 0.88, y: 0.08, influence: 0.72 },\n { color: \"#ff375f\", x: 0.12, y: 0.88, influence: 0.72 },\n { color: \"#ff9f0a\", x: 0.9, y: 0.86, influence: 0.78 },\n { color: \"#bf5af2\", x: 0.5, y: 0.48, influence: 0.58 },\n ];\n}\n\n/**\n * A single wave: a COMPLETE, self-contained wave — its own shape, twist, colour, finish,\n * transform and blend. Stacking waves composites independent waves; there is no shared\n * \"base wave\" any more, so nothing is duplicated between a global section and the waves.\n * Field names mirror the legacy top-level wave fields so migration + the per-section helpers\n * (normalizeWaveColour, randomize*) map 1:1.\n */\nexport interface WaveConfig {\n // Colour & gradient\n palette: ColorStop[];\n gradientType: GradientType;\n gradientAngle: number;\n gradientShift: number;\n meshGradientPoints: MeshGradientPoint[];\n meshGradientSoftness: number;\n usePaletteTexture: boolean;\n paletteSource: PaletteSource;\n paletteImageUrl?: string;\n paletteVideoUrl?: string;\n paletteTextureScale: Vec2;\n paletteTextureOffset: Vec2;\n paletteTextureRotation: number;\n /** Palette-offset drift per second (animates colour independently of the geometry; 0 = static).\n * Applies to any texture palette (not mesh / procedural stops). */\n paletteDriftX: number;\n paletteDriftY: number;\n paletteEdgeColor: string;\n paletteEdgeAmount: number;\n hueShift: number;\n colorContrast: number;\n colorSaturation: number;\n // Surface finish\n fiberCount: number;\n fiberStrength: number;\n noiseBands: NoiseBand[];\n texture: number;\n creaseLight: number;\n creaseSharpness: number;\n creaseSoftness: number;\n sheen: number;\n roundness: number;\n /** Thin-film / holographic hue response that shifts with view angle (0 = off). */\n iridescence: number;\n edgeFade: number;\n /** Softness of the ribbon's two ENDS — it smoothsteps on uv.y, which is the length, not the\n * long edges. 0.1 = the original hardcoded value; smaller = razor-crisp graphic ribbons,\n * larger = soft vapor. */\n edgeFeather: number;\n /** Depth tint (solid theme): fade far fragments toward depthTintColor for atmospheric\n * separation in multi-wave stacks (0 = off). */\n depthTint: number;\n depthTintColor: string;\n // Displacement + twist (the wave shape)\n displaceFrequency: Vec2;\n displaceAmount: number;\n /** Optional 2nd displacement octave: finer ripples riding on the broad swell (amount 0 = off). */\n detailFrequency: number;\n detailAmount: number;\n twistFrequency: Vec3;\n twistPower: Vec3;\n twistMotion?: boolean;\n /** Helix: sweep the ribbon around its OWN length axis, `helixTurns` full turns from end to end.\n * The three twists above can't express this — their axes sit 45°/90° off the length, and\n * `expStep` is a monotone falloff, so nothing they do ever repeats. This angle is periodic in the\n * length coordinate instead, which is what makes a helix (and a DNA ladder) reachable.\n * 0 turns still leaves the block inert unless radius or roll is non-zero. */\n helixTurns?: number;\n /** Carries the WHOLE ribbon around the axis at this radius (world units, pre-scale), keeping its\n * orientation. A narrow ribbon then reads as a single strand — two waves half a turn apart in\n * `helixPhase` are the two strands of a double helix. 0 = off. */\n helixRadius?: number;\n /** Rolls the ribbon's own cross-section about the axis as it advances, as a fraction of\n * `helixTurns` (1 = rolls exactly in step, a rigid twisted ribbon). That swings the ribbon's two\n * long edges onto opposite sides of the axis, so ONE wave becomes a ladder whose edges are both\n * strands — pair it with `rungAmount` for the rungs between them. 0 = off. */\n helixRoll?: number;\n /** Phase offset in degrees — where along the turn the ribbon starts. The per-wave knob that puts\n * a second wave on the opposite side of the same helix (180). */\n helixPhase?: number;\n /** Radial fan (optional): sweep the ribbon's length into a plume/peacock spread from the local\n * origin. The three twists and the helix can't reach it — this maps the ribbon to polar so the\n * combed fibers ({@link fiberCount}) read as the individual radial strands. Placement is the wave's\n * `position` transform (there is no separate pivot). Runs AFTER displace/helix/twist, behind\n * `#ifdef RADIAL`, so `radialAmount` 0 leaves the block uncompiled and the wave byte-identical. */\n radialAmount?: number; // 0..1 gate + blend (0 = off / identity)\n radialArc?: number; // fan spread, degrees\n radialSpread?: number; // along-length → radius scale\n radialRadius?: number; // source / inner radius (world units, pre-scale)\n radialCenter?: number; // base angle, degrees\n // Material (\"solid\" surface vs \"wireframe\" line shader)\n theme?: \"solid\" | \"wireframe\";\n lineAmount?: number;\n lineThickness?: number;\n lineDerivativePower?: number;\n /** Wireframe RUNGS: a second line family carved at constant uv.y, so these run ACROSS the ribbon\n * where `lineAmount`'s run along it — the two cross into a ladder. Frequency, like `lineAmount`\n * (rungs ≈ amount / π). 0 = off, and the cross-wise path isn't compiled. */\n rungAmount?: number;\n /** Rung line width, in pixels (screen-space, so it holds at any zoom). */\n rungThickness?: number;\n maxWidth?: number;\n // Transform (absolute — no shared base to offset from)\n position: Vec3;\n rotation: Vec3;\n scale: Vec3;\n // Compositing\n blendMode: BlendMode;\n /** Absolute animation speed for this wave (legacy global speed × per-layer multiplier). */\n speed: number;\n /** Overall opacity of this wave. */\n opacity: number;\n /** Phase/seed so waves don't move in lockstep. */\n seed: number;\n /** Optional per-wave interactivity: how THIS wave reacts to the shared pointer + inputs (hover\n * field, click ripples, param bindings). ABSENT = this wave is inert / byte-identical. */\n interaction?: WaveInteractionConfig;\n /** Optional per-wave particle / dust field emitted off THIS wave's deformed surface / edge.\n * ABSENT ⇒ off (no THREE.Points for this wave, byte-identical). See {@link ParticlesConfig}. */\n particles?: ParticlesConfig;\n}\n\n// ---------------------------------------------------------------------------------------------\n// Interactivity layer (optional, additive, default-off). Split by concern: the SHARED inputs (one\n// cursor + scroll + smoothing/touch) and scene-param effects live on SceneConfig.interaction; each\n// wave's own RESPONSE (hover field, click ripples, param bindings) lives on WaveConfig.interaction.\n// ABSENT blocks mean fully off — the compiled shader and rendered pixels stay byte-identical to a\n// non-interactive wave (the normalizers below run present-only; ensureSceneDefaults never calls them).\n// ---------------------------------------------------------------------------------------------\n\n/** The built-in interaction input names (the open-ended `custom:*` family is handled separately).\n * Kept in sync by hand with the {@link InteractionSource} union below. */\nconst INTERACTION_SOURCE_NAMES = [\n \"scroll\",\n \"hover\",\n \"pointerX\",\n \"pointerY\",\n \"pointerSpeed\",\n \"press\",\n \"scrollVelocity\",\n \"appear\",\n] as const;\n\n/**\n * An interaction INPUT: a normalized signal that can smoothly drive config params through an\n * {@link InteractionBinding}. Every source is exponentially smoothed before it is applied.\n */\nexport type InteractionSource =\n | \"scroll\" // container progress through the viewport, 0 (entering) .. 1 (scrolled past)\n | \"hover\" // smoothed pointer presence over the container, 0..1\n | \"pointerX\" // smoothed pointer X across the container, 0..1; relaxes to 0.5 on leave\n | \"pointerY\" // smoothed pointer Y across the container, 0..1; relaxes to 0.5 on leave\n | \"pointerSpeed\" // normalized smoothed pointer speed, 0..1\n | \"press\" // pointer button / touch held, smoothed 0..1\n | \"scrollVelocity\" // normalized smoothed |d(scroll progress)/dt|, 0..1\n | \"appear\" // one-shot 0→1 latch on first visibility (entrance choreography)\n | `custom:${string}`; // developer-fed each frame via setInteractionInput(name, value)\n\n/** Per-WAVE params a binding may drive. Single source of truth for WAVE_APPLIERS in\n * renderer/interaction.ts (checked via `satisfies`) and validated by normalizeWaveInteraction. */\nconst WAVE_TARGET_NAMES = [\n \"displaceAmount\",\n \"detailAmount\",\n \"twistPowerX\",\n \"twistPowerY\",\n \"twistPowerZ\",\n \"twistFrequencyX\",\n \"twistFrequencyY\",\n \"twistFrequencyZ\",\n \"helixPhase\",\n \"helixTurns\",\n \"helixRadius\",\n \"hueShift\",\n \"gradientShift\",\n \"colorSaturation\",\n \"opacity\",\n \"lineThickness\",\n \"lineAmount\",\n \"fiberStrength\",\n \"sheen\",\n \"iridescence\",\n \"positionX\",\n \"positionY\",\n] as const;\n/** A per-wave param a {@link WaveInteractionBinding} can drive. */\nexport type WaveInteractionTarget = (typeof WAVE_TARGET_NAMES)[number];\n\n/** SCENE params a binding may drive (post / camera / time — shared, not per wave). Single source of\n * truth for SCENE_APPLIERS in renderer/interaction.ts, validated by normalizeSceneInteraction. */\nconst SCENE_TARGET_NAMES = [\"timeOffset\", \"cameraZoom\", \"blur\", \"grain\"] as const;\n/** A scene-level param a {@link SceneInteractionBinding} can drive. */\nexport type SceneInteractionTarget = (typeof SCENE_TARGET_NAMES)[number];\n\n/** Shared fields of an input→param binding: per frame `value = mix(from ?? authoredBase, to,\n * smoothedSource)`, written straight to uniforms — never mutates config, so any refresh restores\n * the authored base (removal needs no undo step). */\ninterface InteractionBindingBase {\n /** The input signal driving this binding. */\n source: InteractionSource;\n /** Value at source = 0. OMITTED = the authored base value, so at rest the authored look shows. */\n from?: number;\n /** Value at source = 1. */\n to: number;\n /** Exponential smoothing time constant, seconds (default 0.25); also shapes the `appear` ramp. */\n smoothing?: number;\n}\n/** A binding on a wave, driving one of that wave's params. */\nexport interface WaveInteractionBinding extends InteractionBindingBase {\n target: WaveInteractionTarget;\n}\n/** A scene-level binding, driving a shared scene param. */\nexport interface SceneInteractionBinding extends InteractionBindingBase {\n target: SceneInteractionTarget;\n}\n\n/** Hover pointer-field: localized effects that follow the cursor over this wave. Present ⇒ the\n * POINTER_FX shader path compiles for this wave; an absent effect is 0 (inert). */\nexport interface WaveHoverConfig {\n /** Local churn-octave amplitude near the cursor — the wave agitates under the pointer. The studio\n * defaults this positive when you enable a hover field, so a fresh hover reacts out of the box. */\n agitate?: number;\n /** Membrane push/pull: a smooth dome at the cursor that swells toward you (repel, +) or dents away\n * (attract, −), carried by the sprung field so it drags like a poke under fabric. World units;\n * 0 = off. */\n push?: number;\n /** Drag-wake: while the cursor moves, the surface just BEHIND it is pulled into a trailing trough\n * that heals once you stop; scales with pointer speed. World units; 0 = off. */\n wake?: number;\n /** 0..1 — wireframe strands taper to hairlines; solid gains local translucency. */\n thin?: number;\n /** Local hue rotation near the cursor, degrees. */\n hueShift?: number;\n /** Local brightness lift near the cursor, -1..1. */\n lighten?: number;\n /** Pointer-follow smoothing for THIS wave's hover field, seconds — how quickly the swell trails\n * the cursor. Vary it across a stack so strands lag at different rates (a parallax drag).\n * Default 0.12. */\n smoothing?: number;\n}\n\n/** Click / touch pointer-field: what a tap or click on this wave triggers. */\nexport interface WavePressConfig {\n /** Click-ripple amplitude; 0 keeps this wave's POINTER_RIPPLES path uncompiled. */\n ripple?: number;\n}\n\n/** Per-wave interactivity: this wave's own reaction to the shared pointer + inputs. ABSENT ⇒ inert. */\nexport interface WaveInteractionConfig {\n /** Hover field (cursor-follow agitation / thinning / hue-lighten). */\n hover?: WaveHoverConfig;\n /** Click & touch (ripples radiating from a tap/click on this wave). */\n press?: WavePressConfig;\n /** Input→param bindings driving THIS wave's params (any source, incl. scroll / hover / custom). */\n bindings?: WaveInteractionBinding[];\n}\n\n/** Scene-level interactivity: the SHARED inputs (one cursor + scroll, touch) plus bindings that\n * drive shared scene params. Pointer-follow smoothing is per-wave (see WaveHoverConfig.smoothing).\n * ABSENT ⇒ inputs use defaults; `enabled: false` is the master OFF switch for the whole layer. */\nexport interface SceneInteractionConfig {\n /** Master switch for the whole interaction layer. Default true (only `false` turns it all off). */\n enabled?: boolean;\n /** Pointer falloff radius, as a fraction of viewport height. Default 0.3. */\n radius?: number;\n /** Ribbon flow (0..1, default 0.8): stretch the pointer footprint along each wave's own length axis\n * so the influence reaches ALONG the ribbon instead of as a circular screen disc. On by default;\n * set 0 for the plain circle. Scene-level (shared like `radius`); each wave uses its own length\n * tangent. Only affects waves that already react to the cursor (non-interactive waves are inert). */\n ribbonFlow?: number;\n /** Follow coarse (touch) pointers. Default false — touch is ignored unless this is true. */\n touch?: boolean;\n /** Input→param bindings driving SCENE params (timeOffset, cameraZoom, blur, grain). */\n bindings?: SceneInteractionBinding[];\n}\n\n/**\n * A WAVE's field of additive GPU sprites (dust / sparkle). Lives on {@link WaveConfig} — particles\n * belong to a wave, not the scene. ABSENT ⇒ off: no THREE.Points node is created for that wave and its\n * render is byte-identical; present ⇒ {@link normalizeParticles} clamps it. Every particle's motion is a\n * pure function of `uTime` + a per-particle seed baked from `seed`, so it is deterministic (timeOffset\n * scrub / loopSeconds / paused all hold). Particles spawn on the OWNING wave's DEFORMED surface / edge\n * (via the shared waveShape) and drift outward from the wave centre.\n */\n/** How each particle sprite is drawn (a per-field render style, not per-particle). All but\n * \"sprite\" are drawn procedurally from `gl_PointCoord`; \"sprite\" samples {@link\n * ParticlesConfig.spriteUrl} and falls back to \"glitter\" until that image has rasterized. */\nexport type ParticleShape = \"glitter\" | \"soft\" | \"ring\" | \"star\" | \"streak\" | \"sprite\";\nexport const PARTICLE_SHAPES: readonly ParticleShape[] = [\n \"glitter\",\n \"soft\",\n \"ring\",\n \"star\",\n \"streak\",\n \"sprite\",\n];\n\nexport interface ParticlesConfig {\n count: number; // total sprites (clamped in normalizeParticles)\n size: number; // base sprite size, px\n seed: number; // PRNG seed → reproducible layout\n sizeJitter?: number; // 0..1 per-particle size variance\n color?: string; // sprite colour (warm gold default)\n /** Second sprite colour — particles interpolate between `color` and this by their seed (two-tone dust). */\n color2?: string;\n life?: number; // seconds per birth→death cycle\n /** Motion-speed multiplier for the dust: how fast particles cycle + drift (1 = default, 0 = frozen).\n * Independent of the wave's own `speed` (which animates the surface the dust rides). Under a seamless\n * `loopSeconds` it snaps to a whole number of cycles so the loop stays seamless. */\n speed?: number;\n twinkle?: number; // 0..1 brightness flicker\n /** Where on the wave particles spawn: 0 = across the whole SURFACE, 1 = the outer rim / EDGE only. */\n edgeBias?: number;\n /** How far particles drift outward from the wave centre as they age (world units). */\n drift?: number;\n /** −1..1 skew of the spawn along the edge width toward one flank (0 = even, −1 → one side, +1 → other). */\n bias?: number;\n /** Screen-vertical buoyancy over a lifetime, world units: + rises (embers), − falls (snow / ash). */\n rise?: number;\n /** Orbit around the wave centre in the screen plane, turns per lifetime (swirls the dust). */\n swirl?: number;\n /** Curl-noise turbulence: particles meander (fireflies / motes) instead of moving in straight lines. */\n wander?: number;\n /** Sprite render style. Default \"glitter\" (the soft round additive disc). */\n shape?: ParticleShape;\n /**\n * Artwork for `shape: \"sprite\"` — an SVG (or raster) `data:` URI or URL, rasterized ONCE into a\n * square texture shared by every particle in the field, so the cost is one texture per field and\n * not per particle. Ignored unless `shape` is \"sprite\"; until it has loaded the field draws\n * \"glitter\", so a slow or broken image degrades instead of blanking.\n *\n * The sprite is TINTED by `color` / `color2` (multiplied), so the field's colour knobs keep\n * working — supply WHITE artwork to take the tint literally, or coloured artwork to modulate it.\n * Non-square art is letterboxed, because a point sprite is always square.\n *\n * Prefer SVG: it is a fraction of the bytes of an equivalent PNG, and the whole config (this\n * string included) is embedded in save-states and share links.\n */\n spriteUrl?: string;\n /**\n * How hard the cursor shoves dust that has already drifted OFF the surface, as a multiple of the\n * displacement the wave's own {@link WaveHoverConfig} field applies. Default 1; 0 = airborne motes\n * ignore the pointer. Only ever reads when the owning wave has a pointer field of its own — with\n * no `interaction.hover` there is nothing to shove with, and the point program compiles without\n * the pointer path at all.\n *\n * Dust still ATTACHED to the surface is not governed by this: a mote sitting on the ribbon always\n * takes the ribbon's own displacement (weighted by how far it has drifted), because otherwise a\n * cursor poke would lift the surface out from under its own glitter.\n */\n pointerShove?: number;\n}\n\n/**\n * Scene-level settings shared by every wave: output/background/camera/lights, the post-fx\n * pass (grain/blur), playback, quality, and the whole-composition mirror. Everything that\n * describes an individual wave lives on WaveConfig instead.\n */\nexport interface SceneConfig {\n background: string;\n transparentBackground: boolean;\n backgroundMode: BackgroundMode;\n backgroundPalette: ColorStop[];\n backgroundGradientType: GradientType;\n backgroundGradientAngle: number;\n backgroundGradientSource: PaletteSource;\n backgroundMeshPoints: MeshGradientPoint[];\n backgroundMeshSoftness: number;\n backgroundImageSource: PaletteSource;\n backgroundImageUrl?: string;\n backgroundVideoUrl?: string;\n backgroundImageFit: BackgroundImageFit;\n backgroundImageZoom: number;\n backgroundImagePosition: Vec2;\n /** Number of stacked waves (kept in sync with waves.length). */\n waveCount: number;\n quality: number;\n dprMax: number;\n paused: boolean;\n /** Noise phase offset — scrubs the noise pattern to pick a still frame. */\n timeOffset?: number;\n /** Seamless-loop period in seconds (0 = off). When >0, the motion is mapped onto a circle in\n * noise space so it repeats exactly every `loopSeconds` — scene-level so a multi-wave stack\n * shares one period and the whole composite loops. */\n loopSeconds?: number;\n introRamp?: boolean;\n showCameraRig: boolean;\n cameraDistance: number;\n cameraZoom: number;\n cameraPosition: Vec3;\n cameraTarget: Vec3;\n /** How the authored reference frame maps onto the canvas when their aspects differ.\n * Default `\"cover\"`. See {@link CameraFit}. */\n cameraFit?: CameraFit;\n /** Floor on how much of the authored frame's WIDTH stays on screen, as a fraction (0..1).\n * A ceiling on zoom applied AFTER {@link cameraFit}, so the two compose instead of fighting:\n * it only ever zooms out, and is inert for fits that already do (`contain`, `width`).\n *\n * This is the narrow-screen crop control. `cameraFit: \"cover\"` binds on height once the canvas\n * is narrower than the 16:9 reference, so a portrait phone (390×844 @ dpr 2) zooms 2.25× and\n * shows only ~26% of the authored width. `0.6` holds 60% of it on screen; `1` is equivalent to\n * `\"width\"`. Default 0 (off) — existing configs frame exactly as before.\n *\n * It clamps the BASE zoom, before the cameraZoom multiplier, which makes the fraction read\n * against your own composition rather than the raw constant: `1` shows exactly the horizontal\n * span you see at 16:9 whatever cameraZoom you authored at, and `0.6` shows 60% of that. */\n cameraMinVisibleWidth?: number;\n /** Film grain amount (post pass). */\n grain: number;\n /** Soft-focus / spin blur amount (post pass). */\n blur: number;\n blurSamples?: number;\n /** Bloom (post pass, UnrealBloomPass). strength 0 removes the pass entirely, so cost and pixels\n * are identical to bloom-off; radius/threshold only take effect once strength > 0. */\n bloomStrength?: number;\n bloomRadius?: number;\n bloomThreshold?: number;\n /** Ordered (Bayer) dithering over the finished composite — a self-contained \"layered\" post\n * shader in the spirit of paper-design/shaders. 0 removes the pass entirely (cost/pixels match\n * dither-off); scale & steps only bite once dither > 0. Runs last, after tone-map + sRGB. */\n dither?: number;\n /** Dither cell size in device pixels (>=1) — larger = chunkier pattern. */\n ditherScale?: number;\n /** Quantization levels per channel (>=2) — lower = heavier posterization. */\n ditherSteps?: number;\n /** Volumetric light streaks (innerLight) scattered from the bright wave toward a light point\n * (innerLightX/Y in UV). 0 removes the pass; density/decay/centre only bite once innerLight > 0.\n * Scene-zone (scatters the raw wave, like bloom). */\n innerLight?: number;\n innerLightDensity?: number;\n innerLightDecay?: number;\n innerLightX?: number;\n innerLightY?: number;\n /** Halftone: a rotated dot screen (dot size scales with local brightness) over the final image.\n * 0 removes the pass; cell/angle only bite once halftone > 0. Finish-zone stylization. */\n halftone?: number;\n halftoneCell?: number;\n halftoneAngle?: number;\n /** Heatmap recolour (luminance → thermal palette). 0 removes the pass. Finish-zone. */\n heatmap?: number;\n /** Paper-texture overlay (fibrous substrate shading). 0 removes the pass; scale = grain size. */\n paperTexture?: number;\n paperTextureScale?: number;\n /** CMYK halftone (four rotated dot screens). 0 removes the pass; cell = dot size px. */\n halftoneCmyk?: number;\n halftoneCmykCell?: number;\n /** Base ambient light level (0–1). */\n ambient: number;\n lights: LightConfig[];\n /** Mirror the whole composition on screen (world-space flip). */\n mirrorH: boolean;\n mirrorV: boolean;\n /** Shared interaction inputs (one cursor + scroll) + scene-param bindings. Per-wave response\n * lives on each WaveConfig.interaction. ABSENT = defaults; `enabled:false` disables the layer. */\n interaction?: SceneInteractionConfig;\n}\n\n/** The full save-state: scene settings + one or more complete waves. */\nexport interface StudioConfig extends SceneConfig {\n waves: WaveConfig[];\n}\n\n/** Spread a base wave into `count` overlapping waves — each with a slightly varied hue, width,\n * speed, phase, vertical offset and roll so a stack reads as one composition. `count === 1`\n * returns the base unchanged. Used to author multi-wave presets. */\nexport function makeWaveSpread(base: WaveConfig, count: number): WaveConfig[] {\n if (count <= 1) return [structuredClone(base)];\n const out: WaveConfig[] = [];\n for (let i = 0; i < count; i++) {\n const f = i / (count - 1);\n const w = structuredClone(base);\n w.opacity = 1.0 - f * 0.3;\n w.hueShift = base.hueShift + i * 18;\n w.scale = { x: base.scale.x, y: base.scale.y * (1 - f * 0.2), z: base.scale.z };\n w.speed = base.speed * (1 + f * 0.15);\n w.seed = i * 3.3;\n w.position = {\n x: base.position.x,\n y: base.position.y + (f - 0.5) * 1.5,\n z: base.position.z - i * 0.8,\n };\n w.rotation = { x: base.rotation.x, y: base.rotation.y, z: base.rotation.z + i * 20 };\n out.push(w);\n }\n return out;\n}\n\n/** The hero wave (a single complete wave) — the base for the default config and most presets. */\nfunction defaultWave(): WaveConfig {\n return {\n // The hero palette: a periwinkle tip/edge, a dominant orange core, then coral → magenta →\n // pink, with a violet twist tip. gradientShift warps it to mimic a baked 2D palette texture.\n palette: [\n { color: \"#8e9dff\", pos: 0 }, // periwinkle (blue tip/edge)\n { color: \"#c98fd0\", pos: 0.14 }, // lavender transition\n { color: \"#ff9326\", pos: 0.3 }, // orange (rising)\n { color: \"#fd8108\", pos: 0.52 }, // orange core\n { color: \"#fb7a36\", pos: 0.64 }, // orange-coral (keeps orange dominant)\n { color: \"#d24ecc\", pos: 0.78 }, // true magenta (hue ~303, not pink)\n { color: \"#e95cae\", pos: 0.9 }, // pink-magenta\n { color: \"#9b6ae0\", pos: 1.0 }, // violet (twist tip)\n ],\n gradientType: \"linear\",\n gradientAngle: 90, // 90° = the gradient runs ALONG the length (uv.x)\n gradientShift: 0.15,\n meshGradientPoints: createDefaultMeshPoints(),\n meshGradientSoftness: 0.62,\n usePaletteTexture: true, // default to the baked hero LUT\n paletteSource: \"hero\",\n paletteTextureScale: { x: 1, y: 1 },\n paletteTextureOffset: { x: 0, y: 0 },\n paletteTextureRotation: 0,\n paletteDriftX: 0,\n paletteDriftY: 0,\n paletteEdgeColor: \"#8e9dff\",\n paletteEdgeAmount: 0.3,\n hueShift: -1.81, // hero colorHueShift ≈ -1.81°\n colorContrast: 1.0,\n colorSaturation: 1.15,\n // Hero fibers: the surfaceColor fragment hardcodes freq 600 / strength 0.2; the line* fields\n // feed the wireframe theme (unused by the solid hero).\n fiberCount: 600,\n fiberStrength: 0.2,\n noiseBands: [],\n texture: 0,\n creaseLight: 0.6,\n creaseSharpness: 0.589,\n creaseSoftness: 1.0,\n // sheen 0 + roundness 0: the ortho crop makes crease low, so the hero look comes from the\n // SrcColor² blend + the palette, not the derivative white-lift.\n sheen: 0.0,\n roundness: 0.0,\n iridescence: 0,\n edgeFade: 0.04,\n edgeFeather: 0.1, // the original hardcoded ribbon-edge softness\n depthTint: 0,\n depthTintColor: \"#0a2540\",\n // Hero deformation on the native 400-unit folded() geometry.\n displaceFrequency: { x: 0.003234, y: 0.00799 },\n displaceAmount: 6.051,\n detailFrequency: 0.04, // finer than the base swell; only bites once detailAmount > 0\n detailAmount: 0,\n // Small twist frequencies + high powers — a gentle twist; the drama is the ortho crop.\n twistFrequency: { x: -0.055, y: 0.077, z: -0.518 },\n twistPower: { x: 3.95, y: 5.85, z: 6.33 },\n twistMotion: false,\n // Helix off: radius and roll both 0 leave the whole block uncompiled (see waveDefines).\n helixTurns: 0,\n helixRadius: 0,\n helixRoll: 0,\n helixPhase: 0,\n // Radial off: amount 0 leaves the RADIAL block uncompiled (see waveDefines).\n radialAmount: 0,\n radialArc: 160,\n radialSpread: 1,\n radialRadius: 40,\n radialCenter: 0,\n theme: \"solid\",\n lineAmount: 425, // wireframe-theme line params (defaults)\n lineThickness: 1,\n lineDerivativePower: 0.95,\n rungAmount: 0, // cross-wise rungs off\n rungThickness: 1,\n maxWidth: 1232,\n // Hero mesh transform at FULL scale (the ortho camera frames in pixels).\n position: { x: -24.3, y: -56.4, z: -11.1 },\n rotation: { x: -9.14, y: -16.25, z: -161.32 },\n scale: { x: 10, y: 10, z: 7 },\n blendMode: \"squared\", // the hero squaring blend (SrcColor²)\n speed: 0.04, // hero speed: 4e-5 vs ms-time ≈ 0.04/s\n opacity: 1,\n seed: 0,\n };\n}\n\n/** A fresh default wave (the hero wave as one complete wave). */\nexport function makeWave(): WaveConfig {\n return defaultWave();\n}\n\n/** Resize `waves` to match `waveCount`. New waves CLONE the last one (inherit every\n * property of the preceding wave); extras are dropped. */\nexport function resizeWaves(config: StudioConfig): void {\n const target = Math.max(1, Math.round(config.waveCount) || 1);\n if (!Array.isArray(config.waves) || config.waves.length === 0) {\n config.waves = [makeWave()];\n }\n while (config.waves.length < target) {\n config.waves.push(structuredClone(config.waves[config.waves.length - 1]));\n }\n while (config.waves.length > target) config.waves.pop();\n config.waveCount = config.waves.length;\n}\n\n/** The default studio config: the hero wave + its scene, in the canonical wave model. */\nexport function createDefaultConfig(): StudioConfig {\n return {\n background: \"#ffffff\",\n transparentBackground: true,\n backgroundMode: \"color\",\n backgroundPalette: makeStops([\"#0a2540\", \"#425466\", \"#7a73ff\", \"#f6f9fc\"]),\n backgroundGradientType: \"linear\",\n backgroundGradientAngle: 135,\n backgroundGradientSource: \"stops\",\n backgroundMeshPoints: createDefaultMeshPoints(),\n backgroundMeshSoftness: 0.62,\n backgroundImageSource: \"vaporwave\",\n backgroundImageFit: \"cover\",\n backgroundImageZoom: 1,\n backgroundImagePosition: { x: 0, y: 0 },\n waveCount: 1,\n quality: 1,\n dprMax: 2,\n paused: false,\n timeOffset: 0, // noise phase (scrub to pick a still)\n introRamp: true, // ease the animation in over ~1s on load (skipped in dev; see WaveRenderer.updateTime)\n showCameraRig: false,\n // The hero camera: ORTHOGRAPHIC at (100,0,5000) looking at the origin. The mesh is ×10 so\n // the wave overflows the frame and only the twist shows. cameraZoom is a user multiplier on\n // the responsive base zoom (1 = the hero crop); cameraTarget pans the look-at to the twist.\n cameraDistance: 5001,\n cameraPosition: { x: 100, y: 0, z: 5000 },\n cameraTarget: { x: -44, y: -250, z: 0 },\n cameraZoom: 1.0,\n cameraFit: \"cover\",\n cameraMinVisibleWidth: 0, // off — see the field docs for the narrow-screen crop control\n // Post (one pass over the whole composite): hero grain 1.1, blur 0.02.\n grain: 1.1,\n blur: 0.02,\n blurSamples: 6,\n dither: 0, // off by default — the hero look is unchanged (the pass isn't inserted)\n ditherScale: 2,\n ditherSteps: 4,\n innerLight: 0,\n innerLightDensity: 0.5,\n innerLightDecay: 0.95,\n innerLightX: 0.5,\n innerLightY: 0.15,\n halftone: 0,\n halftoneCell: 6,\n halftoneAngle: 0.4,\n heatmap: 0,\n paperTexture: 0,\n paperTextureScale: 2,\n halftoneCmyk: 0,\n halftoneCmykCell: 6,\n // particles is deliberately absent (off = byte-identical).\n ambient: 0.45,\n lights: [], // hero has no lights — colour is the palette + the SrcColor² blend\n mirrorH: false,\n mirrorV: false,\n waves: [defaultWave()],\n };\n}\n\n/** Clamp/backfill a single wave's colour + palette fields (legacy `string[]` palettes become\n * ColorStop[]; mesh points + texture transform are clamped). */\nfunction normalizeWaveColour(config: WaveConfig): void {\n const p = config.palette as unknown as Array<string | ColorStop> | undefined;\n if (!Array.isArray(p) || p.length === 0) {\n // A wave with no usable palette at all (`\"waves\": [{}]`) used to throw right here, out of the\n // very normalizer whose job is to make an untrusted config safe to render.\n config.palette = defaultWave().palette;\n } else if (typeof p[0] === \"string\") {\n config.palette = makeStops(p as string[]);\n }\n if (\n config.gradientType !== \"radial\" &&\n config.gradientType !== \"conic\" &&\n config.gradientType !== \"mesh\" &&\n config.gradientType !== \"linear\"\n ) {\n config.gradientType = \"linear\";\n }\n const rawMeshPoints = config.meshGradientPoints as MeshGradientPoint[] | undefined;\n if (!Array.isArray(rawMeshPoints) || rawMeshPoints.length < 2) {\n config.meshGradientPoints = createDefaultMeshPoints();\n } else {\n const defaults = createDefaultMeshPoints();\n config.meshGradientPoints = rawMeshPoints.slice(0, MAX_MESH_POINTS).map((point, index) => {\n const fallback = defaults[index] ?? defaults[defaults.length - 1];\n const x = Number(point.x);\n const y = Number(point.y);\n const influence = Number(point.influence);\n return {\n color: typeof point.color === \"string\" ? point.color : fallback.color,\n x: clamp01(Number.isFinite(x) ? x : fallback.x),\n y: clamp01(Number.isFinite(y) ? y : fallback.y),\n influence: clamp(Number.isFinite(influence) ? influence : fallback.influence, 0.15, 1.5),\n };\n });\n }\n if (!Number.isFinite(config.meshGradientSoftness)) config.meshGradientSoftness = 0.62;\n config.meshGradientSoftness = clamp01(config.meshGradientSoftness);\n if (!config.paletteTextureScale) config.paletteTextureScale = { x: 1, y: 1 };\n if (!config.paletteTextureOffset) config.paletteTextureOffset = { x: 0, y: 0 };\n config.paletteTextureScale.x = clamp(Number(config.paletteTextureScale.x) || 1, 0.1, 8);\n config.paletteTextureScale.y = clamp(Number(config.paletteTextureScale.y) || 1, 0.1, 8);\n config.paletteTextureOffset.x = clamp(Number(config.paletteTextureOffset.x) || 0, -4, 4);\n config.paletteTextureOffset.y = clamp(Number(config.paletteTextureOffset.y) || 0, -4, 4);\n config.paletteTextureRotation = clamp(Number(config.paletteTextureRotation) || 0, -180, 180);\n}\n\n/** Backfill background styling for states saved before gradient/image backgrounds existed. */\nexport function normalizeBackground(config: StudioConfig): void {\n if (typeof config.background !== \"string\") config.background = \"#ffffff\";\n if (typeof config.transparentBackground !== \"boolean\") config.transparentBackground = true;\n if (\n config.backgroundMode !== \"gradient\" &&\n config.backgroundMode !== \"image\" &&\n config.backgroundMode !== \"color\"\n ) {\n config.backgroundMode = \"color\";\n }\n const palette = config.backgroundPalette as unknown as Array<string | ColorStop> | undefined;\n if (!palette || palette.length < 2) {\n config.backgroundPalette = makeStops([\"#0a2540\", \"#425466\", \"#7a73ff\", \"#f6f9fc\"]);\n } else if (typeof palette[0] === \"string\") {\n config.backgroundPalette = makeStops(palette as string[]);\n }\n if (\n config.backgroundGradientType !== \"radial\" &&\n config.backgroundGradientType !== \"conic\" &&\n config.backgroundGradientType !== \"mesh\" &&\n config.backgroundGradientType !== \"linear\"\n ) {\n config.backgroundGradientType = \"linear\";\n }\n const bgMesh = config.backgroundMeshPoints as MeshGradientPoint[] | undefined;\n if (!Array.isArray(bgMesh) || bgMesh.length < 2) {\n config.backgroundMeshPoints = createDefaultMeshPoints();\n }\n if (!Number.isFinite(config.backgroundMeshSoftness)) config.backgroundMeshSoftness = 0.62;\n config.backgroundMeshSoftness = clamp01(config.backgroundMeshSoftness);\n if (!Number.isFinite(config.backgroundGradientAngle)) config.backgroundGradientAngle = 135;\n if (typeof config.backgroundGradientSource !== \"string\")\n config.backgroundGradientSource = \"stops\";\n if (typeof config.backgroundImageSource !== \"string\") config.backgroundImageSource = \"vaporwave\";\n if (\n config.backgroundImageFit !== \"contain\" &&\n config.backgroundImageFit !== \"stretch\" &&\n config.backgroundImageFit !== \"cover\"\n ) {\n config.backgroundImageFit = \"cover\";\n }\n if (!Number.isFinite(config.backgroundImageZoom)) config.backgroundImageZoom = 1;\n config.backgroundImageZoom = clamp(config.backgroundImageZoom, 0.1, 8);\n if (!config.backgroundImagePosition) config.backgroundImagePosition = { x: 0, y: 0 };\n if (typeof config.backgroundImagePosition.x !== \"number\") config.backgroundImagePosition.x = 0;\n if (typeof config.backgroundImagePosition.y !== \"number\") config.backgroundImagePosition.y = 0;\n config.backgroundImagePosition.x = clamp(config.backgroundImagePosition.x, -100, 100);\n config.backgroundImagePosition.y = clamp(config.backgroundImagePosition.y, -100, 100);\n}\n\n/** Backfill camera position/target for states saved before they existed. */\nexport function ensureCamera(config: StudioConfig): void {\n if (!config.cameraPosition)\n config.cameraPosition = { x: 0, y: 0, z: config.cameraDistance ?? 62 };\n if (!config.cameraTarget) config.cameraTarget = { x: 0, y: 0, z: 0 };\n if (!Number.isFinite(config.cameraZoom)) config.cameraZoom = 1;\n // Framing policy: absent → the historical cover framing, so every saved config/preset that\n // predates these fields reproduces byte-identically.\n if (!CAMERA_FITS.includes(config.cameraFit as CameraFit)) config.cameraFit = \"cover\";\n config.cameraMinVisibleWidth =\n typeof config.cameraMinVisibleWidth === \"number\"\n ? clamp(config.cameraMinVisibleWidth, 0, 1)\n : 0;\n}\n\n/** Backfill/repair a wave so the renderer can consume it (covers partial wave-model JSON). */\nexport function normalizeWave(s: WaveConfig): void {\n normalizeWaveColour(s);\n if (!Number.isFinite(s.gradientAngle)) s.gradientAngle = 90;\n if (!Number.isFinite(s.gradientShift)) s.gradientShift = 0.15;\n if (typeof s.usePaletteTexture !== \"boolean\") s.usePaletteTexture = true;\n if (typeof s.paletteSource !== \"string\") s.paletteSource = \"hero\";\n if (typeof s.paletteEdgeColor !== \"string\") s.paletteEdgeColor = \"#8e9dff\";\n if (!Number.isFinite(s.paletteEdgeAmount)) s.paletteEdgeAmount = 0.3;\n if (!Number.isFinite(s.paletteDriftX)) s.paletteDriftX = 0;\n if (!Number.isFinite(s.paletteDriftY)) s.paletteDriftY = 0;\n if (!Number.isFinite(s.hueShift)) s.hueShift = 0;\n if (!Number.isFinite(s.colorContrast)) s.colorContrast = 1;\n if (!Number.isFinite(s.colorSaturation)) s.colorSaturation = 1;\n if (!Number.isFinite(s.fiberCount)) s.fiberCount = 600;\n if (!Number.isFinite(s.fiberStrength)) s.fiberStrength = 0.2;\n if (!Array.isArray(s.noiseBands)) s.noiseBands = [];\n normalizeNoiseBands(s);\n if (!Number.isFinite(s.texture)) s.texture = 0;\n if (!Number.isFinite(s.creaseLight)) s.creaseLight = 0.6;\n if (!Number.isFinite(s.creaseSharpness)) s.creaseSharpness = 0.589;\n if (!Number.isFinite(s.creaseSoftness)) s.creaseSoftness = 1;\n if (!Number.isFinite(s.sheen)) s.sheen = 0;\n if (!Number.isFinite(s.roundness)) s.roundness = 0;\n if (!Number.isFinite(s.iridescence)) s.iridescence = 0;\n if (!Number.isFinite(s.edgeFade)) s.edgeFade = 0.04;\n if (!Number.isFinite(s.edgeFeather)) s.edgeFeather = 0.1;\n if (!Number.isFinite(s.depthTint)) s.depthTint = 0;\n if (typeof s.depthTintColor !== \"string\") s.depthTintColor = \"#0a2540\";\n if (!s.displaceFrequency) s.displaceFrequency = { x: 0.003234, y: 0.00799 };\n if (!Number.isFinite(s.displaceAmount)) s.displaceAmount = 6.051;\n if (!Number.isFinite(s.detailFrequency)) s.detailFrequency = 0.04;\n if (!Number.isFinite(s.detailAmount)) s.detailAmount = 0;\n if (!s.twistFrequency) s.twistFrequency = { x: -0.055, y: 0.077, z: -0.518 };\n if (!s.twistPower) s.twistPower = { x: 3.95, y: 5.85, z: 6.33 };\n // false, not absent: the panel binds this directly, and a wave that omits it can't be edited.\n if (typeof s.twistMotion !== \"boolean\") s.twistMotion = false;\n if (!Number.isFinite(s.helixTurns)) s.helixTurns = 0;\n if (!Number.isFinite(s.helixRadius)) s.helixRadius = 0;\n if (!Number.isFinite(s.helixRoll)) s.helixRoll = 0;\n if (!Number.isFinite(s.helixPhase)) s.helixPhase = 0;\n if (!Number.isFinite(s.radialAmount)) s.radialAmount = 0;\n if (!Number.isFinite(s.radialArc)) s.radialArc = 160;\n if (!Number.isFinite(s.radialSpread)) s.radialSpread = 1;\n if (!Number.isFinite(s.radialRadius)) s.radialRadius = 40;\n if (!Number.isFinite(s.radialCenter)) s.radialCenter = 0;\n if (typeof s.theme !== \"string\") s.theme = \"solid\";\n if (!Number.isFinite(s.lineAmount)) s.lineAmount = 425;\n if (!Number.isFinite(s.lineThickness)) s.lineThickness = 1;\n if (!Number.isFinite(s.lineDerivativePower)) s.lineDerivativePower = 0.95;\n if (!Number.isFinite(s.rungAmount)) s.rungAmount = 0;\n if (!Number.isFinite(s.rungThickness)) s.rungThickness = 1;\n if (!Number.isFinite(s.maxWidth)) s.maxWidth = 1232;\n if (!s.position) s.position = { x: 0, y: 0, z: 0 };\n if (!s.rotation) s.rotation = { x: 0, y: 0, z: 0 };\n if (!s.scale) s.scale = { x: 10, y: 10, z: 7 };\n if (typeof s.blendMode !== \"string\") s.blendMode = \"squared\";\n if (!Number.isFinite(s.speed)) s.speed = 0.04;\n if (!Number.isFinite(s.opacity)) s.opacity = 1;\n if (!Number.isFinite(s.seed)) s.seed = 0;\n if (s.interaction) normalizeWaveInteraction(s); // present-only; absence stays inert\n if (s.particles) normalizeParticles(s); // present-only; absence = no field for this wave\n}\n\n/** Backfill scene-level defaults (background/camera/post/lights/quality/mirror). */\nexport function ensureSceneDefaults(config: StudioConfig): void {\n normalizeBackground(config);\n ensureCamera(config);\n if (!Number.isFinite(config.ambient)) config.ambient = 0.45;\n if (!Array.isArray(config.lights)) config.lights = [];\n normalizeLights(config);\n if (!Number.isFinite(config.quality)) config.quality = 1;\n if (!Number.isFinite(config.dprMax)) config.dprMax = 2;\n if (!Number.isFinite(config.grain)) config.grain = 1.1;\n if (!Number.isFinite(config.blur)) config.blur = 0.02;\n if (!Number.isFinite(config.blurSamples)) config.blurSamples = 6;\n if (!Number.isFinite(config.bloomStrength)) config.bloomStrength = 0;\n if (!Number.isFinite(config.bloomRadius)) config.bloomRadius = 0.4;\n if (!Number.isFinite(config.bloomThreshold)) config.bloomThreshold = 0.85;\n if (!Number.isFinite(config.dither)) config.dither = 0;\n if (!Number.isFinite(config.ditherScale)) config.ditherScale = 2;\n if (!Number.isFinite(config.ditherSteps)) config.ditherSteps = 4;\n if (!Number.isFinite(config.innerLight)) config.innerLight = 0;\n if (!Number.isFinite(config.innerLightDensity)) config.innerLightDensity = 0.5;\n if (!Number.isFinite(config.innerLightDecay)) config.innerLightDecay = 0.95;\n if (!Number.isFinite(config.innerLightX)) config.innerLightX = 0.5;\n if (!Number.isFinite(config.innerLightY)) config.innerLightY = 0.15;\n if (!Number.isFinite(config.halftone)) config.halftone = 0;\n if (!Number.isFinite(config.halftoneCell)) config.halftoneCell = 6;\n if (!Number.isFinite(config.halftoneAngle)) config.halftoneAngle = 0.4;\n if (!Number.isFinite(config.heatmap)) config.heatmap = 0;\n if (!Number.isFinite(config.paperTexture)) config.paperTexture = 0;\n if (!Number.isFinite(config.paperTextureScale)) config.paperTextureScale = 2;\n if (!Number.isFinite(config.halftoneCmyk)) config.halftoneCmyk = 0;\n if (!Number.isFinite(config.halftoneCmykCell)) config.halftoneCmykCell = 6;\n // particles is present-only (like interaction): NOT backfilled here — absence is off.\n if (typeof config.showCameraRig !== \"boolean\") config.showCameraRig = false;\n if (typeof config.paused !== \"boolean\") config.paused = false;\n // Not clamped to the studio slider's 0..60: a driver stepping a paused scene frame by frame\n // (the embed's timeOffset drive) legitimately passes any finite phase.\n if (!Number.isFinite(config.timeOffset)) config.timeOffset = 0;\n if (!Number.isFinite(config.loopSeconds)) config.loopSeconds = 0;\n if (typeof config.mirrorH !== \"boolean\") config.mirrorH = false;\n if (typeof config.mirrorV !== \"boolean\") config.mirrorV = false;\n // NOTE: `interaction` (scene + per-wave) is deliberately NOT backfilled — absence is semantically\n // \"off\" and keeps the compiled shader byte-identical. The present-only normalizers below run from\n // ensureStudioConfig / normalizeWave only when a block is actually present.\n}\n\n/** Clamp an untrusted numeric field, falling back to `dflt` when it isn't a finite number. */\nfunction clampNumber(v: unknown, min: number, max: number, dflt: number): number {\n const n = Number(v);\n return Number.isFinite(n) ? clamp(n, min, max) : dflt;\n}\n\n/** Coerce an untrusted field to a finite number, falling back to `dflt`. Deliberately does NOT\n * clamp — it repairs broken values without reinterpreting out-of-range ones that a saved config\n * may legitimately rely on. */\nfunction num(v: unknown, dflt: number): number {\n const n = Number(v);\n return Number.isFinite(n) ? n : dflt;\n}\n\n/**\n * Repair the ELEMENTS of the scene's `lights` and a wave's `noiseBands`. Both arrays are\n * type-checked where they're backfilled, but their entries never were — and the studio binds every\n * field below directly, so one hand-authored `\"lights\": [{}]` was enough to make the whole control\n * panel unbuildable. Entries that aren't objects at all are dropped.\n */\nfunction normalizeLights(config: StudioConfig): void {\n config.lights = config.lights.filter((l) => typeof l === \"object\" && l !== null);\n for (const l of config.lights) {\n if (typeof l.position !== \"object\" || l.position === null) {\n l.position = { ...DEFAULT_LIGHT_POSITION };\n }\n l.position.x = num(l.position.x, DEFAULT_LIGHT_POSITION.x);\n l.position.y = num(l.position.y, DEFAULT_LIGHT_POSITION.y);\n l.position.z = num(l.position.z, DEFAULT_LIGHT_POSITION.z);\n if (typeof l.color !== \"string\") l.color = \"#ffffff\";\n l.intensity = num(l.intensity, 1);\n }\n}\n\nfunction normalizeNoiseBands(s: WaveConfig): void {\n s.noiseBands = s.noiseBands.filter((b) => typeof b === \"object\" && b !== null);\n const d = createNoiseBand();\n for (const b of s.noiseBands) {\n b.startX = num(b.startX, d.startX);\n b.endX = num(b.endX, d.endX);\n b.startY = num(b.startY, d.startY);\n b.endY = num(b.endY, d.endY);\n b.feather = num(b.feather, d.feather);\n b.strength = num(b.strength, d.strength);\n b.frequency = num(b.frequency, d.frequency);\n b.colorAttenuation = num(b.colorAttenuation, d.colorAttenuation);\n b.parabolaPower = num(b.parabolaPower, d.parabolaPower);\n }\n}\n\n/** True for a valid interaction source string: a built-in name or a non-empty `custom:<name>`. */\nfunction isInteractionSource(v: unknown): v is InteractionSource {\n return (\n typeof v === \"string\" &&\n ((INTERACTION_SOURCE_NAMES as readonly string[]).includes(v) ||\n (v.startsWith(\"custom:\") && v.length > \"custom:\".length))\n );\n}\n\n/** Rebuild an untrusted bindings array into valid bindings for `valid` targets (loaded share-links /\n * presets are untrusted JSON; we validate source/target/to and rebuild clean objects). */\nfunction cleanBindings<T extends string>(\n raw: unknown,\n valid: readonly string[],\n): Array<InteractionBindingBase & { target: T }> {\n const out: Array<InteractionBindingBase & { target: T }> = [];\n if (!Array.isArray(raw)) return out;\n for (const item of raw) {\n if (!item || typeof item !== \"object\") continue;\n const b = item as Record<string, unknown>;\n if (!isInteractionSource(b.source)) continue;\n if (!valid.includes(b.target as string)) continue;\n const to = Number(b.to);\n if (!Number.isFinite(to)) continue;\n const clean: InteractionBindingBase & { target: T } = {\n source: b.source,\n target: b.target as T,\n to,\n };\n if (b.from !== undefined) {\n const f = Number(b.from);\n if (Number.isFinite(f)) clean.from = f;\n }\n if (b.smoothing !== undefined) clean.smoothing = clampNumber(b.smoothing, 0, 2, 0.25);\n out.push(clean);\n }\n return out;\n}\n\n/**\n * Present-only normalizer for a WAVE's interaction block: clamp the hover/press numerics that are\n * present (absent fields stay absent, so the block stays lean and the renderer's defaults apply) and\n * drop bindings with an unknown source/target or a non-finite `to`. NEVER call when the block is\n * absent — absence is inert and byte-identical (normalizeWave gates on presence).\n */\nexport function normalizeWaveInteraction(wave: WaveConfig): void {\n const it = wave.interaction;\n if (!it) return;\n const h = it.hover;\n if (h) {\n if (h.agitate !== undefined) h.agitate = clampNumber(h.agitate, 0, 60, 0);\n if (h.push !== undefined) h.push = clampNumber(h.push, -40, 40, 0);\n if (h.wake !== undefined) h.wake = clampNumber(h.wake, 0, 40, 0);\n if (h.thin !== undefined) h.thin = clampNumber(h.thin, 0, 1, 0);\n if (h.hueShift !== undefined) h.hueShift = clampNumber(h.hueShift, -360, 360, 0);\n if (h.lighten !== undefined) h.lighten = clampNumber(h.lighten, -1, 1, 0);\n if (h.smoothing !== undefined) h.smoothing = clampNumber(h.smoothing, 0, 2, 0.12);\n }\n if (it.press && it.press.ripple !== undefined) {\n it.press.ripple = clampNumber(it.press.ripple, 0, 60, 0);\n }\n if (it.bindings !== undefined) {\n it.bindings = cleanBindings<WaveInteractionTarget>(it.bindings, WAVE_TARGET_NAMES);\n }\n}\n\n/** Present-only normalizer for the SCENE interaction block: clamp the shared pointer inputs and drop\n * invalid scene bindings. NEVER call when the block is absent. */\nexport function normalizeSceneInteraction(config: StudioConfig): void {\n const it = config.interaction;\n if (!it) return;\n if (it.radius !== undefined) it.radius = clampNumber(it.radius, 0.02, 2, 0.3);\n if (it.ribbonFlow !== undefined) it.ribbonFlow = clampNumber(it.ribbonFlow, 0, 1, 0.8);\n if (it.bindings !== undefined) {\n it.bindings = cleanBindings<SceneInteractionTarget>(it.bindings, SCENE_TARGET_NAMES);\n }\n}\n\n/**\n * Present-only normalizer for the scene PARTICLES block: clamp the numerics that are present and\n * repair the required fields, leaving absent optionals absent (so the block stays lean). NEVER call\n * when the block is absent — absence is off and byte-identical (ensureStudioConfig gates on presence).\n */\nexport function normalizeParticles(wave: WaveConfig): void {\n const p = wave.particles;\n if (!p) return;\n p.count = clampNumber(p.count, 0, 40000, 0);\n p.size = clampNumber(p.size, 0, 200, 2);\n p.seed = num(p.seed, 0);\n if (p.sizeJitter !== undefined) p.sizeJitter = clampNumber(p.sizeJitter, 0, 1, 0);\n if (p.color !== undefined && typeof p.color !== \"string\") p.color = \"#ffcf8a\";\n if (p.life !== undefined) p.life = clampNumber(p.life, 0.1, 60, 6);\n if (p.speed !== undefined) p.speed = clampNumber(p.speed, 0, 8, 1);\n if (p.twinkle !== undefined) p.twinkle = clampNumber(p.twinkle, 0, 1, 0);\n if (p.color2 !== undefined && typeof p.color2 !== \"string\") p.color2 = \"#ffcf8a\";\n if (p.edgeBias !== undefined) p.edgeBias = clampNumber(p.edgeBias, 0, 1, 1);\n if (p.drift !== undefined) p.drift = num(p.drift, 0);\n if (p.bias !== undefined) p.bias = clampNumber(p.bias, -1, 1, 0);\n if (p.rise !== undefined) p.rise = num(p.rise, 0);\n if (p.swirl !== undefined) p.swirl = num(p.swirl, 0);\n if (p.wander !== undefined) p.wander = num(p.wander, 0);\n if (p.shape !== undefined && !PARTICLE_SHAPES.includes(p.shape)) p.shape = \"glitter\";\n // Untrusted configs (share links / imported JSON) reach here — keep the url a string, but do not\n // validate the scheme: the renderer only ever hands it to an <img>, which sandboxes SVG scripts.\n if (p.spriteUrl !== undefined && typeof p.spriteUrl !== \"string\") delete p.spriteUrl;\n if (p.pointerShove !== undefined) p.pointerShove = clampNumber(p.pointerShove, 0, 4, 1);\n}\n\n/** Normalize an ingested config to the wave model: backfill the scene + every wave, and drop in\n * a default wave if none are present. Idempotent, so it is safe on the renderer's own config as\n * well as freshly loaded save-states / share links. */\nexport function ensureStudioConfig(input: StudioConfig): StudioConfig {\n const config = input;\n ensureSceneDefaults(config);\n if (!Array.isArray(config.waves) || config.waves.length === 0) {\n config.waves = [makeWave()];\n }\n // each wave's normalizeWave runs normalizeWaveInteraction + normalizeParticles (both present-only)\n config.waves.forEach(normalizeWave);\n config.waveCount = config.waves.length;\n // Present-only: a config without a scene `interaction` block is left untouched (\"off\").\n if (config.interaction) normalizeSceneInteraction(config);\n return config;\n}\n"],"mappings":";;;;;;;;AASA,MAAa,aAAa;AAC1B,MAAa,kBAAkB;AAC/B,MAAa,aAAa;AAC1B,MAAa,kBAAkB;;AAE/B,MAAa,YAAY;;AAoCzB,MAAa,cAAoC;CAAC;CAAS;CAAW;CAAS;AAAQ;;AAcvF,SAAgB,YACd,WAAiB;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;AAAI,GAC1C,YAAY,GACC;CACb,OAAO;EAAE,UAAU,EAAE,GAAG,SAAS;EAAG,OAAO;EAAW;CAAU;AAClE;;;;AAKA,MAAa,yBAA+B;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;AAAK;;AAyBtE,SAAgB,kBAA6B;CAC3C,OAAO;EACL,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,MAAM;EACN,SAAS;EACT,UAAU;EACV,WAAW;EACX,kBAAkB;EAClB,eAAe;CACjB;AACF;;AAqBA,SAAgB,UAAU,QAA+B;CACvD,MAAM,IAAI,OAAO;CACjB,OAAO,OAAO,KAAK,OAAO,OAAO;EAAE;EAAO,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK;CAAE,EAAE;AAC3E;;AAGA,SAAgB,0BAA+C;CAC7D,OAAO;EACL;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAM,WAAW;EAAK;EACtD;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAM,WAAW;EAAK;EACtD;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAM,WAAW;EAAK;EACtD;GAAE,OAAO;GAAW,GAAG;GAAK,GAAG;GAAM,WAAW;EAAK;EACrD;GAAE,OAAO;GAAW,GAAG;GAAK,GAAG;GA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AAS;CACvE,IAAI,EAAE,aAAa,KAAA,GAAW,EAAE,WAAW,YAAY,EAAE,UAAU,GAAG,GAAG,CAAC;CAC1E,IAAI,EAAE,UAAU,KAAA,GAAW,EAAE,QAAQ,IAAI,EAAE,OAAO,CAAC;CACnD,IAAI,EAAE,SAAS,KAAA,GAAW,EAAE,OAAO,YAAY,EAAE,MAAM,IAAI,GAAG,CAAC;CAC/D,IAAI,EAAE,SAAS,KAAA,GAAW,EAAE,OAAO,IAAI,EAAE,MAAM,CAAC;CAChD,IAAI,EAAE,UAAU,KAAA,GAAW,EAAE,QAAQ,IAAI,EAAE,OAAO,CAAC;CACnD,IAAI,EAAE,WAAW,KAAA,GAAW,EAAE,SAAS,IAAI,EAAE,QAAQ,CAAC;CACtD,IAAI,EAAE,UAAU,KAAA,KAAa,CAAC,gBAAgB,SAAS,EAAE,KAAK,GAAG,EAAE,QAAQ;CAG3E,IAAI,EAAE,cAAc,KAAA,KAAa,OAAO,EAAE,cAAc,UAAU,OAAO,EAAE;CAC3E,IAAI,EAAE,iBAAiB,KAAA,GAAW,EAAE,eAAe,YAAY,EAAE,cAAc,GAAG,GAAG,CAAC;AACxF;;;;AAKA,SAAgB,mBAAmB,OAAmC;CACpE,MAAM,SAAS;CACf,oBAAoB,MAAM;CAC1B,IAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,KAAK,OAAO,MAAM,WAAW,GAC1D,OAAO,QAAQ,CAAC,SAAS,CAAC;CAG5B,OAAO,MAAM,QAAQ,aAAa;CAClC,OAAO,YAAY,OAAO,MAAM;CAEhC,IAAI,OAAO,aAAa,0BAA0B,MAAM;CACxD,OAAO;AACT"}
|
package/dist/presets.js
CHANGED
|
@@ -98,6 +98,10 @@ const PARTICLE_PRESETS = {
|
|
|
98
98
|
};
|
|
99
99
|
/** Degrees → radians (for the Particle Zoo's per-wave rotation, authored in degrees). */
|
|
100
100
|
const rad = (deg) => deg * Math.PI / 180;
|
|
101
|
+
/** Identity, but it pins a Zoo entry's inline interaction literal to {@link WaveInteractionConfig}:
|
|
102
|
+
* without it the entries are merely INFERRED, so `source` / `target` widen to `string` (needing an
|
|
103
|
+
* `as const` per field) and a misspelt knob would slip through unchecked. */
|
|
104
|
+
const interaction = (it) => it;
|
|
101
105
|
/** Clamp a signed magnitude to ±m (used to cap the Zoo's long-range particle motion terms). */
|
|
102
106
|
const capMag = (v, m) => v == null ? v : Math.sign(v) * Math.min(Math.abs(v), m);
|
|
103
107
|
/** Build a preset from a set of wave parameters. rotation/hue are given in RADIANS and
|
|
@@ -582,9 +586,20 @@ const PRESETS = {
|
|
|
582
586
|
z: 0
|
|
583
587
|
};
|
|
584
588
|
c.cameraZoom = .6;
|
|
589
|
+
c.interaction = {
|
|
590
|
+
enabled: true,
|
|
591
|
+
radius: .22,
|
|
592
|
+
ribbonFlow: .5,
|
|
593
|
+
touch: true
|
|
594
|
+
};
|
|
585
595
|
const zoo = [
|
|
586
596
|
{
|
|
587
597
|
style: "Embers",
|
|
598
|
+
interact: interaction({ hover: {
|
|
599
|
+
agitate: 34,
|
|
600
|
+
lighten: .25
|
|
601
|
+
} }),
|
|
602
|
+
shove: 2.5,
|
|
588
603
|
palette: [
|
|
589
604
|
"#ff7a1e",
|
|
590
605
|
"#ffd27a",
|
|
@@ -617,6 +632,11 @@ const PRESETS = {
|
|
|
617
632
|
},
|
|
618
633
|
{
|
|
619
634
|
style: "Snow",
|
|
635
|
+
interact: interaction({ hover: {
|
|
636
|
+
push: -22,
|
|
637
|
+
smoothing: .45
|
|
638
|
+
} }),
|
|
639
|
+
shove: .6,
|
|
620
640
|
palette: [
|
|
621
641
|
"#8fb8e8",
|
|
622
642
|
"#e8f1fb",
|
|
@@ -649,6 +669,8 @@ const PRESETS = {
|
|
|
649
669
|
},
|
|
650
670
|
{
|
|
651
671
|
style: "Sparks",
|
|
672
|
+
interact: interaction({ press: { ripple: 46 } }),
|
|
673
|
+
shove: 4,
|
|
652
674
|
palette: [
|
|
653
675
|
"#ffd27a",
|
|
654
676
|
"#fff4d0",
|
|
@@ -677,6 +699,12 @@ const PRESETS = {
|
|
|
677
699
|
},
|
|
678
700
|
{
|
|
679
701
|
style: "Fireflies",
|
|
702
|
+
interact: interaction({ bindings: [{
|
|
703
|
+
source: "hover",
|
|
704
|
+
target: "helixPhase",
|
|
705
|
+
to: 360,
|
|
706
|
+
smoothing: .5
|
|
707
|
+
}] }),
|
|
680
708
|
palette: [
|
|
681
709
|
"#3d5a24",
|
|
682
710
|
"#7bd23a",
|
|
@@ -708,6 +736,11 @@ const PRESETS = {
|
|
|
708
736
|
},
|
|
709
737
|
{
|
|
710
738
|
style: "Bubbles",
|
|
739
|
+
interact: interaction({ hover: {
|
|
740
|
+
wake: 30,
|
|
741
|
+
thin: .45
|
|
742
|
+
} }),
|
|
743
|
+
shove: 1.6,
|
|
711
744
|
palette: [
|
|
712
745
|
"#2e8fb0",
|
|
713
746
|
"#7fd4e8",
|
|
@@ -780,7 +813,9 @@ const PRESETS = {
|
|
|
780
813
|
if (p.rise != null) p.rise = capMag(p.rise * PULL, 28);
|
|
781
814
|
if (p.wander != null) p.wander = capMag(p.wander * PULL, 15);
|
|
782
815
|
if (p.swirl != null) p.swirl = capMag(p.swirl * PULL, .05);
|
|
816
|
+
if (z.shove != null) p.pointerShove = z.shove;
|
|
783
817
|
w.particles = p;
|
|
818
|
+
if (z.interact) w.interaction = structuredClone(z.interact);
|
|
784
819
|
return w;
|
|
785
820
|
});
|
|
786
821
|
c.waveCount = c.waves.length;
|