instantshader 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Animated WebGL gradient shaders with zero dependencies. Mount a live, resizable
|
|
4
4
|
gradient into any DOM element, or render a single frame to a detached canvas
|
|
5
|
-
for export pipelines. Built by [InstantGradient](https://instantgradient.com/
|
|
5
|
+
for export pipelines. Built by [InstantGradient](https://instantgradient.com/app).
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -23,6 +23,36 @@ const handle = mountGradient(document.getElementById("bg")!, {
|
|
|
23
23
|
// handle.pause() / handle.resume() / handle.dispose() when done
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## Shaders
|
|
27
|
+
|
|
28
|
+
Each shader is a separate named export, so the ones you don't import
|
|
29
|
+
tree-shake away.
|
|
30
|
+
|
|
31
|
+
| Shader | Look | Params |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| `flow` | Isotropic swirling currents. A curl-noise field advects the sample point before it hits fbm, so colour masses travel in continuous, fluid-like eddies with defined luminous edges and generous calm negative space. | `scale`, `curl`, `drift`, `openness`, `grain` |
|
|
34
|
+
| `beam` | One wide beam of soft light crossing a near-black frame. The palette walks the beam's length, thin brighter filaments crawl inside it, and most of the frame is dark negative space. | `scale`, `width`, `glow`, `angle`, `grain` |
|
|
35
|
+
| `bloom` | A fan of huge, ultra-soft petals radiating from the frame's bottom edge. One analytic rose-curve field, so the palette reads as concentric scalloped bands from a hot core out to a dark background, with thin dark creases between the petals. | `scale`, `petals`, `pinch`, `bend`, `sway`, `colorflow`, `grain` |
|
|
36
|
+
|
|
37
|
+
Every shader takes the same mount options; `params` is where they differ:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { mountGradient, bloom } from "instantshader";
|
|
41
|
+
|
|
42
|
+
mountGradient(el, {
|
|
43
|
+
shader: bloom,
|
|
44
|
+
colors: ["#ffd9e8", "#ffb300", "#ff8fc0", "#3d7bff", "#0a2e14"],
|
|
45
|
+
// bloom has two independent motion modes — petals that breathe and lean,
|
|
46
|
+
// and colours that travel outward through a still pattern. Mix freely.
|
|
47
|
+
params: { sway: 0.5, colorflow: 0.4 },
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Ranges, defaults and labels are all discoverable at runtime — `shader.params`
|
|
52
|
+
is an array of `ParamDef`, and `shader.randomParams(rand)` produces a full,
|
|
53
|
+
sensible param set for "randomize" flows. `shaders` and `getShader(id)` expose
|
|
54
|
+
the whole registry (importing either pulls every shader).
|
|
55
|
+
|
|
26
56
|
## Seamless loops
|
|
27
57
|
|
|
28
58
|
Set `loopSeconds` and the animation repeats exactly, with no visible seam at
|
|
@@ -68,5 +98,11 @@ Notes:
|
|
|
68
98
|
- **`beam` freezes its width swell below ~29s.** Its natural cycle is ~57s and
|
|
69
99
|
cannot be squeezed into a short loop without becoming a throb, so under that
|
|
70
100
|
threshold the swell holds still instead. Everything else still animates.
|
|
101
|
+
- **`bloom` sheds parts of its sway on short loops.** Its `sway` is several
|
|
102
|
+
slow oscillations (petal breathing ~20s, fan lean ~30s, petal flex ~42s)
|
|
103
|
+
layered over a noise wander. Each oscillation holds still once the loop is
|
|
104
|
+
shorter than about half its own period, so below ~10s the wander is the only
|
|
105
|
+
thing left moving. `colorflow` is unaffected — it always fits at least one
|
|
106
|
+
full cycle into the loop, flowing faster on a short one.
|
|
71
107
|
- Any loop necessarily revisits the same state every N seconds; a long period
|
|
72
108
|
is what buys the impression of never repeating.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantshader",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Animated WebGL gradient shaders. Zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "git+https://github.com/ugolbck/instantshader.git",
|
|
10
10
|
"directory": "packages/core"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://instantgradient.com/
|
|
12
|
+
"homepage": "https://instantgradient.com/app",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
15
|
"types": "./dist/index.d.ts",
|