@arraypress/effects-astro 0.13.0 → 0.15.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/COMPONENTS.md +101 -0
- package/package.json +1 -1
- package/src/components/FluidFolds.astro +40 -0
- package/src/components/FlutedBokeh.astro +40 -0
- package/src/components/LensFlare.astro +38 -0
- package/src/components/PaintDrip.astro +40 -0
- package/src/components/PhotoBokeh.astro +40 -0
- package/src/components/SunWall.astro +37 -0
- package/src/index.d.ts +13 -0
- package/src/index.js +7 -0
- package/src/runtime/dither-gradient.d.ts +9 -3
- package/src/runtime/dither-gradient.js +55 -12
- package/src/runtime/fluid-folds.d.ts +58 -0
- package/src/runtime/fluid-folds.js +317 -0
- package/src/runtime/fluted-bokeh.d.ts +70 -0
- package/src/runtime/fluted-bokeh.js +355 -0
- package/src/runtime/glass-drop.d.ts +14 -0
- package/src/runtime/glass-drop.js +116 -6
- package/src/runtime/glass-plates.d.ts +63 -0
- package/src/runtime/glass-plates.js +327 -0
- package/src/runtime/glass-stack.d.ts +10 -0
- package/src/runtime/glass-stack.js +71 -3
- package/src/runtime/lens-flare.d.ts +45 -0
- package/src/runtime/lens-flare.js +283 -0
- package/src/runtime/paint-drip.d.ts +89 -0
- package/src/runtime/paint-drip.js +611 -0
- package/src/runtime/photo-bokeh.d.ts +57 -0
- package/src/runtime/photo-bokeh.js +351 -0
- package/src/runtime/shared-gl.d.ts +25 -0
- package/src/runtime/shared-gl.js +229 -0
- package/src/runtime/stage.js +18 -6
- package/src/runtime/sun-wall.d.ts +52 -0
- package/src/runtime/sun-wall.js +309 -0
package/COMPONENTS.md
CHANGED
|
@@ -317,6 +317,40 @@ FlowField: hundreds of short, fine trails riding a slowly evolving noise flow, b
|
|
|
317
317
|
| `fixed` | `boolean` | Fill the viewport, behind the page (position: fixed, z-index -1). Default false. |
|
|
318
318
|
| `class` | `string` | Classes for the element. |
|
|
319
319
|
|
|
320
|
+
## `<FluidFolds>`
|
|
321
|
+
|
|
322
|
+
FluidFolds: glossy folds of liquid colour on a dark ground, warped by slow noise and lit from one side, the colour drifting along a ramp of three; poured enamel (`style="liquid"`) or long silk dunes (`style="dunes"`). No pointer, made to sit behind copy. See src/runtime/fluid-folds.js.
|
|
323
|
+
|
|
324
|
+
```astro
|
|
325
|
+
<section class="hero" style="position: relative; background: #050409">
|
|
326
|
+
<FluidFolds colors={['#1638ff', '#7b2cff', '#ff4a3d']} style="liquid" />
|
|
327
|
+
<h1>…</h1>
|
|
328
|
+
</section>
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
| Prop | Type | |
|
|
332
|
+
|---|---|---|
|
|
333
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
334
|
+
| `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. |
|
|
335
|
+
| `class` | `string` | Classes for the element. |
|
|
336
|
+
|
|
337
|
+
## `<FlutedBokeh>`
|
|
338
|
+
|
|
339
|
+
FlutedBokeh: coloured lights out of focus behind reeded glass (upright flutes with a thin rainbow at each seam) or a wall of glass blocks, the lights drifting slowly. No pointer, made to sit behind copy. See src/runtime/fluted-bokeh.js.
|
|
340
|
+
|
|
341
|
+
```astro
|
|
342
|
+
<section class="hero" style="position: relative; background: #050608">
|
|
343
|
+
<FlutedBokeh colors={['#ff4a2a', '#ffb347', '#4fc3ff']} mode="reeds" />
|
|
344
|
+
<h1>…</h1>
|
|
345
|
+
</section>
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
| Prop | Type | |
|
|
349
|
+
|---|---|---|
|
|
350
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
351
|
+
| `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. |
|
|
352
|
+
| `class` | `string` | Classes for the element. |
|
|
353
|
+
|
|
320
354
|
## `<FlutedGlass>`
|
|
321
355
|
|
|
322
356
|
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.
|
|
@@ -778,6 +812,23 @@ KineticGrid: a fine wireframe grid that ripples where drops land, the rings spre
|
|
|
778
812
|
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
779
813
|
| `class` | `string` | Classes for the element. |
|
|
780
814
|
|
|
815
|
+
## `<LensFlare>`
|
|
816
|
+
|
|
817
|
+
LensFlare: an anamorphic lens flare, built as the lens makes one: a hot source, its long thin horizontal streak, a veil of scattered light, and soft ghosts on the line through the frame's centre, drifting slowly. See src/runtime/lens-flare.js.
|
|
818
|
+
|
|
819
|
+
```astro
|
|
820
|
+
<section class="hero" style="position: relative; background: #030406">
|
|
821
|
+
<LensFlare source={[0.22, 0.3]} streak="#4f8dff" />
|
|
822
|
+
<h1>…</h1>
|
|
823
|
+
</section>
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
| Prop | Type | |
|
|
827
|
+
|---|---|---|
|
|
828
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
829
|
+
| `lazy` | `boolean \| string` | Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away. Default false. |
|
|
830
|
+
| `class` | `string` | Classes for the element. |
|
|
831
|
+
|
|
781
832
|
## `<LightField>`
|
|
782
833
|
|
|
783
834
|
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.
|
|
@@ -1050,6 +1101,22 @@ OutlineWordmark: a name at enormous scale, drawn as one outline, cropped so it s
|
|
|
1050
1101
|
| `weight` | `number \| string` | CSS font-weight. Default 700. |
|
|
1051
1102
|
| `class` | `string` | Classes for the element. |
|
|
1052
1103
|
|
|
1104
|
+
## `<PaintDrip>`
|
|
1105
|
+
|
|
1106
|
+
PaintDrip: a mark sprayed in paint, the paint running. Wet paint pools along the mark's lower edges, drips break away where a pool grows past what surface tension holds, run down under gravity against the paint's viscosity (a bead at the head, the body thinning as paint is laid behind), slow, stop and dry; they hold, fade, and run again. See src/runtime/paint-drip.js.
|
|
1107
|
+
|
|
1108
|
+
```astro
|
|
1109
|
+
<section class="hero" style="position: relative">
|
|
1110
|
+
<PaintDrip src="/logo-white.svg" color="#C8FF00" />
|
|
1111
|
+
</section>
|
|
1112
|
+
```
|
|
1113
|
+
|
|
1114
|
+
| Prop | Type | |
|
|
1115
|
+
|---|---|---|
|
|
1116
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
1117
|
+
| `lazy` | `boolean \| string` | Run only while near the screen (true, or how near as a CSS length). Default false. |
|
|
1118
|
+
| `class` | `string` | Classes for the element. |
|
|
1119
|
+
|
|
1053
1120
|
## `<PaperShader>`
|
|
1054
1121
|
|
|
1055
1122
|
PaperShader: any of the thirty Paper Shaders (mesh and grain gradients, god rays, liquid metal, water, warp, dithering, halftones, metaballs, voronoi, smoke rings and more), with Paper's own presets, and no React. See src/runtime/paper.js; the shaders are vendored from Paper (Apache-2.0).
|
|
@@ -1123,6 +1190,23 @@ ParticleLogo: a logo or a word in thousands of twinkling particles that scatter
|
|
|
1123
1190
|
| `fixed` | `boolean` | Fill the viewport, behind the page (position: fixed, z-index -1). Default false. |
|
|
1124
1191
|
| `class` | `string` | Classes for the element. |
|
|
1125
1192
|
|
|
1193
|
+
## `<PhotoBokeh>`
|
|
1194
|
+
|
|
1195
|
+
PhotoBokeh: a photo seen through a lens racking its focus, the plane of focus sweeping slowly near to far and back (a depth guessed from the picture itself), soft out-of-focus lights tinted from its highlights drifting up through it. No pointer, made to sit behind copy. See src/runtime/photo-bokeh.js.
|
|
1196
|
+
|
|
1197
|
+
```astro
|
|
1198
|
+
<section class="hero" style="position: relative">
|
|
1199
|
+
<PhotoBokeh src="/img/dahlias.webp" shape="blades" />
|
|
1200
|
+
<h1>…</h1>
|
|
1201
|
+
</section>
|
|
1202
|
+
```
|
|
1203
|
+
|
|
1204
|
+
| Prop | Type | |
|
|
1205
|
+
|---|---|---|
|
|
1206
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
1207
|
+
| `lazy` | `boolean \| string` | Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away. Default false. |
|
|
1208
|
+
| `class` | `string` | Classes for the element. |
|
|
1209
|
+
|
|
1126
1210
|
## `<PixelFountain>`
|
|
1127
1211
|
|
|
1128
1212
|
PixelFountain: retro 8-bit sparks. Chunky square pixels fire up out of the host's top edge (a footer) or, with `source="text"`, out of the letters of its wordmark, arc under gravity and break down as they go: through a short ramp of colours, shrinking in whole-pixel steps or splitting into pieces that scatter, some flickering out like a dying CRT pixel. A few trickle up on their own; the pointer moving over the host fires a stream, a click or tap a power-up. See src/runtime/pixel-fountain.js.
|
|
@@ -1522,6 +1606,23 @@ SpotlightText: one line of text as a faint outline that a light under the pointe
|
|
|
1522
1606
|
| `fit` | `boolean` | Size the text to span its parent's width. Default false. |
|
|
1523
1607
|
| `class` | `string` | Classes for the element. |
|
|
1524
1608
|
|
|
1609
|
+
## `<SunWall>`
|
|
1610
|
+
|
|
1611
|
+
SunWall: low sunlight on a plaster wall, through venetian blinds (hard bars whose penumbra grows with the throw) or with a prism's spectrum beside a patch of sun, creeping slowly. See src/runtime/sun-wall.js.
|
|
1612
|
+
|
|
1613
|
+
```astro
|
|
1614
|
+
<section class="hero" style="position: relative">
|
|
1615
|
+
<SunWall mode="blinds" wall="#d8c3a5" />
|
|
1616
|
+
<h1>…</h1>
|
|
1617
|
+
</section>
|
|
1618
|
+
```
|
|
1619
|
+
|
|
1620
|
+
| Prop | Type | |
|
|
1621
|
+
|---|---|---|
|
|
1622
|
+
| `fixed` | `boolean` | Fill the viewport (position: fixed). Default false. |
|
|
1623
|
+
| `lazy` | `boolean \| string` | Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away. Default false. |
|
|
1624
|
+
| `class` | `string` | Classes for the element. |
|
|
1625
|
+
|
|
1525
1626
|
## `<Tilt>`
|
|
1526
1627
|
|
|
1527
1628
|
Tilt: a card, an image or an object that leans towards the pointer in perspective while it is over it, with a soft glare that follows, and settles back when it leaves. See src/runtime/tilt.js.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arraypress/effects-astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* FluidFolds: glossy folds of liquid colour on a dark ground, warped by slow
|
|
4
|
+
* noise and lit from one side, the colour drifting along a ramp of three;
|
|
5
|
+
* poured enamel (`style="liquid"`) or long silk dunes (`style="dunes"`). No
|
|
6
|
+
* pointer, made to sit behind copy. See src/runtime/fluid-folds.js.
|
|
7
|
+
*
|
|
8
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`.
|
|
9
|
+
* Opaque: it paints its `background` (default near-black) everywhere; the
|
|
10
|
+
* element shows a CSS still of it until the shader starts and without WebGL.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <section class="hero" style="position: relative; background: #050409">
|
|
14
|
+
* <FluidFolds colors={['#1638ff', '#7b2cff', '#ff4a3d']} style="liquid" />
|
|
15
|
+
* <h1>…</h1>
|
|
16
|
+
* </section>
|
|
17
|
+
*/
|
|
18
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
19
|
+
import { foldsStill, type FluidFoldsConfig } from '../runtime/fluid-folds.js';
|
|
20
|
+
|
|
21
|
+
interface Props extends FluidFoldsConfig {
|
|
22
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
23
|
+
fixed?: boolean;
|
|
24
|
+
/** 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. */
|
|
25
|
+
lazy?: boolean | string;
|
|
26
|
+
class?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
30
|
+
const still = foldsStill(config);
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<EffectCanvas name="fluid-folds" config={config} fixed={fixed} lazy={lazy} background={still} class={className} />
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import { mount } from '../runtime/mount.js';
|
|
37
|
+
import { fluidFolds } from '../runtime/fluid-folds.js';
|
|
38
|
+
|
|
39
|
+
mount('[data-effect-fluid-folds]', fluidFolds);
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* FlutedBokeh: coloured lights out of focus behind reeded glass (upright
|
|
4
|
+
* flutes with a thin rainbow at each seam) or a wall of glass blocks, the
|
|
5
|
+
* lights drifting slowly. No pointer, made to sit behind copy. See
|
|
6
|
+
* src/runtime/fluted-bokeh.js.
|
|
7
|
+
*
|
|
8
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`.
|
|
9
|
+
* Opaque: it paints its `background` (default near-black) everywhere; the
|
|
10
|
+
* element shows a CSS still of it until the shader starts and without WebGL.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <section class="hero" style="position: relative; background: #050608">
|
|
14
|
+
* <FlutedBokeh colors={['#ff4a2a', '#ffb347', '#4fc3ff']} mode="reeds" />
|
|
15
|
+
* <h1>…</h1>
|
|
16
|
+
* </section>
|
|
17
|
+
*/
|
|
18
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
19
|
+
import { bokehStill, type FlutedBokehConfig } from '../runtime/fluted-bokeh.js';
|
|
20
|
+
|
|
21
|
+
interface Props extends FlutedBokehConfig {
|
|
22
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
23
|
+
fixed?: boolean;
|
|
24
|
+
/** 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. */
|
|
25
|
+
lazy?: boolean | string;
|
|
26
|
+
class?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
30
|
+
const still = bokehStill(config);
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<EffectCanvas name="fluted-bokeh" config={config} fixed={fixed} lazy={lazy} background={still} class={className} />
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import { mount } from '../runtime/mount.js';
|
|
37
|
+
import { flutedBokeh } from '../runtime/fluted-bokeh.js';
|
|
38
|
+
|
|
39
|
+
mount('[data-effect-fluted-bokeh]', flutedBokeh);
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* LensFlare: an anamorphic lens flare, built as the lens makes one: a hot source, its long thin horizontal streak, a
|
|
4
|
+
* veil of scattered light, and soft ghosts on the line through the frame's centre, drifting slowly. See
|
|
5
|
+
* src/runtime/lens-flare.js.
|
|
6
|
+
*
|
|
7
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`. Opaque: it paints its `background` everywhere;
|
|
8
|
+
* the element shows a CSS still of it until the shader starts and without WebGL.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <section class="hero" style="position: relative; background: #030406">
|
|
12
|
+
* <LensFlare source={[0.22, 0.3]} streak="#4f8dff" />
|
|
13
|
+
* <h1>…</h1>
|
|
14
|
+
* </section>
|
|
15
|
+
*/
|
|
16
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
17
|
+
import { flareStill, type LensFlareConfig } from '../runtime/lens-flare.js';
|
|
18
|
+
|
|
19
|
+
interface Props extends LensFlareConfig {
|
|
20
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
21
|
+
fixed?: boolean;
|
|
22
|
+
/** Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away. Default false. */
|
|
23
|
+
lazy?: boolean | string;
|
|
24
|
+
class?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
28
|
+
const still = flareStill(config);
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<EffectCanvas name="lens-flare" config={config} fixed={fixed} lazy={lazy} background={still} class={className} />
|
|
32
|
+
|
|
33
|
+
<script>
|
|
34
|
+
import { mount } from '../runtime/mount.js';
|
|
35
|
+
import { lensFlare } from '../runtime/lens-flare.js';
|
|
36
|
+
|
|
37
|
+
mount('[data-effect-lens-flare]', lensFlare);
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* PaintDrip: a mark sprayed in paint, the paint running. Wet paint pools
|
|
4
|
+
* along the mark's lower edges, drips break away where a pool grows past what
|
|
5
|
+
* surface tension holds, run down under gravity against the paint's viscosity
|
|
6
|
+
* (a bead at the head, the body thinning as paint is laid behind), slow, stop
|
|
7
|
+
* and dry; they hold, fade, and run again. See src/runtime/paint-drip.js.
|
|
8
|
+
*
|
|
9
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`.
|
|
10
|
+
* Opaque: it paints its `background` everywhere; the element shows a CSS still
|
|
11
|
+
* of the ground until the canvas draws.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <section class="hero" style="position: relative">
|
|
15
|
+
* <PaintDrip src="/logo-white.svg" color="#C8FF00" />
|
|
16
|
+
* </section>
|
|
17
|
+
*/
|
|
18
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
19
|
+
import { dripStill, type PaintDripConfig } from '../runtime/paint-drip.js';
|
|
20
|
+
|
|
21
|
+
interface Props extends PaintDripConfig {
|
|
22
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
23
|
+
fixed?: boolean;
|
|
24
|
+
/** Run only while near the screen (true, or how near as a CSS length). Default false. */
|
|
25
|
+
lazy?: boolean | string;
|
|
26
|
+
class?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
30
|
+
const still = dripStill(config);
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<EffectCanvas name="paint-drip" config={config} fixed={fixed} lazy={lazy} background={still} class={className} />
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import { mount } from '../runtime/mount.js';
|
|
37
|
+
import { paintDrip } from '../runtime/paint-drip.js';
|
|
38
|
+
|
|
39
|
+
mount('[data-effect-paint-drip]', paintDrip);
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* PhotoBokeh: a photo seen through a lens racking its focus, the plane of
|
|
4
|
+
* focus sweeping slowly near to far and back (a depth guessed from the
|
|
5
|
+
* picture itself), soft out-of-focus lights tinted from its highlights
|
|
6
|
+
* drifting up through it. No pointer, made to sit behind copy. See
|
|
7
|
+
* src/runtime/photo-bokeh.js.
|
|
8
|
+
*
|
|
9
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`. The
|
|
10
|
+
* element shows the photo until the shader starts and without WebGL.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <section class="hero" style="position: relative">
|
|
14
|
+
* <PhotoBokeh src="/img/dahlias.webp" shape="blades" />
|
|
15
|
+
* <h1>…</h1>
|
|
16
|
+
* </section>
|
|
17
|
+
*/
|
|
18
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
19
|
+
import { photoBokehStill, type PhotoBokehConfig } from '../runtime/photo-bokeh.js';
|
|
20
|
+
|
|
21
|
+
interface Props extends PhotoBokehConfig {
|
|
22
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
23
|
+
fixed?: boolean;
|
|
24
|
+
/** Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away. Default false. */
|
|
25
|
+
lazy?: boolean | string;
|
|
26
|
+
class?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
30
|
+
const still = photoBokehStill(config);
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<EffectCanvas name="photo-bokeh" config={config} fixed={fixed} lazy={lazy} background={still} class={className} />
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import { mount } from '../runtime/mount.js';
|
|
37
|
+
import { photoBokeh } from '../runtime/photo-bokeh.js';
|
|
38
|
+
|
|
39
|
+
mount('[data-effect-photo-bokeh]', photoBokeh);
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* SunWall: low sunlight on a plaster wall, through venetian blinds (hard bars whose penumbra grows with the throw) or
|
|
4
|
+
* with a prism's spectrum beside a patch of sun, creeping slowly. See src/runtime/sun-wall.js.
|
|
5
|
+
*
|
|
6
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`. Opaque: it paints the wall everywhere; the
|
|
7
|
+
* element shows a CSS still of it until the shader starts and without WebGL.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <section class="hero" style="position: relative">
|
|
11
|
+
* <SunWall mode="blinds" wall="#d8c3a5" />
|
|
12
|
+
* <h1>…</h1>
|
|
13
|
+
* </section>
|
|
14
|
+
*/
|
|
15
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
16
|
+
import { sunWallStill, type SunWallConfig } from '../runtime/sun-wall.js';
|
|
17
|
+
|
|
18
|
+
interface Props extends SunWallConfig {
|
|
19
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
20
|
+
fixed?: boolean;
|
|
21
|
+
/** Run only while near the screen (true, or how near as a CSS length), giving its WebGL context back when away. Default false. */
|
|
22
|
+
lazy?: boolean | string;
|
|
23
|
+
class?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const { fixed = false, lazy = false, class: className, ...config } = Astro.props;
|
|
27
|
+
const still = sunWallStill(config);
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<EffectCanvas name="sun-wall" config={config} fixed={fixed} lazy={lazy} background={still} class={className} />
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
import { mount } from '../runtime/mount.js';
|
|
34
|
+
import { sunWall } from '../runtime/sun-wall.js';
|
|
35
|
+
|
|
36
|
+
mount('[data-effect-sun-wall]', sunWall);
|
|
37
|
+
</script>
|
package/src/index.d.ts
CHANGED
|
@@ -19,11 +19,23 @@ export { ditherGradient, gradientStill } from './runtime/dither-gradient.js';
|
|
|
19
19
|
export { truchetField, truchetStill } from './runtime/truchet-field.js';
|
|
20
20
|
export { pixelHorizon, horizonStill } from './runtime/pixel-horizon.js';
|
|
21
21
|
export { flutedGlow, glowStill } from './runtime/fluted-glow.js';
|
|
22
|
+
export { fluidFolds, foldsStill } from './runtime/fluid-folds.js';
|
|
23
|
+
export { flutedBokeh, bokehStill } from './runtime/fluted-bokeh.js';
|
|
24
|
+
export { paintDrip, dripStill } from './runtime/paint-drip.js';
|
|
25
|
+
export { photoBokeh, photoBokehStill } from './runtime/photo-bokeh.js';
|
|
26
|
+
export { lensFlare, flareStill } from './runtime/lens-flare.js';
|
|
27
|
+
export { sunWall, sunWallStill } from './runtime/sun-wall.js';
|
|
22
28
|
export { bayer, GLSL_BAYER } from './runtime/bayer.js';
|
|
23
29
|
export type { DitherGradientConfig } from './runtime/dither-gradient.js';
|
|
24
30
|
export type { TruchetFieldConfig } from './runtime/truchet-field.js';
|
|
25
31
|
export type { PixelHorizonConfig } from './runtime/pixel-horizon.js';
|
|
26
32
|
export type { FlutedGlowConfig } from './runtime/fluted-glow.js';
|
|
33
|
+
export type { FluidFoldsConfig } from './runtime/fluid-folds.js';
|
|
34
|
+
export type { PaintDripConfig } from './runtime/paint-drip.js';
|
|
35
|
+
export type { PhotoBokehConfig } from './runtime/photo-bokeh.js';
|
|
36
|
+
export type { LensFlareConfig } from './runtime/lens-flare.js';
|
|
37
|
+
export type { SunWallConfig, SunWallMode } from './runtime/sun-wall.js';
|
|
38
|
+
export type { FlutedBokehConfig } from './runtime/fluted-bokeh.js';
|
|
27
39
|
export type { LightLeakConfig } from './runtime/light-leak.js';
|
|
28
40
|
export type { DitherFieldConfig } from './runtime/dither-field.js';
|
|
29
41
|
export type { CascadeGridConfig } from './runtime/cascade-grid.js';
|
|
@@ -142,6 +154,7 @@ export type { SceneConfig, SceneName } from './runtime/scene.js';
|
|
|
142
154
|
export { PAPER_LOOKS } from './runtime/paper-looks.js';
|
|
143
155
|
export type { PaperLook, PaperLookName } from './runtime/paper-looks.js';
|
|
144
156
|
export { createStage } from './runtime/stage.js';
|
|
157
|
+
export { shareContexts, sharingContexts } from './runtime/shared-gl.js';
|
|
145
158
|
export type { Stage, StageOptions } from './runtime/stage.js';
|
|
146
159
|
export { createMesh, STRIDE } from './runtime/mesh.js';
|
|
147
160
|
export type { Mesh } from './runtime/mesh.js';
|
package/src/index.js
CHANGED
|
@@ -27,6 +27,12 @@ export { ditherGradient, gradientStill } from './runtime/dither-gradient.js';
|
|
|
27
27
|
export { truchetField, truchetStill } from './runtime/truchet-field.js';
|
|
28
28
|
export { pixelHorizon, horizonStill } from './runtime/pixel-horizon.js';
|
|
29
29
|
export { flutedGlow, glowStill } from './runtime/fluted-glow.js';
|
|
30
|
+
export { fluidFolds, foldsStill } from './runtime/fluid-folds.js';
|
|
31
|
+
export { flutedBokeh, bokehStill } from './runtime/fluted-bokeh.js';
|
|
32
|
+
export { paintDrip, dripStill } from './runtime/paint-drip.js';
|
|
33
|
+
export { photoBokeh, photoBokehStill } from './runtime/photo-bokeh.js';
|
|
34
|
+
export { lensFlare, flareStill } from './runtime/lens-flare.js';
|
|
35
|
+
export { sunWall, sunWallStill } from './runtime/sun-wall.js';
|
|
30
36
|
export { bayer, GLSL_BAYER } from './runtime/bayer.js';
|
|
31
37
|
export { glassGlyph } from './runtime/glass-glyph.js';
|
|
32
38
|
export { glassDrop } from './runtime/glass-drop.js';
|
|
@@ -92,6 +98,7 @@ export { paperLook, paperLookSettings } from './runtime/paper-look.js';
|
|
|
92
98
|
export { scene, sceneSettings } from './runtime/scene.js';
|
|
93
99
|
export { PAPER_LOOKS } from './runtime/paper-looks.js';
|
|
94
100
|
export { createStage } from './runtime/stage.js';
|
|
101
|
+
export { shareContexts, sharingContexts } from './runtime/shared-gl.js';
|
|
95
102
|
export { createMesh, STRIDE } from './runtime/mesh.js';
|
|
96
103
|
export { isoCamera, ISO_PITCH } from './runtime/iso-camera.js';
|
|
97
104
|
export { instancing } from './runtime/instancing.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { PaletteName } from './palettes.js';
|
|
2
2
|
|
|
3
3
|
/** The gradient's shapes. */
|
|
4
|
-
export type GradientShape = 'wave' | 'band' | 'swirl' | 'pinwheel' | 'steps';
|
|
4
|
+
export type GradientShape = 'wave' | 'band' | 'swirl' | 'pinwheel' | 'steps' | 'orb' | 'pill';
|
|
5
5
|
|
|
6
6
|
export interface DitherGradientConfig {
|
|
7
|
-
/** Two CSS hex colours
|
|
7
|
+
/** Two CSS hex colours, the dim one where the tone is low and the bright one where it is full, or three with a middle colour between them. Default a plum and a hot pink. */
|
|
8
8
|
colors?: string[];
|
|
9
9
|
/** A shared palette by name (`PALETTES`, any case), when there are no `colors`: its first and last colours. */
|
|
10
10
|
palette?: PaletteName | (string & {});
|
|
@@ -32,6 +32,8 @@ export interface DitherGradientConfig {
|
|
|
32
32
|
rate?: number;
|
|
33
33
|
/** The steps' block, in dots. Default 6. */
|
|
34
34
|
block?: number;
|
|
35
|
+
/** The orb's radius, and the pill's thickness's share, in widths. Default 0.3. */
|
|
36
|
+
size?: number;
|
|
35
37
|
/** Colour bands from dim to bright; 0 blends smoothly. Default 0. */
|
|
36
38
|
steps?: number;
|
|
37
39
|
/** The swirl's and pinwheel's centre, and the wave's and band's pivot, 0–1 from the top left. Default [0.5, 0.5]. */
|
|
@@ -45,7 +47,7 @@ export interface DitherGradientConfig {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
/** The shapes, in the order the shader numbers them. */
|
|
48
|
-
export declare const GRADIENT_SHAPES: readonly ['wave', 'band', 'swirl', 'pinwheel', 'steps'];
|
|
50
|
+
export declare const GRADIENT_SHAPES: readonly ['wave', 'band', 'swirl', 'pinwheel', 'steps', 'orb', 'pill'];
|
|
49
51
|
|
|
50
52
|
/** The settings' defaults, shared by the shader and the JS twin. */
|
|
51
53
|
export declare const GRADIENT_DEFAULTS: {
|
|
@@ -60,6 +62,7 @@ export declare const GRADIENT_DEFAULTS: {
|
|
|
60
62
|
twist: number;
|
|
61
63
|
rate: number;
|
|
62
64
|
block: number;
|
|
65
|
+
size: number;
|
|
63
66
|
steps: number;
|
|
64
67
|
centre: [number, number];
|
|
65
68
|
};
|
|
@@ -81,6 +84,9 @@ export declare function gradientTone(s: GradientSettings, x: number, y: number,
|
|
|
81
84
|
/** One frame dot for dot on a target exactly `cols` by `rows` dots: each dot's tone after the quiet area, and whether a bayer dot is lit. */
|
|
82
85
|
export declare function gradientDots(config: DitherGradientConfig, cols: number, rows: number, time?: number): { tone: number; lit: boolean }[][];
|
|
83
86
|
|
|
87
|
+
/** The three colours the dots blend through, low to high: a middle one of their own when three or more are given, else halfway in Oklab. */
|
|
88
|
+
export declare function gradientRamp(config: DitherGradientConfig): [string, string, string];
|
|
89
|
+
|
|
84
90
|
/** The two colours as the shader takes them: the dim one and the bright one. */
|
|
85
91
|
export declare function gradientColors(config: DitherGradientConfig): [string, string];
|
|
86
92
|
|