@wave3d/core 0.4.1 → 0.6.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.
Files changed (37) hide show
  1. package/README.md +2 -6
  2. package/dist/config/model.d.ts +53 -2
  3. package/dist/config/model.js +133 -61
  4. package/dist/config/model.js.map +1 -1
  5. package/dist/core-loader.d.ts +0 -2
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +2 -2
  8. package/dist/presets.d.ts +0 -1
  9. package/dist/presets.js +105 -0
  10. package/dist/presets.js.map +1 -1
  11. package/dist/renderer/WaveGeometry.d.ts +0 -1
  12. package/dist/renderer/WaveGeometry.js.map +1 -1
  13. package/dist/renderer/WaveRenderer.d.ts +62 -14
  14. package/dist/renderer/WaveRenderer.js +126 -17
  15. package/dist/renderer/WaveRenderer.js.map +1 -1
  16. package/dist/renderer/heroPalette.d.ts +0 -1
  17. package/dist/renderer/index.d.ts +2 -2
  18. package/dist/renderer/index.js +2 -2
  19. package/dist/renderer/interaction.d.ts +0 -2
  20. package/dist/renderer/interaction.js +9 -0
  21. package/dist/renderer/interaction.js.map +1 -1
  22. package/dist/renderer/palette.d.ts +0 -1
  23. package/dist/renderer/shaders.js +46 -0
  24. package/dist/renderer/shaders.js.map +1 -1
  25. package/dist/shell/createWave.d.ts +0 -1
  26. package/dist/standalone/wave3d.standalone.js +501 -294
  27. package/dist/standalone.d.ts +2 -3
  28. package/dist/standalone.js +2 -2
  29. package/dist/studio/StudioWaveRenderer.d.ts +4 -1
  30. package/dist/studio/StudioWaveRenderer.js +10 -3
  31. package/dist/studio/StudioWaveRenderer.js.map +1 -1
  32. package/dist/studio/randomize.d.ts +0 -1
  33. package/dist/studio/thumbnail.d.ts +0 -1
  34. package/dist/studio/thumbnail.js +5 -1
  35. package/dist/studio/thumbnail.js.map +1 -1
  36. package/package.json +5 -3
  37. package/skills/wave3d/SKILL.md +30 -12
@@ -10,7 +10,7 @@ description: >
10
10
  metadata:
11
11
  type: core
12
12
  library: "@wave3d/core"
13
- library_version: "0.4.1"
13
+ library_version: "0.6.0"
14
14
  sources:
15
15
  - "wave3d/wave3d:README.md"
16
16
  - "wave3d/wave3d:packages/core/src/config/model.ts"
@@ -87,13 +87,7 @@ import { Wave3D } from "@wave3d/react";
87
87
  ```ts
88
88
  import { createWave } from "@wave3d/core";
89
89
 
90
- const handle = createWave(
91
- document.getElementById("wave"),
92
- {
93
- /* config */
94
- },
95
- { poster: "/wave.png" },
96
- );
90
+ const handle = createWave(document.getElementById("wave"), {/* config */}, { poster: "/wave.png" });
97
91
  // handle: { state, renderer, set(config), play(), pause(), destroy() }
98
92
  ```
99
93
 
@@ -101,8 +95,22 @@ const handle = createWave(
101
95
 
102
96
  A wave is one JSON-serializable `StudioConfig`: scene fields (`background`, `quality`, `dprMax`,
103
97
  `loopSeconds`, `paused`, camera…) plus a `waves: WaveConfig[]` array (each wave has its own
104
- `palette`, `fiberCount`, `speed`, `displaceAmount`, `twist…`, `blendMode`, `theme`, transform…).
105
- Omitted fields fall back to `createDefaultConfig()`.
98
+ `palette`, `fiberCount`, `speed`, `displaceAmount`, `twist…`, `helix…`, `blendMode`, `theme`,
99
+ transform…). Omitted fields fall back to `createDefaultConfig()`.
100
+
101
+ **Shape: twist vs helix.** `twistFrequency`/`twistPower` rotate by `freq * expStep(uv, power)`, a
102
+ MONOTONE falloff — good for one dramatic ramp, but it can never repeat, so it cannot make a coil.
103
+ `helixTurns` sweeps a _periodic_ angle along the ribbon's length instead, and is the only way to get
104
+ a repeating helix:
105
+
106
+ - `helixRadius` carries the whole ribbon around the axis (orientation intact). A narrow ribbon
107
+ (small `scale.z`) then reads as one strand — **two waves 180° apart in `helixPhase` are a double
108
+ helix**, and they genuinely swap depth at every crossing.
109
+ - `helixRoll` rolls the ribbon's own cross-section in step (1 = rigid twisted ribbon), swinging its
110
+ two long edges onto opposite sides of the axis, so **one wave becomes a ladder whose edges are
111
+ both strands**. Add `rungAmount` (wireframe theme) for the rungs between them.
112
+ - Both are off at 0, and the helix code path isn't compiled unless `helixRadius` or `helixRoll` is
113
+ non-zero — a wave without one renders byte-identically to before.
106
114
 
107
115
  **React flat props** are a shortcut mapped onto `waves[0]` and the scene:
108
116
  `palette` (`string[]` | `ColorStop[]`), `fiberCount`, `fiberStrength`, `sheen`, `iridescence`,
@@ -124,13 +132,23 @@ Sources: `scroll`, `hover`, `pointerX` / `pointerY`, `pointerSpeed`, `press`, `s
124
132
  `appear`, or a developer-fed `custom:*` (via `handle.setInteractionInput(name, value)` /
125
133
  `renderer.setInteractionInput`). Each binding rests at the authored value and moves toward `to` as
126
134
  its input rises 0→1 — `{ source: "hover", target: "displaceAmount", to: 12 }` grows the folds on
127
- hover. Each wave's `hover.smoothing` sets its own cursor-follow lag (vary it across a stack for a
128
- parallax drag). **Shared inputs** (one cursor + scroll: `radius`, `touch`) and **scene-param
135
+ hover. `helixPhase` / `helixTurns` / `helixRadius` are bindable too, so
136
+ `{ source: "scroll", target: "helixPhase", to: 360 }` spins a helix exactly one turn down the page
137
+ (and the helix path is compiled for a wave that binds one but authors radius/roll at 0). Each wave's
138
+ `hover.smoothing` sets its own cursor-follow lag (vary it across a stack for a parallax drag). **Shared inputs** (one cursor + scroll: `radius`, `touch`) and **scene-param
129
139
  bindings** (`timeOffset`, `cameraZoom`, `blur`, `grain` — e.g. `scroll → timeOffset` scrubs the whole
130
140
  wave with the page) live on `SceneConfig.interaction`. In React the flat `interaction` prop targets
131
141
  the first wave; the studio authors it per wave (Hover / Click & touch / Bindings) plus a global
132
142
  Interaction folder for the shared inputs and a scroll preview.
133
143
 
144
+ **Touch is ignored unless you opt in.** `SceneConfig.interaction.touch` defaults to `false`, and
145
+ coarse pointers are dropped before any handler runs — so on a phone, `hover`, `press`/`ripple` and
146
+ the `hover` / `pointerX` / `pointerY` / `pointerSpeed` / `press` sources are all inert no matter what
147
+ you tune. Set `interaction: { touch: true }` on the scene to follow the finger while it is down
148
+ (listeners are passive, so this does **not** block page scrolling). Untouched by the gate: `scroll`,
149
+ `scrollVelocity` and `appear` read container progress through the viewport, not pointer events, so
150
+ they drive normally on mobile — scroll bindings are the way to stay reactive with `touch` off.
151
+
134
152
  ## Post effects (optional)
135
153
 
136
154
  Passes over the finished composite. Each is a plain **scene-level** `SceneConfig` field (a sibling of