@arraypress/effects-astro 0.10.0 → 0.12.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/AGENTS.md +1 -1
- package/COMPONENTS.md +214 -10
- package/LICENSE +2 -2
- package/package.json +1 -1
- package/src/components/CascadeGrid.astro +41 -0
- package/src/components/DitherField.astro +41 -0
- package/src/components/DitherGradient.astro +41 -0
- package/src/components/FlowField.astro +38 -0
- package/src/components/FlutedGlow.astro +39 -0
- package/src/components/KineticGrid.astro +38 -0
- package/src/components/LightLeak.astro +39 -0
- package/src/components/PixelFountain.astro +20 -7
- package/src/components/PixelGlitchText.astro +4 -3
- package/src/components/PixelHorizon.astro +40 -0
- package/src/components/TruchetField.astro +40 -0
- package/src/components/VoronoiMesh.astro +39 -0
- package/src/index.d.ts +23 -1
- package/src/index.js +13 -1
- package/src/runtime/ascii-noise.js +6 -107
- package/src/runtime/bayer.d.ts +5 -0
- package/src/runtime/bayer.js +48 -0
- package/src/runtime/cascade-grid.d.ts +112 -0
- package/src/runtime/cascade-grid.js +423 -0
- package/src/runtime/dither-field.d.ts +74 -0
- package/src/runtime/dither-field.js +416 -0
- package/src/runtime/dither-gradient.d.ts +91 -0
- package/src/runtime/dither-gradient.js +410 -0
- package/src/runtime/flow-field.d.ts +117 -0
- package/src/runtime/flow-field.js +516 -0
- package/src/runtime/fluted-glow.d.ts +79 -0
- package/src/runtime/fluted-glow.js +312 -0
- package/src/runtime/hash-noise.d.ts +14 -0
- package/src/runtime/hash-noise.js +169 -0
- package/src/runtime/kinetic-grid.d.ts +88 -0
- package/src/runtime/kinetic-grid.js +487 -0
- package/src/runtime/light-leak.d.ts +72 -0
- package/src/runtime/light-leak.js +408 -0
- package/src/runtime/pixel-fountain.d.ts +29 -13
- package/src/runtime/pixel-fountain.js +183 -42
- package/src/runtime/pixel-glitch.d.ts +2 -0
- package/src/runtime/pixel-glitch.js +8 -2
- package/src/runtime/pixel-horizon.d.ts +60 -0
- package/src/runtime/pixel-horizon.js +274 -0
- package/src/runtime/truchet-field.d.ts +60 -0
- package/src/runtime/truchet-field.js +272 -0
- package/src/runtime/voronoi-mesh.d.ts +101 -0
- package/src/runtime/voronoi-mesh.js +610 -0
package/AGENTS.md
CHANGED
|
@@ -10,7 +10,7 @@ Pick by what is asked for:
|
|
|
10
10
|
|
|
11
11
|
| Asked for | Use |
|
|
12
12
|
|---|---|
|
|
13
|
-
| An animated, colourful background for a page or hero | `<LightField>` (liquid light), `<FlutedGlass>` (light, gallery-white or dark), `<AsciiRain>` (techy, dark), `<AsciiNoise>` (drifting blobs of monospace type; techy, terminal, studio), `<DotGrid>` (quiet, minimal), `<SignalLines>` / `<WaveBars>` (audio) |
|
|
13
|
+
| An animated, colourful background for a page or hero | `<LightField>` (liquid light), `<FlutedGlass>` (light, gallery-white or dark), `<AsciiRain>` (techy, dark), `<AsciiNoise>` (drifting blobs of monospace type; techy, terminal, studio), `<LightLeak>` (a soft drifting colour field), `<DitherField>` (dithered dots, ripples from a corner), `<CascadeGrid>` (a hex or dot spectrogram), `<FlowField>` (fine trails on a flow; Canvas), `<VoronoiMesh>` (thin nested cell lines), `<KineticGrid>` (a wire grid rain ripples), `<DitherGradient>` (a gradient in dithered or halftone dots: wave, band, swirl, pinwheel, steps), `<TruchetField>` (quarter-arc tiles turning a few at a time), `<PixelHorizon>` (a colour breaking into square blocks), `<FlutedGlow>` (a ring or orb of light through reeded glass), `<DotGrid>` (quiet, minimal), `<SignalLines>` / `<WaveBars>` (audio) |
|
|
14
14
|
| Ink in water, a lit fluid background, or a hero whose colours a palette switcher changes | `<InkField palette="…">` (Lumetri, Forest, Cadmium, Peacock, Vermillion, Barbie, Uranium, Azure, Ruby, Ultramarine, Saffron, Crimson); `setColors(el, INK_PALETTES[name].colors, INK_PALETTES[name].glint)` recolours it live |
|
|
15
15
|
| Something to play with: ink, smoke, liquid, "interactive" | `<Ink>` over a section, or `<LightField>` (it has the fluid under it), or `<DotGrid>` (click ripples) |
|
|
16
16
|
| A soft gradient that drifts (a card, a hero, a section) — "grainy gradient", "mesh", "aurora" | `<LiveGradient colors={[…]}>` (lazy by default; `liveGradient(colors)` for HTML made in a script) |
|
package/COMPONENTS.md
CHANGED
|
@@ -98,6 +98,23 @@ BorderSweep: a light travelling round an element's outline, on hover and focus o
|
|
|
98
98
|
| `still` | `'ring' \| 'none'` | What reduced motion shows: `ring` a still lit edge where the light would run, `none` nothing. Default `ring`. |
|
|
99
99
|
| `class` | `string` | Classes for the element. |
|
|
100
100
|
|
|
101
|
+
## `<CascadeGrid>`
|
|
102
|
+
|
|
103
|
+
CascadeGrid: a grid of hexagons or dots that behaves like a scrolling spectrogram, each column showing the same made-up spectrum a little later than the last, so waves cascade across it and the cells swell from idle specks to reactive shapes. See src/runtime/cascade-grid.js.
|
|
104
|
+
|
|
105
|
+
```astro
|
|
106
|
+
<section class="hero" style="position: relative; background: #0b0b0b">
|
|
107
|
+
<CascadeGrid colors={['#2a2a2a', '#c8ff00']} background="#0b0b0b" quiet={{ radius: 0.5, depth: 0.95 }} />
|
|
108
|
+
<h1>…</h1>
|
|
109
|
+
</section>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
| Prop | Type | |
|
|
113
|
+
|---|---|---|
|
|
114
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
115
|
+
| `lazy` | `boolean \| string` | Run only while near the screen, giving its WebGL context back when away: for pages with many effects. Default false. |
|
|
116
|
+
| `class` | `string` | Classes for the element. |
|
|
117
|
+
|
|
101
118
|
## `<Caustics>`
|
|
102
119
|
|
|
103
120
|
Caustics: sunlight through rippling water onto a pool floor, a bright, shifting net of light over an aqua ground, with a faint rainbow at the edges of its lines. The pointer stirs the water where it is; faint tiles can lie on the floor. See src/runtime/caustics.js.
|
|
@@ -172,6 +189,40 @@ Cursor: a custom cursor for the whole page: a dot at the pointer and a ring that
|
|
|
172
189
|
| `size` | `number` | The ring's size at rest, px. Default 32. |
|
|
173
190
|
| `blend` | `string` | Blend with the page: `difference` inverts what is under it, readable on any ground. Default `difference`. |
|
|
174
191
|
|
|
192
|
+
## `<DitherField>`
|
|
193
|
+
|
|
194
|
+
DitherField: a field of slow noise drawn in square dots, Bayer-dithered at its edges into a solid, colour-banded core, with ripples running out from a corner, bent into shore-wave shapes. See src/runtime/dither-field.js.
|
|
195
|
+
|
|
196
|
+
```astro
|
|
197
|
+
<section class="hero" style="position: relative; background: #0b0b0b">
|
|
198
|
+
<DitherField background="#0b0b0b" colors={['#3d4d0a', '#c8ff00']} quiet={{ x: 0.3, y: 0.5, radius: 0.6, depth: 1 }} />
|
|
199
|
+
<h1>…</h1>
|
|
200
|
+
</section>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
| Prop | Type | |
|
|
204
|
+
|---|---|---|
|
|
205
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
206
|
+
| `lazy` | `boolean \| string` | Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away: for pages with many effects. Default false. |
|
|
207
|
+
| `class` | `string` | Classes for the element. |
|
|
208
|
+
|
|
209
|
+
## `<DitherGradient>`
|
|
210
|
+
|
|
211
|
+
DitherGradient: a soft colour gradient drawn only in dots: a wavy horizon, a glowing band, a swirl, a pinwheel or stepped columns, square dots an ordered dither thins out or round halftone dots that shrink. See src/runtime/dither-gradient.js.
|
|
212
|
+
|
|
213
|
+
```astro
|
|
214
|
+
<section class="hero" style="position: relative; background: #0b0b0b">
|
|
215
|
+
<DitherGradient background="#081226" colors={['#5a0f4a', '#ff1f8f']} shape="wave" quiet={{ radius: 0.5, depth: 1 }} />
|
|
216
|
+
<h1>…</h1>
|
|
217
|
+
</section>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
| Prop | Type | |
|
|
221
|
+
|---|---|---|
|
|
222
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
223
|
+
| `lazy` | `boolean \| string` | Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away: for pages with many effects. Default false. |
|
|
224
|
+
| `class` | `string` | Classes for the element. |
|
|
225
|
+
|
|
175
226
|
## `<DotGrid>`
|
|
176
227
|
|
|
177
228
|
DotGrid: a sea of dots you can drop stones into. A slow current moves through a fixed grid of dots, a swell sits under the pointer, and a click sends a widening ripple across, lifting and pushing the dots. See src/runtime/dot-grid.js.
|
|
@@ -234,6 +285,38 @@ FitText: one line of text sized to exactly span its parent's content width, what
|
|
|
234
285
|
| `as` | `HTMLTag` | The element to render. Default `div`. |
|
|
235
286
|
| `class` | `string` | Classes for the element. |
|
|
236
287
|
|
|
288
|
+
## `<FlowField>`
|
|
289
|
+
|
|
290
|
+
FlowField: hundreds of short, fine trails riding a slowly evolving noise flow, born, gathering into streams and fading, white on black by default; how many there are, how fast they go and how heavy the lines are drift slowly. See src/runtime/flow-field.js.
|
|
291
|
+
|
|
292
|
+
```astro
|
|
293
|
+
<section class="hero" style="position: relative">
|
|
294
|
+
<FlowField colors={['#c8ff00', '#39ff88']} background="#0b0b0b" quiet={{ radius: 0.5, depth: 0.85 }} />
|
|
295
|
+
<h1>…</h1>
|
|
296
|
+
</section>
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
| Prop | Type | |
|
|
300
|
+
|---|---|---|
|
|
301
|
+
| `colors` | `string[]` | The trails' colours, CSS hex, blended in Oklab along each trail's life (or by its speed). Default white. |
|
|
302
|
+
| `palette` | `PaletteName \| (string & {})` | A shared palette by name (`PALETTES`, any case), when there are no `colors`. |
|
|
303
|
+
| `background` | `string` | The ground, CSS hex: filled every frame, so the canvas is opaque. Default `#000000`. |
|
|
304
|
+
| `colorBy` | `'life' \| 'speed' \| 'random'` | What picks a trail's colour along `colors`: its age, how fast it travels, or one colour each at random. Default `life`. |
|
|
305
|
+
| `density` | `number` | Trails per 100 × 100 CSS px, on average. Default 12. |
|
|
306
|
+
| `length` | `number` | How much of its path a trail shows behind it, seconds. Default 0.5. |
|
|
307
|
+
| `weight` | `number` | Line width, CSS px. Default 0.7. |
|
|
308
|
+
| `opacity` | `number` | A trail head's opacity, 0–1; the tail fades from it. Default 0.75. |
|
|
309
|
+
| `pace` | `number` | How fast trails travel, CSS px a second, on average. Default 110. |
|
|
310
|
+
| `scale` | `number` | How many noise features span the element (across √(width × height)); higher is busier. Default 2. |
|
|
311
|
+
| `evolve` | `number` | How fast the field changes, noise units a second. Default 0.15. |
|
|
312
|
+
| `life` | `number` | A trail's average life, seconds (each lives half to one and a half times it). Default 4. |
|
|
313
|
+
| `vary` | `number` | How far the slow drives swing density, pace, weight and evolution, 0–1; 0 holds them. Default 0.7. |
|
|
314
|
+
| `speed` | `number` | Plays every clock faster or slower; 0 for one still frame. Default 1. |
|
|
315
|
+
| `seed` | `number` | Which field and which trails: the same seed draws the same. Default 1. |
|
|
316
|
+
| `quiet` | `{ x?: number; y?: number; radius?: number; depth?: number } \| null` | An area with fewer, fainter trails: centre (0–1 from the top left), radius (share of the height), depth (0–1). |
|
|
317
|
+
| `fixed` | `boolean` | Fill the viewport, behind the page (position: fixed, z-index -1). Default false. |
|
|
318
|
+
| `class` | `string` | Classes for the element. |
|
|
319
|
+
|
|
237
320
|
## `<FlutedGlass>`
|
|
238
321
|
|
|
239
322
|
FlutedGlass: a pane of slanted fluted glass over soft blooms of colour, the main one following the pointer. Each rib bends what is behind it and fringes it with a thin rainbow. See src/runtime/fluted-glass.js.
|
|
@@ -260,6 +343,23 @@ FlutedGlass: a pane of slanted fluted glass over soft blooms of colour, the main
|
|
|
260
343
|
| `fixed` | `boolean` | Fill the viewport, behind the page (position: fixed, z-index -1). Default false. |
|
|
261
344
|
| `class` | `string` | Classes for the element. |
|
|
262
345
|
|
|
346
|
+
## `<FlutedGlow>`
|
|
347
|
+
|
|
348
|
+
FlutedGlow: a soft ring, orb or rising light seen through upright reeded glass, breathing slowly, made to sit behind copy (no pointer). See src/runtime/fluted-glow.js.
|
|
349
|
+
|
|
350
|
+
```astro
|
|
351
|
+
<section class="hero" style="position: relative; background: #0b0b0b">
|
|
352
|
+
<FlutedGlow colors={['#7a1d00', '#ff7a00', '#ffd27a']} shape="ring" />
|
|
353
|
+
<h1>…</h1>
|
|
354
|
+
</section>
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
| Prop | Type | |
|
|
358
|
+
|---|---|---|
|
|
359
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
360
|
+
| `lazy` | `boolean \| string` | Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away: for pages with many effects. Default false. |
|
|
361
|
+
| `class` | `string` | Classes for the element. |
|
|
362
|
+
|
|
263
363
|
## `<Galaxy>`
|
|
264
364
|
|
|
265
365
|
Galaxy: deep space in your colours. Soft nebula clouds with dark dust lanes, fine glitter shimmering over them and stars twinkling each on its own beat, the brightest with a cross of light, all drifting slowly. See src/runtime/galaxy.js.
|
|
@@ -560,6 +660,35 @@ IsoCity: a small isometric city in flat-shaded low poly, with cars driving its s
|
|
|
560
660
|
| `fixed` | `boolean` | Fill the viewport, behind the page (position: fixed, z-index -1). Default false. |
|
|
561
661
|
| `class` | `string` | Classes for the element. |
|
|
562
662
|
|
|
663
|
+
## `<KineticGrid>`
|
|
664
|
+
|
|
665
|
+
KineticGrid: a fine wireframe grid that ripples where drops land, the rings spreading and settling, brighter where a wire is stretched, with thin bright ring pulses lighting the wire segments they cross. See src/runtime/kinetic-grid.js.
|
|
666
|
+
|
|
667
|
+
```astro
|
|
668
|
+
<section class="hero" style="position: relative">
|
|
669
|
+
<KineticGrid colors={['#c8ff00', '#ffffff']} background="#0b0b0b" quiet={{ x: 0.3, y: 0.5, radius: 0.6, depth: 0.85 }} />
|
|
670
|
+
<h1>…</h1>
|
|
671
|
+
</section>
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
| Prop | Type | |
|
|
675
|
+
|---|---|---|
|
|
676
|
+
| `colors` | `string[]` | Two CSS hex colours: the wires' and the pulses'. Default the sketch's blue and white. |
|
|
677
|
+
| `palette` | `PaletteName \| (string & {})` | A shared palette by name (`PALETTES`, any case), when there are no `colors`: its first colour for the wires, its glint for the pulses. |
|
|
678
|
+
| `background` | `string` | The ground, a CSS hex colour (opaque, so the canvas covers what is under it); `transparent` leaves it clear. Default '#0a0a0a'. |
|
|
679
|
+
| `cols` | `number` | Grid cells across, whatever the width (cells are square). Default 48. |
|
|
680
|
+
| `width` | `number` | A wire's width, CSS px. Default 1. |
|
|
681
|
+
| `rest` | `number` | How bright a wire at rest is, 0–1; stretched wires brighten to full. Default 0.35. |
|
|
682
|
+
| `drops` | `number` | Drops alive at once, 0–6 (each slot lands a new one about every five seconds). Default 4. |
|
|
683
|
+
| `strength` | `number` | How far the ripples push the wires, 0–1.6 (past that they fold). Default 1. |
|
|
684
|
+
| `size` | `number` | The ripples' scale: wavelength, reach and speed together, 0.5–2. Default 1. |
|
|
685
|
+
| `pulses` | `number` | Ring pulses alive at once, 0–4 (each slot about every two and a half seconds). Default 3. |
|
|
686
|
+
| `speed` | `number` | Plays the clock faster or slower; 0 for one still frame. Default 1. |
|
|
687
|
+
| `offset` | `number` | Seeds where and when drops land, so two cards differ. Default 0. |
|
|
688
|
+
| `quiet` | `{ x?: number; y?: number; radius?: number; depth?: number } \| null` | An area kept calm and dim: centre (0–1 from the top left), radius (share of the height), depth (0–1). |
|
|
689
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
690
|
+
| `class` | `string` | Classes for the element. |
|
|
691
|
+
|
|
563
692
|
## `<LightField>`
|
|
564
693
|
|
|
565
694
|
LightField: liquid light in three colours, bending around the pointer, with a real fluid under it that the pointer stirs and a click drops ink into. See src/runtime/light-field.js for how it is drawn.
|
|
@@ -585,6 +714,23 @@ LightField: liquid light in three colours, bending around the pointer, with a re
|
|
|
585
714
|
| `background` | `string` | The colour under the light, and under the fallback gradient. Default `#08080a`. |
|
|
586
715
|
| `class` | `string` | Classes for the element. |
|
|
587
716
|
|
|
717
|
+
## `<LightLeak>`
|
|
718
|
+
|
|
719
|
+
LightLeak: a soft, slow colour field, a lava lamp or a light leak: drifting fBm blobs under a gentle warp, mixed through four colours (darkest first) in Oklab, with a breath too slow to see as one. See src/runtime/light-leak.js.
|
|
720
|
+
|
|
721
|
+
```astro
|
|
722
|
+
<section class="hero" style="position: relative">
|
|
723
|
+
<LightLeak colors={['#0b0b0b', '#1a2a8c', '#0038ff', '#ff5c64']} quiet={{ radius: 0.5, depth: 0.8 }} />
|
|
724
|
+
<h1>…</h1>
|
|
725
|
+
</section>
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
| Prop | Type | |
|
|
729
|
+
|---|---|---|
|
|
730
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
731
|
+
| `lazy` | `boolean \| string` | Run only while near the screen (true, or a CSS length), giving its WebGL context back when away: for a wall of cards. Default false. |
|
|
732
|
+
| `class` | `string` | Classes for the element. |
|
|
733
|
+
|
|
588
734
|
## `<LiquidMetal>`
|
|
589
735
|
|
|
590
736
|
LiquidMetal: a logo or a word made of liquid chrome. At rest it is a polished slab of metal reflecting a slowly turning studio; the pointer dents it and sends ripples across it, a stroke parts it, a click splashes it (a crater, a ring wave, droplets that fall and crawl back), and surface tension pulls it back into shape with a last wobble. See src/runtime/liquid-metal.js.
|
|
@@ -897,24 +1043,31 @@ PixelFountain: retro 8-bit sparks. Chunky square pixels fire up out of the host'
|
|
|
897
1043
|
<PixelFountain cell={8} />
|
|
898
1044
|
…
|
|
899
1045
|
</footer>
|
|
1046
|
+
@example
|
|
1047
|
+
<div class="wordmark-wrap" style="position: relative; color: #0b0b0b">
|
|
1048
|
+
<PixelFountain source="pointer" cell={10} />
|
|
1049
|
+
<FitText as="div">Arcadia</FitText>
|
|
1050
|
+
</div>
|
|
900
1051
|
```
|
|
901
1052
|
|
|
902
1053
|
| Prop | Type | |
|
|
903
1054
|
|---|---|---|
|
|
904
|
-
| `color` | `string` | The pixels' colour when they fire; the darker steps they fade through are made from it. Default `#c8ff00
|
|
905
|
-
| `colors` | `string[]` | The steps a pixel fades through, first to last (overrides `color
|
|
1055
|
+
| `color` | `string` | The pixels' colour when they fire; the darker steps they fade through are made from it. With `source="pointer"`, the one ink every block is drawn in. Default `#c8ff00` (from the pointer, the text's colour, `currentColor`). |
|
|
1056
|
+
| `colors` | `string[]` | The steps a pixel fades through, first to last (overrides `color`; from the pointer, only the first is used). Default made from `color`. |
|
|
906
1057
|
| `palette` | `string` | A shared palette by name, its colours as the steps, when there are no `colors`. Default none. |
|
|
907
1058
|
| `cell` | `number` | A pixel's size, CSS px (a power-up's biggest blocks are two). Default 8. |
|
|
908
|
-
| `rise` | `number` | How far above the edge the pixels can fly, CSS px. Default 240. |
|
|
909
|
-
| `rate` | `number` | Pixels a second trickling up on their own, per 1,000 CSS px of edge; 0 for none. Default 14. |
|
|
910
|
-
| `burst` | `number` | Pixels a click or tap fires. Default 40. |
|
|
1059
|
+
| `rise` | `number` | How far above the edge the pixels can fly, CSS px (from the pointer: how far above the host the canvas reaches). Default 240 (160 from the pointer). |
|
|
1060
|
+
| `rate` | `number` | Pixels a second trickling up on their own, per 1,000 CSS px of edge; 0 for none (always none from the pointer). Default 14. |
|
|
1061
|
+
| `burst` | `number` | Pixels a click or tap fires. Default 40 (24 from the pointer). |
|
|
1062
|
+
| `trail` | `number` | From the pointer: blocks fired for every 100 CSS px it moves, at most 12 a move. Default 10. |
|
|
1063
|
+
| `press` | `boolean` | Whether a mouse click fires a burst (a tap always does). Default true (false from the pointer). |
|
|
911
1064
|
| `gravity` | `number` | How hard they are pulled back, 0–2. Default 1. |
|
|
912
1065
|
| `spread` | `number` | How widely they fan out, 0–1. Default 0.5. |
|
|
913
1066
|
| `drift` | `number` | How much a wind pushes them sideways, 0–1. Default 0.3. |
|
|
914
|
-
| `life` | `number` | The longest a pixel lives, seconds. Default 1.4. |
|
|
915
|
-
| `split` | `number` | The chance a pixel splits into smaller ones rather than shrinking, 0–1. Default 0.4. |
|
|
916
|
-
| `flicker` | `number` | The chance a pixel flickers out on and off before it goes, 0–1. Default 0.35. |
|
|
917
|
-
| `source` | `'edge' \| 'text'` | Fire from the host's top edge
|
|
1067
|
+
| `life` | `number` | The longest a pixel lives, seconds. Default 1.4 (0.9 from the pointer). |
|
|
1068
|
+
| `split` | `number` | The chance a pixel splits into smaller ones rather than shrinking, 0–1. Default 0.4 (0.2 from the pointer). |
|
|
1069
|
+
| `flicker` | `number` | The chance a pixel flickers out on and off before it goes, 0–1. Default 0.35 (0.5 from the pointer). |
|
|
1070
|
+
| `source` | `'edge' \| 'text' \| 'pointer'` | Fire from the host's top edge; from the filled pixels of its text; or only from the pointer, where it moves over the host (a block-dust trail in one ink, nothing on its own). Default `edge`. |
|
|
918
1071
|
| `host` | `string` | A selector for the element the pixels fire from and the pointer is followed over: the nearest ancestor that matches, else the first on the page. Default the element's positioned parent. |
|
|
919
1072
|
| `seed` | `number` | Seeds the randomness. Default 1. |
|
|
920
1073
|
| `zIndex` | `number` | The canvas's `z-index`, over what is above the host. Default none (auto). |
|
|
@@ -923,7 +1076,7 @@ PixelFountain: retro 8-bit sparks. Chunky square pixels fire up out of the host'
|
|
|
923
1076
|
|
|
924
1077
|
## `<PixelGlitchText>`
|
|
925
1078
|
|
|
926
|
-
PixelGlitchText: one line of text that breaks into pixels under the pointer and knits back together behind it. With `stroke`, a hollow outline at rest that the pixels fill in; `tear="row"` tears whole rows, and `ghost` lays a coloured copy behind the blocks. See src/runtime/pixel-glitch.js.
|
|
1079
|
+
PixelGlitchText: one line of text that breaks into pixels under the pointer and knits back together behind it. With `stroke`, a hollow outline at rest that the pixels fill in; `tear="row"` tears whole rows, and `ghost` lays a coloured copy behind the blocks; `glitch={false}` keeps only the drawing at rest (a still outlined wordmark). See src/runtime/pixel-glitch.js.
|
|
927
1080
|
|
|
928
1081
|
```astro
|
|
929
1082
|
<footer>
|
|
@@ -941,10 +1094,28 @@ PixelGlitchText: one line of text that breaks into pixels under the pointer and
|
|
|
941
1094
|
| `stroke` | `number` | With a width (CSS px), the text at rest is an outline that the pixels fill: one outline round the word, so overlapping letters merge. Default 0 (solid). |
|
|
942
1095
|
| `tear` | `'cell' \| 'row'` | What slips: `cell`, each hot cell on its own; `row`, a whole row at once, now and then, by its hottest cell (up to half of `shift` either way). Default `cell`. |
|
|
943
1096
|
| `ghost` | `string` | A colour for a copy of the blocks, nudged 3px right behind them (an accent under the break). Default none. |
|
|
1097
|
+
| `glitch` | `boolean` | Break into pixels under the pointer. False only draws the text at rest (with `stroke`, its merged outline), everywhere, with reduced motion and on touch screens too: the same look, the pointer left to something else. Default true. |
|
|
944
1098
|
| `as` | `HTMLTag` | The element to render. Default `span`. |
|
|
945
1099
|
| `fit` | `boolean` | Size the text to span its parent's width. Default false. |
|
|
946
1100
|
| `class` | `string` | Classes for the element. |
|
|
947
1101
|
|
|
1102
|
+
## `<PixelHorizon>`
|
|
1103
|
+
|
|
1104
|
+
PixelHorizon: a flat colour filling one side and breaking up into square blocks toward the other, blocks winking on and off along a slowly swaying frontier. See src/runtime/pixel-horizon.js.
|
|
1105
|
+
|
|
1106
|
+
```astro
|
|
1107
|
+
<section class="hero" style="position: relative; background: #0b0b0b">
|
|
1108
|
+
<PixelHorizon background="#0b0b0b" colors={['#1aff00']} side="bottom" quiet={{ radius: 0.42, depth: 1 }} />
|
|
1109
|
+
<h1>…</h1>
|
|
1110
|
+
</section>
|
|
1111
|
+
```
|
|
1112
|
+
|
|
1113
|
+
| Prop | Type | |
|
|
1114
|
+
|---|---|---|
|
|
1115
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
1116
|
+
| `lazy` | `boolean \| string` | Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away: for pages with many effects. Default false. |
|
|
1117
|
+
| `class` | `string` | Classes for the element. |
|
|
1118
|
+
|
|
948
1119
|
## `<PointCloud>`
|
|
949
1120
|
|
|
950
1121
|
PointCloud: a word drawn as a matrix of bright dots among rippling sheets of point cloud, the scene tilting towards the pointer. With `trackers`, boxes lock onto the word like a detector's debug view. See src/runtime/point-cloud.js.
|
|
@@ -1308,6 +1479,23 @@ Topography: a survey map that never sits still. The contour lines of a slowly dr
|
|
|
1308
1479
|
| `fixed` | `boolean` | Fill the viewport, behind the page (position: fixed, z-index -1). Default false. |
|
|
1309
1480
|
| `class` | `string` | Classes for the element. |
|
|
1310
1481
|
|
|
1482
|
+
## `<TruchetField>`
|
|
1483
|
+
|
|
1484
|
+
TruchetField: a field of Truchet tiles, quarter arcs that join into loops and S-bends, a few tiles turning at a time, bright patches drifting through. See src/runtime/truchet-field.js.
|
|
1485
|
+
|
|
1486
|
+
```astro
|
|
1487
|
+
<section class="hero" style="position: relative; background: #0b0b0b">
|
|
1488
|
+
<TruchetField background="#0b0b0b" colors={['#3a3a3a', '#f4f3ef']} quiet={{ radius: 0.5, depth: 0.9 }} />
|
|
1489
|
+
<h1>…</h1>
|
|
1490
|
+
</section>
|
|
1491
|
+
```
|
|
1492
|
+
|
|
1493
|
+
| Prop | Type | |
|
|
1494
|
+
|---|---|---|
|
|
1495
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
1496
|
+
| `lazy` | `boolean \| string` | Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away: for pages with many effects. Default false. |
|
|
1497
|
+
| `class` | `string` | Classes for the element. |
|
|
1498
|
+
|
|
1311
1499
|
## `<Typewriter>`
|
|
1312
1500
|
|
|
1313
1501
|
Typewriter: types phrases one after another behind a blinking caret, deleting each before the next. "Sell beats / sample packs / presets." Screen readers get the phrases as a list once, not a stream of letters; with reduced motion the first phrase simply shows. See src/runtime/text-motion.js.
|
|
@@ -1344,6 +1532,22 @@ VariableType: a headline in a variable font whose letters swell under the pointe
|
|
|
1344
1532
|
| `as` | `HTMLTag` | The element to render. Default `div`. |
|
|
1345
1533
|
| `class` | `string` | Classes for the element. |
|
|
1346
1534
|
|
|
1535
|
+
## `<VoronoiMesh>`
|
|
1536
|
+
|
|
1537
|
+
VoronoiMesh: a Voronoi mesh in thin lines on a ground, in two nested tiers: macro cells whose seeds orbit slowly, and inner cells inside each that pulse outward from its seed. Pale lines on deep maroon by default. See src/runtime/voronoi-mesh.js.
|
|
1538
|
+
|
|
1539
|
+
```astro
|
|
1540
|
+
<section class="hero" style="position: relative">
|
|
1541
|
+
<VoronoiMesh cells={8} quiet={{ x: 0.3, y: 0.5, radius: 0.7, depth: 0.8 }} />
|
|
1542
|
+
<h1>…</h1>
|
|
1543
|
+
</section>
|
|
1544
|
+
```
|
|
1545
|
+
|
|
1546
|
+
| Prop | Type | |
|
|
1547
|
+
|---|---|---|
|
|
1548
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
1549
|
+
| `class` | `string` | Classes for the element. |
|
|
1550
|
+
|
|
1347
1551
|
## `<VoxelLogo>`
|
|
1348
1552
|
|
|
1349
1553
|
VoxelLogo: a logo or character built of cubes, rocking slowly in perspective and turning towards the pointer, outlined where cubes meet and dithered down to two inks. With `markers`, tracking markers ring it. See src/runtime/voxel-logo.js.
|
package/LICENSE
CHANGED
|
@@ -78,8 +78,8 @@ SOFTWARE.
|
|
|
78
78
|
|
|
79
79
|
---
|
|
80
80
|
|
|
81
|
-
The hashes in src/runtime/shader-backgrounds/grain-gradient.js
|
|
82
|
-
src/runtime/
|
|
81
|
+
The hashes in src/runtime/shader-backgrounds/grain-gradient.js,
|
|
82
|
+
src/runtime/hash-noise.js and src/runtime/light-leak.js are Dave Hoskins' "Hash without Sine" (https://www.shadertoy.com/view/4djSRW):
|
|
83
83
|
|
|
84
84
|
Copyright (c) 2014 David Hoskins
|
|
85
85
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arraypress/effects-astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "GPU effects for Astro sites, as components: liquid light with a real fluid under it, ink in water, and outline text a spotlight fills. Plain WebGL, no third-party dependencies, with the fallbacks a theme needs (reduced motion, no WebGL, touch screens, off-screen pausing).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* CascadeGrid: a grid of hexagons or dots that behaves like a scrolling
|
|
4
|
+
* spectrogram, each column showing the same made-up spectrum a little
|
|
5
|
+
* later than the last, so waves cascade across it and the cells swell
|
|
6
|
+
* from idle specks to reactive shapes. See src/runtime/cascade-grid.js.
|
|
7
|
+
*
|
|
8
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`.
|
|
9
|
+
* Clear between the cells (or `background`), so it lays over any ground.
|
|
10
|
+
* Without WebGL it shows the grid at rest when it can (a `pitch` and a
|
|
11
|
+
* `background`), else the `background` colour.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <section class="hero" style="position: relative; background: #0b0b0b">
|
|
15
|
+
* <CascadeGrid colors={['#2a2a2a', '#c8ff00']} background="#0b0b0b" quiet={{ radius: 0.5, depth: 0.95 }} />
|
|
16
|
+
* <h1>…</h1>
|
|
17
|
+
* </section>
|
|
18
|
+
*/
|
|
19
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
20
|
+
import { cascadeStill, type CascadeGridConfig } from '../runtime/cascade-grid.js';
|
|
21
|
+
|
|
22
|
+
interface Props extends CascadeGridConfig {
|
|
23
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
24
|
+
fixed?: boolean;
|
|
25
|
+
/** Run only while near the screen, giving its WebGL context back when away: for pages with many effects. Default false. */
|
|
26
|
+
lazy?: boolean | string;
|
|
27
|
+
class?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
31
|
+
const still = config.background ? cascadeStill(config) : undefined;
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<EffectCanvas name="cascade-grid" config={config} fixed={fixed} lazy={lazy} background={still} class={className} />
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import { mount } from '../runtime/mount.js';
|
|
38
|
+
import { cascadeGrid } from '../runtime/cascade-grid.js';
|
|
39
|
+
|
|
40
|
+
mount('[data-effect-cascade-grid]', cascadeGrid);
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* DitherField: a field of slow noise drawn in square dots, Bayer-dithered
|
|
4
|
+
* at its edges into a solid, colour-banded core, with ripples running out
|
|
5
|
+
* from a corner, bent into shore-wave shapes. See
|
|
6
|
+
* src/runtime/dither-field.js.
|
|
7
|
+
*
|
|
8
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`.
|
|
9
|
+
* Clear where there are no dots (or `background`), so it lays over any
|
|
10
|
+
* ground; with a `background`, the element shows a still of the field
|
|
11
|
+
* until the shader starts and without WebGL.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <section class="hero" style="position: relative; background: #0b0b0b">
|
|
15
|
+
* <DitherField background="#0b0b0b" colors={['#3d4d0a', '#c8ff00']} quiet={{ x: 0.3, y: 0.5, radius: 0.6, depth: 1 }} />
|
|
16
|
+
* <h1>…</h1>
|
|
17
|
+
* </section>
|
|
18
|
+
*/
|
|
19
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
20
|
+
import { ditherStill, type DitherFieldConfig } from '../runtime/dither-field.js';
|
|
21
|
+
|
|
22
|
+
interface Props extends DitherFieldConfig {
|
|
23
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
24
|
+
fixed?: boolean;
|
|
25
|
+
/** Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away: for pages with many effects. Default false. */
|
|
26
|
+
lazy?: boolean | string;
|
|
27
|
+
class?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
31
|
+
const still = config.background ? ditherStill(config) : undefined;
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<EffectCanvas name="dither-field" config={config} fixed={fixed} lazy={lazy} background={still} pixelated class={className} />
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import { mount } from '../runtime/mount.js';
|
|
38
|
+
import { ditherField } from '../runtime/dither-field.js';
|
|
39
|
+
|
|
40
|
+
mount('[data-effect-dither-field]', ditherField);
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* DitherGradient: a soft colour gradient drawn only in dots: a wavy
|
|
4
|
+
* horizon, a glowing band, a swirl, a pinwheel or stepped columns, square
|
|
5
|
+
* dots an ordered dither thins out or round halftone dots that shrink. See
|
|
6
|
+
* src/runtime/dither-gradient.js.
|
|
7
|
+
*
|
|
8
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`.
|
|
9
|
+
* Clear where there is nothing drawn, so it lays over any ground; with a
|
|
10
|
+
* `background`, the element shows a CSS still until the shader starts and
|
|
11
|
+
* without WebGL.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <section class="hero" style="position: relative; background: #0b0b0b">
|
|
15
|
+
* <DitherGradient background="#081226" colors={['#5a0f4a', '#ff1f8f']} shape="wave" quiet={{ radius: 0.5, depth: 1 }} />
|
|
16
|
+
* <h1>…</h1>
|
|
17
|
+
* </section>
|
|
18
|
+
*/
|
|
19
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
20
|
+
import { gradientStill, type DitherGradientConfig } from '../runtime/dither-gradient.js';
|
|
21
|
+
|
|
22
|
+
interface Props extends DitherGradientConfig {
|
|
23
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
24
|
+
fixed?: boolean;
|
|
25
|
+
/** Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away: for pages with many effects. Default false. */
|
|
26
|
+
lazy?: boolean | string;
|
|
27
|
+
class?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
31
|
+
const still = config.background ? gradientStill(config) : undefined;
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<EffectCanvas name="dither-gradient" config={config} fixed={fixed} lazy={lazy} background={still} class={className} />
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import { mount } from '../runtime/mount.js';
|
|
38
|
+
import { ditherGradient } from '../runtime/dither-gradient.js';
|
|
39
|
+
|
|
40
|
+
mount('[data-effect-dither-gradient]', ditherGradient);
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* FlowField: hundreds of short, fine trails riding a slowly evolving
|
|
4
|
+
* noise flow, born, gathering into streams and fading, white on black by
|
|
5
|
+
* default; how many there are, how fast they go and how heavy the lines
|
|
6
|
+
* are drift slowly. See src/runtime/flow-field.js.
|
|
7
|
+
*
|
|
8
|
+
* Opaque: it fills its `background` every frame, so it is the whole
|
|
9
|
+
* background of what it fills (its nearest positioned ancestor, or the
|
|
10
|
+
* viewport with `fixed`). Canvas 2D, so it needs no WebGL; one settled
|
|
11
|
+
* still frame with reduced motion. `setColors` recolours it live.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <section class="hero" style="position: relative">
|
|
15
|
+
* <FlowField colors={['#c8ff00', '#39ff88']} background="#0b0b0b" quiet={{ radius: 0.5, depth: 0.85 }} />
|
|
16
|
+
* <h1>…</h1>
|
|
17
|
+
* </section>
|
|
18
|
+
*/
|
|
19
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
20
|
+
import type { FlowFieldConfig } from '../runtime/flow-field.js';
|
|
21
|
+
|
|
22
|
+
interface Props extends FlowFieldConfig {
|
|
23
|
+
/** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
|
|
24
|
+
fixed?: boolean;
|
|
25
|
+
class?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { fixed = false, class: className, ...config } = Astro.props;
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<EffectCanvas name="flow-field" config={config} fixed={fixed} class={className} behind background={config.background ?? '#000000'} />
|
|
32
|
+
|
|
33
|
+
<script>
|
|
34
|
+
import { mount } from '../runtime/mount.js';
|
|
35
|
+
import { flowField } from '../runtime/flow-field.js';
|
|
36
|
+
|
|
37
|
+
mount('[data-effect-flow-field]', flowField);
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* FlutedGlow: a soft ring, orb or rising light seen through upright reeded
|
|
4
|
+
* glass, breathing slowly, made to sit behind copy (no pointer). See
|
|
5
|
+
* src/runtime/fluted-glow.js.
|
|
6
|
+
*
|
|
7
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`.
|
|
8
|
+
* Opaque: it paints its `background` (default near-black) everywhere; the
|
|
9
|
+
* element shows a CSS still of it until the shader starts and without WebGL.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <section class="hero" style="position: relative; background: #0b0b0b">
|
|
13
|
+
* <FlutedGlow colors={['#7a1d00', '#ff7a00', '#ffd27a']} shape="ring" />
|
|
14
|
+
* <h1>…</h1>
|
|
15
|
+
* </section>
|
|
16
|
+
*/
|
|
17
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
18
|
+
import { glowStill, type FlutedGlowConfig } from '../runtime/fluted-glow.js';
|
|
19
|
+
|
|
20
|
+
interface Props extends FlutedGlowConfig {
|
|
21
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
22
|
+
fixed?: boolean;
|
|
23
|
+
/** Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away: for pages with many effects. Default false. */
|
|
24
|
+
lazy?: boolean | string;
|
|
25
|
+
class?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
29
|
+
const still = glowStill(config);
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
<EffectCanvas name="fluted-glow" config={config} fixed={fixed} lazy={lazy} background={still} class={className} />
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import { mount } from '../runtime/mount.js';
|
|
36
|
+
import { flutedGlow } from '../runtime/fluted-glow.js';
|
|
37
|
+
|
|
38
|
+
mount('[data-effect-fluted-glow]', flutedGlow);
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* KineticGrid: a fine wireframe grid that ripples where drops land, the
|
|
4
|
+
* rings spreading and settling, brighter where a wire is stretched, with
|
|
5
|
+
* thin bright ring pulses lighting the wire segments they cross. See
|
|
6
|
+
* src/runtime/kinetic-grid.js.
|
|
7
|
+
*
|
|
8
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`.
|
|
9
|
+
* Paints its own ground (`background`; `transparent` lays it over the
|
|
10
|
+
* section's). Without WebGL the ground shows.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <section class="hero" style="position: relative">
|
|
14
|
+
* <KineticGrid colors={['#c8ff00', '#ffffff']} background="#0b0b0b" quiet={{ x: 0.3, y: 0.5, radius: 0.6, depth: 0.85 }} />
|
|
15
|
+
* <h1>…</h1>
|
|
16
|
+
* </section>
|
|
17
|
+
*/
|
|
18
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
19
|
+
import type { KineticGridConfig } from '../runtime/kinetic-grid.js';
|
|
20
|
+
|
|
21
|
+
interface Props extends KineticGridConfig {
|
|
22
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
23
|
+
fixed?: boolean;
|
|
24
|
+
class?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { fixed = false, class: className, ...config } = Astro.props;
|
|
28
|
+
const ground = config.background ?? '#0a0a0a';
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<EffectCanvas name="kinetic-grid" config={config} fixed={fixed} class={className} background={ground === 'transparent' ? undefined : ground} />
|
|
32
|
+
|
|
33
|
+
<script>
|
|
34
|
+
import { mount } from '../runtime/mount.js';
|
|
35
|
+
import { kineticGrid } from '../runtime/kinetic-grid.js';
|
|
36
|
+
|
|
37
|
+
mount('[data-effect-kinetic-grid]', kineticGrid);
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* LightLeak: a soft, slow colour field, a lava lamp or a light leak:
|
|
4
|
+
* drifting fBm blobs under a gentle warp, mixed through four colours
|
|
5
|
+
* (darkest first) in Oklab, with a breath too slow to see as one. See
|
|
6
|
+
* src/runtime/light-leak.js.
|
|
7
|
+
*
|
|
8
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`.
|
|
9
|
+
* Opaque. Shows a still of its first frame (`lightLeakStill`) before the
|
|
10
|
+
* shader starts and without WebGL.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <section class="hero" style="position: relative">
|
|
14
|
+
* <LightLeak colors={['#0b0b0b', '#1a2a8c', '#0038ff', '#ff5c64']} quiet={{ radius: 0.5, depth: 0.8 }} />
|
|
15
|
+
* <h1>…</h1>
|
|
16
|
+
* </section>
|
|
17
|
+
*/
|
|
18
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
19
|
+
import { lightLeakStill, type LightLeakConfig } from '../runtime/light-leak.js';
|
|
20
|
+
|
|
21
|
+
interface Props extends LightLeakConfig {
|
|
22
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
23
|
+
fixed?: boolean;
|
|
24
|
+
/** Run only while near the screen (true, or a CSS length), giving its WebGL context back when away: for a wall of cards. Default false. */
|
|
25
|
+
lazy?: boolean | string;
|
|
26
|
+
class?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
<EffectCanvas name="light-leak" config={config} fixed={fixed} lazy={lazy} background={lightLeakStill(config, 16 / 9)} class={className} />
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import { mount } from '../runtime/mount.js';
|
|
36
|
+
import { lightLeak } from '../runtime/light-leak.js';
|
|
37
|
+
|
|
38
|
+
mount('[data-effect-light-leak]', lightLeak);
|
|
39
|
+
</script>
|