@jayf0x/fluidity-js 0.2.7 → 0.2.9

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/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  [![license](https://img.shields.io/npm/l/@jayf0x/fluidity-js)](./LICENSE)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue)](./tsconfig.json)
8
8
  [![CI](https://github.com/jayf0x/fluidity/actions/workflows/ci.yml/badge.svg)](https://github.com/jayf0x/fluidity/actions/workflows/ci.yml)
9
+ [![Bundlephobia](https://badgen.net/bundlephobia/min/@jayf0x/fluidity-js)](https://bundlephobia.com/package/@jayf0x/fluidity-js)
9
10
 
10
11
  <a href="https://jayf0x.github.io/fluidity">
11
12
  <p align="center">
@@ -74,7 +75,7 @@ export const Interactive = () => {
74
75
  | -------------------------------- | --------------------------------------------------------- |
75
76
  | `reset()` | Restart the simulation |
76
77
  | `updateConfig(patch)` | Change any config value live |
77
- | `move(x, y, strength?)` | Simulate a pointer move |
78
+ | `move(x, y, strength?)` | Simulate a pointer move |
78
79
  | `splat(x, y, vx, vy, strength?)` | Inject fluid directly — safe to call many times per frame |
79
80
 
80
81
  ---
@@ -101,33 +102,33 @@ export const Interactive = () => {
101
102
 
102
103
  ### Shared props
103
104
 
104
- | Prop | Type | Default |
105
- | --------------------- | ------------------ | ------------ |
106
- | `algorithm` | `FluidAlgorithm` | `'aurora'` |
107
- | `preset` | `PresetKey` | — |
108
- | `pixelRatio` | `number` | `1` |
109
- | `simResolution` | `number` | `0.5` |
110
- | `densityDissipation` | `number` | `0.83` |
111
- | `velocityDissipation` | `number` | `0.91` |
112
- | `pressureIterations` | `number` | `1` |
113
- | `curl` | `number` | `0` |
114
- | `splatRadius` | `number` | `0.1` |
115
- | `splatForce` | `number` | `0.08` |
116
- | `refraction` | `number` | `1.0` |
117
- | `specularExp` | `number` | `0` |
118
- | `shine` | `number` | `0` |
119
- | `waterColor` | `FluidColor` | `'#000000'` |
120
- | `glowColor` | `FluidColor` | `'#b3d9ff'` |
121
- | `warpStrength` | `number` | `0.04` |
122
- | `backgroundColor` | `string` | `'#0a0a0a'` |
123
- | `backgroundSrc` | `string` | — |
124
- | `backgroundSize` | `string \| number` | `'cover'` |
125
- | `mouseEnabled` | `boolean` | `true` |
126
- | `workerEnabled` | `boolean` | `true` |
127
- | `webGPUEnabled` | `boolean` | `true` |
128
- | `alphaEnabled` | `boolean` | `true` |
129
- | `className` | `string` | — |
130
- | `style` | `CSSProperties` | — |
105
+ | Prop | Type | Default |
106
+ | --------------------- | ------------------ | ----------- |
107
+ | `algorithm` | `FluidAlgorithm` | `'aurora'` |
108
+ | `preset` | `PresetKey` | — |
109
+ | `pixelRatio` | `number` | `1` |
110
+ | `simResolution` | `number` | `0.5` |
111
+ | `densityDissipation` | `number` | `0.83` |
112
+ | `velocityDissipation` | `number` | `0.91` |
113
+ | `pressureIterations` | `number` | `1` |
114
+ | `curl` | `number` | `0` |
115
+ | `splatRadius` | `number` | `0.1` |
116
+ | `splatForce` | `number` | `0.08` |
117
+ | `refraction` | `number` | `1.0` |
118
+ | `specularExp` | `number` | `0` |
119
+ | `shine` | `number` | `0` |
120
+ | `waterColor` | `FluidColor` | `'#000000'` |
121
+ | `glowColor` | `FluidColor` | `'#b3d9ff'` |
122
+ | `warpStrength` | `number` | `0.04` |
123
+ | `backgroundColor` | `string` | `'#0a0a0a'` |
124
+ | `backgroundSrc` | `string` | — |
125
+ | `backgroundSize` | `string \| number` | `'cover'` |
126
+ | `mouseEnabled` | `boolean` | `true` |
127
+ | `workerEnabled` | `boolean` | `true` |
128
+ | `webGPUEnabled` | `boolean` | `true` |
129
+ | `alphaEnabled` | `boolean` | `true` |
130
+ | `className` | `string` | — |
131
+ | `style` | `CSSProperties` | — |
131
132
 
132
133
  ---
133
134
 
@@ -142,8 +143,8 @@ export const Interactive = () => {
142
143
  | `'ripple'` | Still water surface with Fresnel rim |
143
144
 
144
145
  ```tsx
145
- <FluidImage src="/photo.jpg" algorithm="aurora" />
146
- <FluidText text="fluid" algorithm="ripple" warpStrength={0.03} />
146
+ <FluidImage src="/photo.jpg" algorithm="aurora" warpStrength={0.3} />
147
+ <FluidText text="fluid" algorithm="ripple" refraction={0.6} />
147
148
  ```
148
149
 
149
150
  ---
@@ -152,10 +153,10 @@ export const Interactive = () => {
152
153
 
153
154
  Control rendering resolution on two independent axes — both reactive at runtime.
154
155
 
155
- | Prop | Range | Default | What it does |
156
- | --------------- | ----- | ------- | ----------------------------------------------------------------------------------------- |
157
- | `pixelRatio` | 0.1–1 | `1` | Canvas resolution as fraction of devicePixelRatio. `0.5` on Retina saves ~75% GPU fill. |
158
- | `simResolution` | 0.1–1 | `0.5` | Simulation FBO size. Lower = cheaper, less detail. |
156
+ | Prop | Range | Default | What it does |
157
+ | --------------- | ----- | ------- | --------------------------------------------------------------------------------------- |
158
+ | `pixelRatio` | 0.1–1 | `1` | Canvas resolution as fraction of devicePixelRatio. `0.5` on Retina saves ~75% GPU fill. |
159
+ | `simResolution` | 0.1–1 | `0.5` | Simulation FBO size. Lower = cheaper, less detail. |
159
160
 
160
161
  ```tsx
161
162
  // Sharp canvas, cheap simulation
@@ -171,20 +172,20 @@ Control rendering resolution on two independent axes — both reactive at runtim
171
172
 
172
173
  Simulation props that have a physics range accept a **normalized `0–1` value** — no need to know the raw shader units. Values outside `[0, 1]` are passed through as raw physics values for advanced overrides.
173
174
 
174
- | Prop | Default | Range | Physics range | Description |
175
- | --------------------- | ------- | ------- | --------------- | ----------------------------------------------- |
176
- | `densityDissipation` | `0.83` | `0–1` | `0.94–1.0` | How long ink lingers |
177
- | `velocityDissipation` | `0.91` | `0–1` | `0.9–0.999` | How fast fluid slows down |
178
- | `pressureIterations` | `1` | `1–50` | — | Pressure solve quality vs. cost |
179
- | `curl` | `0` | `0–1` | — | Swirl intensity |
180
- | `splatRadius` | `0.1` | `0–1` | `0.001–0.04` | Brush radius |
181
- | `splatForce` | `0.08` | `0–1` | `0.1–5.0` | Force applied by brush |
182
- | `refraction` | `1.0` | `0–1` | — | Background warp strength |
183
- | `specularExp` | `0` | `0–1` | `0.1–10` | Specular highlight sharpness |
184
- | `shine` | `0` | `0–1` | `0–0.15` | Highlight intensity |
185
- | `warpStrength` | `0.04` | `0–1` | `0.001–0.1` | UV warp intensity (`aurora` algorithm) |
186
- | `waterColor` | `#000` | — | — | Base fluid colour (hex or `[R, G, B]` 0–1) |
187
- | `glowColor` | `#b3d9ff`| — | — | Glow / specular colour (hex or `[R, G, B]` 0–1) |
175
+ | Prop | Default | Range | Physics range | Description |
176
+ | --------------------- | --------- | ------ | ------------- | ----------------------------------------------- |
177
+ | `densityDissipation` | `0.83` | `0–1` | `0.94–1.0` | How long ink lingers |
178
+ | `velocityDissipation` | `0.91` | `0–1` | `0.9–0.999` | How fast fluid slows down |
179
+ | `pressureIterations` | `1` | `1–50` | — | Pressure solve quality vs. cost |
180
+ | `curl` | `0` | `0–1` | — | Swirl intensity |
181
+ | `splatRadius` | `0.1` | `0–1` | `0.001–0.04` | Brush radius |
182
+ | `splatForce` | `0.08` | `0–1` | `0.1–5.0` | Force applied by brush |
183
+ | `refraction` | `1.0` | `0–1` | — | Background warp strength |
184
+ | `specularExp` | `0` | `0–1` | `0.1–10` | Specular highlight sharpness |
185
+ | `shine` | `0` | `0–1` | `0–0.15` | Highlight intensity |
186
+ | `warpStrength` | `0.04` | `0–1` | `0.001–0.1` | UV warp intensity (`aurora` algorithm) |
187
+ | `waterColor` | `#000` | — | — | Base fluid colour (hex or `[R, G, B]` 0–1) |
188
+ | `glowColor` | `#b3d9ff` | — | — | Glow / specular colour (hex or `[R, G, B]` 0–1) |
188
189
 
189
190
  ---
190
191