interactive-bg 0.1.1 → 0.2.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/README.md +55 -7
- package/dist/fluid/canvas2d.cjs +14 -0
- package/dist/fluid/canvas2d.cjs.map +1 -0
- package/dist/fluid/canvas2d.d.cts +5 -0
- package/dist/fluid/canvas2d.d.ts +5 -0
- package/dist/fluid/canvas2d.js +13 -0
- package/dist/fluid/canvas2d.js.map +1 -0
- package/dist/fluid/index.cjs +16 -0
- package/dist/fluid/index.cjs.map +1 -0
- package/dist/fluid/index.d.cts +5 -0
- package/dist/fluid/index.d.ts +5 -0
- package/dist/fluid/index.js +15 -0
- package/dist/fluid/index.js.map +1 -0
- package/dist/fluid/webgl.cjs +14 -0
- package/dist/fluid/webgl.cjs.map +1 -0
- package/dist/fluid/webgl.d.cts +5 -0
- package/dist/fluid/webgl.d.ts +5 -0
- package/dist/fluid/webgl.js +13 -0
- package/dist/fluid/webgl.js.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -1
- package/dist/index.umd.js +255 -12
- package/dist/index.umd.js.map +1 -1
- package/dist/shimmer/canvas2d.cjs +14 -0
- package/dist/shimmer/canvas2d.cjs.map +1 -0
- package/dist/shimmer/canvas2d.d.cts +5 -0
- package/dist/shimmer/canvas2d.d.ts +5 -0
- package/dist/shimmer/canvas2d.js +13 -0
- package/dist/shimmer/canvas2d.js.map +1 -0
- package/dist/shimmer/index.cjs +16 -0
- package/dist/shimmer/index.cjs.map +1 -0
- package/dist/shimmer/index.d.cts +5 -0
- package/dist/shimmer/index.d.ts +5 -0
- package/dist/shimmer/index.js +15 -0
- package/dist/shimmer/index.js.map +1 -0
- package/dist/shimmer/webgl.cjs +14 -0
- package/dist/shimmer/webgl.cjs.map +1 -0
- package/dist/shimmer/webgl.d.cts +5 -0
- package/dist/shimmer/webgl.d.ts +5 -0
- package/dist/shimmer/webgl.js +13 -0
- package/dist/shimmer/webgl.js.map +1 -0
- package/dist/styles/fluid/canvas2d.cjs +155 -0
- package/dist/styles/fluid/canvas2d.cjs.map +1 -0
- package/dist/styles/fluid/canvas2d.d.cts +8 -0
- package/dist/styles/fluid/canvas2d.d.ts +8 -0
- package/dist/styles/fluid/canvas2d.js +155 -0
- package/dist/styles/fluid/canvas2d.js.map +1 -0
- package/dist/styles/fluid/color.cjs +40 -0
- package/dist/styles/fluid/color.cjs.map +1 -0
- package/dist/styles/fluid/color.d.cts +4 -0
- package/dist/styles/fluid/color.d.ts +4 -0
- package/dist/styles/fluid/color.js +40 -0
- package/dist/styles/fluid/color.js.map +1 -0
- package/dist/styles/fluid/definition.cjs +14 -0
- package/dist/styles/fluid/definition.cjs.map +1 -0
- package/dist/styles/fluid/definition.d.cts +8 -0
- package/dist/styles/fluid/definition.d.ts +8 -0
- package/dist/styles/fluid/definition.js +15 -0
- package/dist/styles/fluid/definition.js.map +1 -0
- package/dist/styles/fluid/options.cjs +29 -0
- package/dist/styles/fluid/options.cjs.map +1 -0
- package/dist/styles/fluid/options.d.cts +31 -0
- package/dist/styles/fluid/options.d.ts +31 -0
- package/dist/styles/fluid/options.js +28 -0
- package/dist/styles/fluid/options.js.map +1 -0
- package/dist/styles/fluid/settings.cjs +32 -0
- package/dist/styles/fluid/settings.cjs.map +1 -0
- package/dist/styles/fluid/settings.d.cts +24 -0
- package/dist/styles/fluid/settings.d.ts +24 -0
- package/dist/styles/fluid/settings.js +23 -0
- package/dist/styles/fluid/settings.js.map +1 -0
- package/dist/styles/fluid/simulation.cjs +183 -0
- package/dist/styles/fluid/simulation.cjs.map +1 -0
- package/dist/styles/fluid/simulation.d.cts +22 -0
- package/dist/styles/fluid/simulation.d.ts +22 -0
- package/dist/styles/fluid/simulation.js +183 -0
- package/dist/styles/fluid/simulation.js.map +1 -0
- package/dist/styles/fluid/size.cjs +17 -0
- package/dist/styles/fluid/size.cjs.map +1 -0
- package/dist/styles/fluid/size.d.cts +5 -0
- package/dist/styles/fluid/size.d.ts +5 -0
- package/dist/styles/fluid/size.js +17 -0
- package/dist/styles/fluid/size.js.map +1 -0
- package/dist/styles/fluid/webgl.cjs +607 -0
- package/dist/styles/fluid/webgl.cjs.map +1 -0
- package/dist/styles/fluid/webgl.d.cts +3 -0
- package/dist/styles/fluid/webgl.d.ts +3 -0
- package/dist/styles/fluid/webgl.js +607 -0
- package/dist/styles/fluid/webgl.js.map +1 -0
- package/dist/styles/shimmer/canvas2d.cjs +84 -0
- package/dist/styles/shimmer/canvas2d.cjs.map +1 -0
- package/dist/styles/shimmer/canvas2d.d.cts +3 -0
- package/dist/styles/shimmer/canvas2d.d.ts +3 -0
- package/dist/styles/shimmer/canvas2d.js +84 -0
- package/dist/styles/shimmer/canvas2d.js.map +1 -0
- package/dist/styles/shimmer/definition.cjs +15 -0
- package/dist/styles/shimmer/definition.cjs.map +1 -0
- package/dist/styles/shimmer/definition.d.cts +8 -0
- package/dist/styles/shimmer/definition.d.ts +8 -0
- package/dist/styles/shimmer/definition.js +16 -0
- package/dist/styles/shimmer/definition.js.map +1 -0
- package/dist/styles/shimmer/field.cjs +79 -0
- package/dist/styles/shimmer/field.cjs.map +1 -0
- package/dist/styles/shimmer/field.d.cts +11 -0
- package/dist/styles/shimmer/field.d.ts +11 -0
- package/dist/styles/shimmer/field.js +78 -0
- package/dist/styles/shimmer/field.js.map +1 -0
- package/dist/styles/shimmer/options.cjs +28 -0
- package/dist/styles/shimmer/options.cjs.map +1 -0
- package/dist/styles/shimmer/options.d.cts +22 -0
- package/dist/styles/shimmer/options.d.ts +22 -0
- package/dist/styles/shimmer/options.js +27 -0
- package/dist/styles/shimmer/options.js.map +1 -0
- package/dist/styles/shimmer/webgl.cjs +89 -0
- package/dist/styles/shimmer/webgl.cjs.map +1 -0
- package/dist/styles/shimmer/webgl.d.cts +4 -0
- package/dist/styles/shimmer/webgl.d.ts +4 -0
- package/dist/styles/shimmer/webgl.js +89 -0
- package/dist/styles/shimmer/webgl.js.map +1 -0
- package/package.json +75 -1
package/README.md
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
# interactive-bg
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/interactive-bg)
|
|
4
|
+
[](https://github.com/bsh314/interactive-bg/actions/workflows/ci.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/interactive-bg)
|
|
6
|
+
[](https://www.npmjs.com/package/interactive-bg)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
Animated backgrounds that react to the pointer, for hero sections, cards and full pages. One `<canvas>`, no dependencies, under 10 kB gzipped for the style you use.
|
|
4
10
|
|
|
5
11
|
**[Live demo](https://bsh314.github.io/interactive-bg/)**
|
|
6
12
|
|
|
7
|
-
| `topo` | `dots` | `plus` |
|
|
8
|
-
| --- | --- | --- |
|
|
9
|
-
|  |  |  |
|
|
10
|
-
| Topographic contour lines that drift slowly. The terrain rises under the pointer. | A grid of dots. The pointer pushes them aside; a click sends out a wave. | A grid of "+" signs that turn to point at the pointer; a click sends out a wave. |
|
|
13
|
+
| `topo` | `dots` | `plus` | `fluid` | `shimmer` |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
|  |  |  |  |  |
|
|
16
|
+
| Topographic contour lines that drift slowly. The terrain rises under the pointer. | A grid of dots. The pointer pushes them aside; a click sends out a wave. | A grid of "+" signs that turn to point at the pointer; a click sends out a wave. | A fluid simulation that follows the pointer in curling, smoke-like plumes. Clicks send out a burst. | Iridescent light bands from a warped sine field, split into rainbow fringes. The pointer bends them. |
|
|
11
17
|
|
|
12
|
-
- **Small.** Import one style with one renderer and ship only that: 4.5–
|
|
18
|
+
- **Small.** Import one style with one renderer and ship only that: 4.5–9.4 kB gzipped, engine included.
|
|
13
19
|
- **Cheap to run.** Idle animation renders at the lowest frame rate that still looks smooth, stops when nothing moves, and pauses off-screen and in background tabs. The grid styles idle on less CPU than an empty animated canvas.
|
|
14
20
|
- **GPU first.** WebGL2, with Canvas 2D as a fallback or as a deliberate choice.
|
|
15
21
|
- **Polite.** Respects `prefers-reduced-motion`, caps pixel density, never blocks clicks on your content.
|
|
@@ -60,9 +66,13 @@ What your app bundles, `createBackground` included (minified / gzipped):
|
|
|
60
66
|
| `topo` | 20.0 / 8.1 kB | 16.5 / 6.9 kB | 12.5 / 5.3 kB |
|
|
61
67
|
| `dots` | 17.9 / 7.3 kB | 14.4 / 6.0 kB | 10.4 / 4.5 kB |
|
|
62
68
|
| `plus` | 19.3 / 8.0 kB | 16.2 / 6.8 kB | 11.7 / 5.0 kB |
|
|
69
|
+
| `fluid` | 27.5 / 9.4 kB | 21.8 / 7.4 kB | 12.7 / 5.3 kB |
|
|
70
|
+
| `shimmer` | 15.0 / 6.2 kB | 11.9 / 5.0 kB | 9.7 / 4.2 kB |
|
|
63
71
|
|
|
64
72
|
With a single renderer there is no fallback: if the browser can't provide it, the background stays empty, `bg.renderer` is `null`, and your page carries on.
|
|
65
73
|
|
|
74
|
+
The `fluid` and `shimmer` styles are exceptions: their Canvas 2D builds compute the same effect on a small grid, so they are softer and coarser than the GPU versions, but keep working without WebGL2 (float render targets are only needed by `fluid`).
|
|
75
|
+
|
|
66
76
|
## Performance
|
|
67
77
|
|
|
68
78
|
Full-screen 1920×1080 background in Chrome on an Apple M1 Pro.
|
|
@@ -75,10 +85,15 @@ Full-screen 1920×1080 background in Chrome on an Apple M1 Pro.
|
|
|
75
85
|
| `dots`, Canvas 2D | 0.4% | 1.7% | 4.3% | 12% | ~70 MB |
|
|
76
86
|
| `plus`, WebGL | 0.1% | 0.9% | 3.6% | 11% | ~90 MB |
|
|
77
87
|
| `plus`, Canvas 2D | 0.4% | 2.5% | 3.9% | 13% | ~70 MB |
|
|
88
|
+
| `fluid`, WebGL | 0.6% | 0.9% | 4.8% | 16% | ~120 MB |
|
|
89
|
+
| `fluid`, Canvas 2D | 8.9% | 9.7% | 4.8% | 17% | ~80 MB |
|
|
90
|
+
| `shimmer`, WebGL | 0.2% | 0.4% | 3.4% | 10% | ~100 MB |
|
|
91
|
+
| `shimmer`, Canvas 2D | 8.3% | 10.2% | 11% | 19% | ~85 MB |
|
|
78
92
|
| Empty canvas, 30 fps, for reference | — | — | 6.4% | — | ~85 MB |
|
|
79
93
|
|
|
80
94
|
- **Main thread**: share of the page's main thread the background takes, so what's left for your app.
|
|
81
95
|
- **CPU** and **Memory**: the browser's renderer and GPU processes, as % of one core and MB above a blank page. Most of the memory is the canvas itself, which the browser needs for any full-screen canvas.
|
|
96
|
+
- **`fluid`** has no ambient animation: the idle figures cover the gentle burst after mount. After a few seconds without input the field is cleared, the last frame is empty, and the style stops until the pointer moves again.
|
|
82
97
|
|
|
83
98
|
Reproduce with `npm run bench:memory` and `bench/realtime.html`; see [CONTRIBUTING.md](CONTRIBUTING.md#benchmarks).
|
|
84
99
|
|
|
@@ -186,13 +201,46 @@ Shared by every style.
|
|
|
186
201
|
|
|
187
202
|
</details>
|
|
188
203
|
|
|
204
|
+
<details>
|
|
205
|
+
<summary><code>fluid</code></summary>
|
|
206
|
+
|
|
207
|
+
| Option | Default | What it does |
|
|
208
|
+
| ------------ | ------- | ------------------------------------------------------------------------------------------------ |
|
|
209
|
+
| `color` | `null` | Colour of the smoke, as any CSS colour. `null` picks a new hue several times a second; set a colour to keep it fixed. |
|
|
210
|
+
| `colorSpeed` | `10` | How many times per second the smoke picks a new hue while `color` is `null`. |
|
|
211
|
+
| `opacity` | `0.85` | Opacity of the smoke, `0`–`1`. Multiplies any alpha in `color`. |
|
|
212
|
+
| `curl` | `10` | How strongly the fluid curls back on itself. `0` = no swirl. |
|
|
213
|
+
| `force` | `6000` | How hard pointer movement stirs the fluid. `0` = the pointer only adds dye. |
|
|
214
|
+
| `radius` | `75` | Radius of each splash, in CSS pixels. |
|
|
215
|
+
| `fade` | `0.3` | Roughly how long the smoke takes to fade out, in seconds. |
|
|
216
|
+
| `resolution` | `128` | Simulation grid size (longer side, in cells). The Canvas 2D fallback runs the whole simulation at this size. |
|
|
217
|
+
| `shading` | `true` | Light the smoke from its own gradients, for a sense of depth. WebGL only; the Canvas 2D fallback draws flat smoke. |
|
|
218
|
+
|
|
219
|
+
</details>
|
|
220
|
+
|
|
221
|
+
<details>
|
|
222
|
+
<summary><code>shimmer</code></summary>
|
|
223
|
+
|
|
224
|
+
| Option | Default | What it does |
|
|
225
|
+
| ----------------- | --------- | ------------------------------------------------------------------------------------------------ |
|
|
226
|
+
| `opacity` | `1` | Opacity of the field. `1` is the opaque reference canvas; lower it over a page colour to imitate a translucent veil. |
|
|
227
|
+
| `speed` | `1` | Flow speed. `1` matches the reference's slow drift. `0` = still. |
|
|
228
|
+
| `frequency` | `7` | Sine frequency of the bands. Higher = more, narrower bands. |
|
|
229
|
+
| `colorScale` | `10` | Gamma applied to the bands. Higher = darker gaps and brighter crests. |
|
|
230
|
+
| `baseColor` | `#5735ff` | Colour mixed into the 20% base of the field. |
|
|
231
|
+
| `chroma` | `0.02` | Separation between the red, green and blue warps: chromatic dispersion. |
|
|
232
|
+
| `warp` | `1` | Strength of the sine/cosine distortion. `0` = straight bands. |
|
|
233
|
+
| `pointerStrength` | `0.35` | Pointer lens that bends the bands locally. `0` keeps the reference's ambient field. |
|
|
234
|
+
|
|
235
|
+
</details>
|
|
236
|
+
|
|
189
237
|
## Your own style
|
|
190
238
|
|
|
191
239
|
The engine handles the canvas, sizing, frame loop, pointer, visibility, reduced motion, background colour and edge fades. A style only says what to draw, in WebGL2, Canvas 2D or both. See [docs/custom-styles.md](docs/custom-styles.md).
|
|
192
240
|
|
|
193
241
|
## Browser support
|
|
194
242
|
|
|
195
|
-
Current Chrome, Edge, Firefox and Safari (15+). WebGL2 is used where available; every built-in style also has a Canvas 2D renderer.
|
|
243
|
+
Current Chrome, Edge, Firefox and Safari (15+). WebGL2 is used where available; every built-in style also has a Canvas 2D renderer. `fluid`'s WebGL2 renderer also needs floating-point render targets (`EXT_color_buffer_float`); without them, the Canvas 2D build runs the same simulation on the CPU.
|
|
196
244
|
|
|
197
245
|
## Contributing
|
|
198
246
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_canvas2d_renderer = require("../core/canvas2d-renderer.cjs");
|
|
3
|
+
const require_style = require("../core/style.cjs");
|
|
4
|
+
const require_canvas2d = require("../styles/fluid/canvas2d.cjs");
|
|
5
|
+
const require_definition = require("../styles/fluid/definition.cjs");
|
|
6
|
+
// src/fluid/canvas2d.ts
|
|
7
|
+
/** An interactive fluid simulation, solved on the CPU and drawn with Canvas 2D. */
|
|
8
|
+
var fluid = require_style.defineStyle({
|
|
9
|
+
...require_definition.fluidStyle,
|
|
10
|
+
renderers: [require_canvas2d_renderer.canvas2dRenderer(require_canvas2d.createFluidCanvas2D)]
|
|
11
|
+
});
|
|
12
|
+
exports.fluid = fluid;
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=canvas2d.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas2d.cjs","names":["defineStyle","fluidStyle","canvas2dRenderer","createFluidCanvas2D"],"sources":["../../src/fluid/canvas2d.ts"],"sourcesContent":["import { canvas2dRenderer } from '../core/canvas2d-renderer';\nimport { defineStyle, type StyleFactory } from '../core/style';\nimport { createFluidCanvas2D } from '../styles/fluid/canvas2d';\nimport { fluidStyle } from '../styles/fluid/definition';\nimport type { FluidOptions } from '../styles/fluid/options';\n\nexport type { FluidOptions };\n\n/** An interactive fluid simulation, solved on the CPU and drawn with Canvas 2D. */\nexport const fluid: StyleFactory<FluidOptions> = defineStyle({\n ...fluidStyle,\n renderers: [canvas2dRenderer(createFluidCanvas2D)],\n});\n"],"mappings":";;;;;;;AASA,IAAa,QAAoCA,cAAAA,YAAY;CAC3D,GAAGC,mBAAAA;CACH,WAAW,CAACC,0BAAAA,iBAAiBC,iBAAAA,mBAAmB,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type StyleFactory } from '../core/style.cjs';
|
|
2
|
+
import type { FluidOptions } from '../styles/fluid/options.cjs';
|
|
3
|
+
export type { FluidOptions };
|
|
4
|
+
/** An interactive fluid simulation, solved on the CPU and drawn with Canvas 2D. */
|
|
5
|
+
export declare const fluid: StyleFactory<FluidOptions>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type StyleFactory } from '../core/style.js';
|
|
2
|
+
import type { FluidOptions } from '../styles/fluid/options.js';
|
|
3
|
+
export type { FluidOptions };
|
|
4
|
+
/** An interactive fluid simulation, solved on the CPU and drawn with Canvas 2D. */
|
|
5
|
+
export declare const fluid: StyleFactory<FluidOptions>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { canvas2dRenderer } from "../core/canvas2d-renderer.js";
|
|
2
|
+
import { defineStyle } from "../core/style.js";
|
|
3
|
+
import { createFluidCanvas2D } from "../styles/fluid/canvas2d.js";
|
|
4
|
+
import { fluidStyle } from "../styles/fluid/definition.js";
|
|
5
|
+
// src/fluid/canvas2d.ts
|
|
6
|
+
/** An interactive fluid simulation, solved on the CPU and drawn with Canvas 2D. */
|
|
7
|
+
var fluid = defineStyle({
|
|
8
|
+
...fluidStyle,
|
|
9
|
+
renderers: [canvas2dRenderer(createFluidCanvas2D)]
|
|
10
|
+
});
|
|
11
|
+
export { fluid };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=canvas2d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas2d.js","names":[],"sources":["../../src/fluid/canvas2d.ts"],"sourcesContent":["import { canvas2dRenderer } from '../core/canvas2d-renderer';\nimport { defineStyle, type StyleFactory } from '../core/style';\nimport { createFluidCanvas2D } from '../styles/fluid/canvas2d';\nimport { fluidStyle } from '../styles/fluid/definition';\nimport type { FluidOptions } from '../styles/fluid/options';\n\nexport type { FluidOptions };\n\n/** An interactive fluid simulation, solved on the CPU and drawn with Canvas 2D. */\nexport const fluid: StyleFactory<FluidOptions> = defineStyle({\n ...fluidStyle,\n renderers: [canvas2dRenderer(createFluidCanvas2D)],\n});\n"],"mappings":";;;;;;AASA,IAAa,QAAoC,YAAY;CAC3D,GAAG;CACH,WAAW,CAAC,iBAAiB,mBAAmB,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_canvas2d_renderer = require("../core/canvas2d-renderer.cjs");
|
|
3
|
+
const require_style = require("../core/style.cjs");
|
|
4
|
+
const require_webgl_renderer = require("../core/webgl-renderer.cjs");
|
|
5
|
+
const require_canvas2d = require("../styles/fluid/canvas2d.cjs");
|
|
6
|
+
const require_definition = require("../styles/fluid/definition.cjs");
|
|
7
|
+
const require_webgl = require("../styles/fluid/webgl.cjs");
|
|
8
|
+
// src/fluid/index.ts
|
|
9
|
+
/** An interactive fluid simulation, drawn with WebGL2 where available and a CPU simulation otherwise. */
|
|
10
|
+
var fluid = require_style.defineStyle({
|
|
11
|
+
...require_definition.fluidStyle,
|
|
12
|
+
renderers: [require_webgl_renderer.webglRenderer(require_webgl.createFluidWebGL), require_canvas2d_renderer.canvas2dRenderer(require_canvas2d.createFluidCanvas2D)]
|
|
13
|
+
});
|
|
14
|
+
exports.fluid = fluid;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["defineStyle","fluidStyle","webglRenderer","createFluidWebGL","canvas2dRenderer","createFluidCanvas2D"],"sources":["../../src/fluid/index.ts"],"sourcesContent":["import { canvas2dRenderer } from '../core/canvas2d-renderer';\nimport { defineStyle, type StyleFactory } from '../core/style';\nimport { webglRenderer } from '../core/webgl-renderer';\nimport { createFluidCanvas2D } from '../styles/fluid/canvas2d';\nimport { fluidStyle } from '../styles/fluid/definition';\nimport type { FluidOptions } from '../styles/fluid/options';\nimport { createFluidWebGL } from '../styles/fluid/webgl';\n\nexport type { FluidOptions };\n\n/** An interactive fluid simulation, drawn with WebGL2 where available and a CPU simulation otherwise. */\nexport const fluid: StyleFactory<FluidOptions> = defineStyle({\n ...fluidStyle,\n renderers: [webglRenderer(createFluidWebGL), canvas2dRenderer(createFluidCanvas2D)],\n});\n"],"mappings":";;;;;;;;;AAWA,IAAa,QAAoCA,cAAAA,YAAY;CAC3D,GAAGC,mBAAAA;CACH,WAAW,CAACC,uBAAAA,cAAcC,cAAAA,gBAAgB,GAAGC,0BAAAA,iBAAiBC,iBAAAA,mBAAmB,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type StyleFactory } from '../core/style.cjs';
|
|
2
|
+
import type { FluidOptions } from '../styles/fluid/options.cjs';
|
|
3
|
+
export type { FluidOptions };
|
|
4
|
+
/** An interactive fluid simulation, drawn with WebGL2 where available and a CPU simulation otherwise. */
|
|
5
|
+
export declare const fluid: StyleFactory<FluidOptions>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type StyleFactory } from '../core/style.js';
|
|
2
|
+
import type { FluidOptions } from '../styles/fluid/options.js';
|
|
3
|
+
export type { FluidOptions };
|
|
4
|
+
/** An interactive fluid simulation, drawn with WebGL2 where available and a CPU simulation otherwise. */
|
|
5
|
+
export declare const fluid: StyleFactory<FluidOptions>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { canvas2dRenderer } from "../core/canvas2d-renderer.js";
|
|
2
|
+
import { defineStyle } from "../core/style.js";
|
|
3
|
+
import { webglRenderer } from "../core/webgl-renderer.js";
|
|
4
|
+
import { createFluidCanvas2D } from "../styles/fluid/canvas2d.js";
|
|
5
|
+
import { fluidStyle } from "../styles/fluid/definition.js";
|
|
6
|
+
import { createFluidWebGL } from "../styles/fluid/webgl.js";
|
|
7
|
+
// src/fluid/index.ts
|
|
8
|
+
/** An interactive fluid simulation, drawn with WebGL2 where available and a CPU simulation otherwise. */
|
|
9
|
+
var fluid = defineStyle({
|
|
10
|
+
...fluidStyle,
|
|
11
|
+
renderers: [webglRenderer(createFluidWebGL), canvas2dRenderer(createFluidCanvas2D)]
|
|
12
|
+
});
|
|
13
|
+
export { fluid };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/fluid/index.ts"],"sourcesContent":["import { canvas2dRenderer } from '../core/canvas2d-renderer';\nimport { defineStyle, type StyleFactory } from '../core/style';\nimport { webglRenderer } from '../core/webgl-renderer';\nimport { createFluidCanvas2D } from '../styles/fluid/canvas2d';\nimport { fluidStyle } from '../styles/fluid/definition';\nimport type { FluidOptions } from '../styles/fluid/options';\nimport { createFluidWebGL } from '../styles/fluid/webgl';\n\nexport type { FluidOptions };\n\n/** An interactive fluid simulation, drawn with WebGL2 where available and a CPU simulation otherwise. */\nexport const fluid: StyleFactory<FluidOptions> = defineStyle({\n ...fluidStyle,\n renderers: [webglRenderer(createFluidWebGL), canvas2dRenderer(createFluidCanvas2D)],\n});\n"],"mappings":";;;;;;;;AAWA,IAAa,QAAoC,YAAY;CAC3D,GAAG;CACH,WAAW,CAAC,cAAc,gBAAgB,GAAG,iBAAiB,mBAAmB,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_style = require("../core/style.cjs");
|
|
3
|
+
const require_webgl_renderer = require("../core/webgl-renderer.cjs");
|
|
4
|
+
const require_definition = require("../styles/fluid/definition.cjs");
|
|
5
|
+
const require_webgl = require("../styles/fluid/webgl.cjs");
|
|
6
|
+
// src/fluid/webgl.ts
|
|
7
|
+
/** An interactive fluid simulation, drawn with WebGL2 only. */
|
|
8
|
+
var fluid = require_style.defineStyle({
|
|
9
|
+
...require_definition.fluidStyle,
|
|
10
|
+
renderers: [require_webgl_renderer.webglRenderer(require_webgl.createFluidWebGL)]
|
|
11
|
+
});
|
|
12
|
+
exports.fluid = fluid;
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=webgl.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl.cjs","names":["defineStyle","fluidStyle","webglRenderer","createFluidWebGL"],"sources":["../../src/fluid/webgl.ts"],"sourcesContent":["import { defineStyle, type StyleFactory } from '../core/style';\nimport { webglRenderer } from '../core/webgl-renderer';\nimport { fluidStyle } from '../styles/fluid/definition';\nimport type { FluidOptions } from '../styles/fluid/options';\nimport { createFluidWebGL } from '../styles/fluid/webgl';\n\nexport type { FluidOptions };\n\n/** An interactive fluid simulation, drawn with WebGL2 only. */\nexport const fluid: StyleFactory<FluidOptions> = defineStyle({\n ...fluidStyle,\n renderers: [webglRenderer(createFluidWebGL)],\n});\n"],"mappings":";;;;;;;AASA,IAAa,QAAoCA,cAAAA,YAAY;CAC3D,GAAGC,mBAAAA;CACH,WAAW,CAACC,uBAAAA,cAAcC,cAAAA,gBAAgB,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type StyleFactory } from '../core/style.cjs';
|
|
2
|
+
import type { FluidOptions } from '../styles/fluid/options.cjs';
|
|
3
|
+
export type { FluidOptions };
|
|
4
|
+
/** An interactive fluid simulation, drawn with WebGL2 only. */
|
|
5
|
+
export declare const fluid: StyleFactory<FluidOptions>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type StyleFactory } from '../core/style.js';
|
|
2
|
+
import type { FluidOptions } from '../styles/fluid/options.js';
|
|
3
|
+
export type { FluidOptions };
|
|
4
|
+
/** An interactive fluid simulation, drawn with WebGL2 only. */
|
|
5
|
+
export declare const fluid: StyleFactory<FluidOptions>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineStyle } from "../core/style.js";
|
|
2
|
+
import { webglRenderer } from "../core/webgl-renderer.js";
|
|
3
|
+
import { fluidStyle } from "../styles/fluid/definition.js";
|
|
4
|
+
import { createFluidWebGL } from "../styles/fluid/webgl.js";
|
|
5
|
+
// src/fluid/webgl.ts
|
|
6
|
+
/** An interactive fluid simulation, drawn with WebGL2 only. */
|
|
7
|
+
var fluid = defineStyle({
|
|
8
|
+
...fluidStyle,
|
|
9
|
+
renderers: [webglRenderer(createFluidWebGL)]
|
|
10
|
+
});
|
|
11
|
+
export { fluid };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=webgl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl.js","names":[],"sources":["../../src/fluid/webgl.ts"],"sourcesContent":["import { defineStyle, type StyleFactory } from '../core/style';\nimport { webglRenderer } from '../core/webgl-renderer';\nimport { fluidStyle } from '../styles/fluid/definition';\nimport type { FluidOptions } from '../styles/fluid/options';\nimport { createFluidWebGL } from '../styles/fluid/webgl';\n\nexport type { FluidOptions };\n\n/** An interactive fluid simulation, drawn with WebGL2 only. */\nexport const fluid: StyleFactory<FluidOptions> = defineStyle({\n ...fluidStyle,\n renderers: [webglRenderer(createFluidWebGL)],\n});\n"],"mappings":";;;;;;AASA,IAAa,QAAoC,YAAY;CAC3D,GAAG;CACH,WAAW,CAAC,cAAc,gBAAgB,CAAC;AAC7C,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -9,6 +9,8 @@ const require_noise = require("./shared/noise.cjs");
|
|
|
9
9
|
const require_topo_index = require("./topo/index.cjs");
|
|
10
10
|
const require_dots_index = require("./dots/index.cjs");
|
|
11
11
|
const require_plus_index = require("./plus/index.cjs");
|
|
12
|
+
const require_fluid_index = require("./fluid/index.cjs");
|
|
13
|
+
const require_shimmer_index = require("./shimmer/index.cjs");
|
|
12
14
|
exports.FULLSCREEN_VERTEX_SHADER = require_webgl.FULLSCREEN_VERTEX_SHADER;
|
|
13
15
|
exports.canvas2dRenderer = require_canvas2d_renderer.canvas2dRenderer;
|
|
14
16
|
exports.createBackground = require_engine.createBackground;
|
|
@@ -17,8 +19,10 @@ exports.createProgram = require_webgl.createProgram;
|
|
|
17
19
|
exports.defineStyle = require_style.defineStyle;
|
|
18
20
|
exports.dots = require_dots_index.dots;
|
|
19
21
|
exports.engineDefaults = require_engine.engineDefaults;
|
|
22
|
+
exports.fluid = require_fluid_index.fluid;
|
|
20
23
|
exports.getUniforms = require_webgl.getUniforms;
|
|
21
24
|
exports.parseColor = require_color.parseColor;
|
|
22
25
|
exports.plus = require_plus_index.plus;
|
|
26
|
+
exports.shimmer = require_shimmer_index.shimmer;
|
|
23
27
|
exports.topo = require_topo_index.topo;
|
|
24
28
|
exports.webglRenderer = require_webgl_renderer.webglRenderer;
|
package/dist/index.d.cts
CHANGED
|
@@ -6,6 +6,10 @@ export { dots } from './dots/index.cjs';
|
|
|
6
6
|
export type { DotsOptions } from './dots/index.cjs';
|
|
7
7
|
export { plus } from './plus/index.cjs';
|
|
8
8
|
export type { PlusOptions } from './plus/index.cjs';
|
|
9
|
+
export { fluid } from './fluid/index.cjs';
|
|
10
|
+
export type { FluidOptions } from './fluid/index.cjs';
|
|
11
|
+
export { shimmer } from './shimmer/index.cjs';
|
|
12
|
+
export type { ShimmerOptions } from './shimmer/index.cjs';
|
|
9
13
|
export { defineStyle } from './core/style.cjs';
|
|
10
14
|
export type { Frame, Point, Pointer, RendererName, Style, StyleBase, StyleDefinition, StyleFactory, StyleRenderer, } from './core/style.cjs';
|
|
11
15
|
export type { Fade, Renderer, Surface } from './core/surface.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export { dots } from './dots/index.js';
|
|
|
6
6
|
export type { DotsOptions } from './dots/index.js';
|
|
7
7
|
export { plus } from './plus/index.js';
|
|
8
8
|
export type { PlusOptions } from './plus/index.js';
|
|
9
|
+
export { fluid } from './fluid/index.js';
|
|
10
|
+
export type { FluidOptions } from './fluid/index.js';
|
|
11
|
+
export { shimmer } from './shimmer/index.js';
|
|
12
|
+
export type { ShimmerOptions } from './shimmer/index.js';
|
|
9
13
|
export { defineStyle } from './core/style.js';
|
|
10
14
|
export type { Frame, Point, Pointer, RendererName, Style, StyleBase, StyleDefinition, StyleFactory, StyleRenderer, } from './core/style.js';
|
|
11
15
|
export type { Fade, Renderer, Surface } from './core/surface.js';
|
package/dist/index.js
CHANGED
|
@@ -8,4 +8,6 @@ import { createNoise3D } from "./shared/noise.js";
|
|
|
8
8
|
import { topo } from "./topo/index.js";
|
|
9
9
|
import { dots } from "./dots/index.js";
|
|
10
10
|
import { plus } from "./plus/index.js";
|
|
11
|
-
|
|
11
|
+
import { fluid } from "./fluid/index.js";
|
|
12
|
+
import { shimmer } from "./shimmer/index.js";
|
|
13
|
+
export { FULLSCREEN_VERTEX_SHADER, canvas2dRenderer, createBackground, createNoise3D, createProgram, defineStyle, dots, engineDefaults, fluid, getUniforms, parseColor, plus, shimmer, topo, webglRenderer };
|