@arraypress/effects-astro 0.14.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/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 +9 -0
- package/src/index.js +5 -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,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
|
@@ -21,12 +21,20 @@ export { pixelHorizon, horizonStill } from './runtime/pixel-horizon.js';
|
|
|
21
21
|
export { flutedGlow, glowStill } from './runtime/fluted-glow.js';
|
|
22
22
|
export { fluidFolds, foldsStill } from './runtime/fluid-folds.js';
|
|
23
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';
|
|
24
28
|
export { bayer, GLSL_BAYER } from './runtime/bayer.js';
|
|
25
29
|
export type { DitherGradientConfig } from './runtime/dither-gradient.js';
|
|
26
30
|
export type { TruchetFieldConfig } from './runtime/truchet-field.js';
|
|
27
31
|
export type { PixelHorizonConfig } from './runtime/pixel-horizon.js';
|
|
28
32
|
export type { FlutedGlowConfig } from './runtime/fluted-glow.js';
|
|
29
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';
|
|
30
38
|
export type { FlutedBokehConfig } from './runtime/fluted-bokeh.js';
|
|
31
39
|
export type { LightLeakConfig } from './runtime/light-leak.js';
|
|
32
40
|
export type { DitherFieldConfig } from './runtime/dither-field.js';
|
|
@@ -146,6 +154,7 @@ export type { SceneConfig, SceneName } from './runtime/scene.js';
|
|
|
146
154
|
export { PAPER_LOOKS } from './runtime/paper-looks.js';
|
|
147
155
|
export type { PaperLook, PaperLookName } from './runtime/paper-looks.js';
|
|
148
156
|
export { createStage } from './runtime/stage.js';
|
|
157
|
+
export { shareContexts, sharingContexts } from './runtime/shared-gl.js';
|
|
149
158
|
export type { Stage, StageOptions } from './runtime/stage.js';
|
|
150
159
|
export { createMesh, STRIDE } from './runtime/mesh.js';
|
|
151
160
|
export type { Mesh } from './runtime/mesh.js';
|
package/src/index.js
CHANGED
|
@@ -29,6 +29,10 @@ export { pixelHorizon, horizonStill } from './runtime/pixel-horizon.js';
|
|
|
29
29
|
export { flutedGlow, glowStill } from './runtime/fluted-glow.js';
|
|
30
30
|
export { fluidFolds, foldsStill } from './runtime/fluid-folds.js';
|
|
31
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';
|
|
32
36
|
export { bayer, GLSL_BAYER } from './runtime/bayer.js';
|
|
33
37
|
export { glassGlyph } from './runtime/glass-glyph.js';
|
|
34
38
|
export { glassDrop } from './runtime/glass-drop.js';
|
|
@@ -94,6 +98,7 @@ export { paperLook, paperLookSettings } from './runtime/paper-look.js';
|
|
|
94
98
|
export { scene, sceneSettings } from './runtime/scene.js';
|
|
95
99
|
export { PAPER_LOOKS } from './runtime/paper-looks.js';
|
|
96
100
|
export { createStage } from './runtime/stage.js';
|
|
101
|
+
export { shareContexts, sharingContexts } from './runtime/shared-gl.js';
|
|
97
102
|
export { createMesh, STRIDE } from './runtime/mesh.js';
|
|
98
103
|
export { isoCamera, ISO_PITCH } from './runtime/iso-camera.js';
|
|
99
104
|
export { instancing } from './runtime/instancing.js';
|
|
@@ -53,6 +53,20 @@ export interface GlassDropConfig {
|
|
|
53
53
|
loop?: boolean;
|
|
54
54
|
/** With `loop`: seconds the logo rests before the next drop, 0–10. Default 1.6. */
|
|
55
55
|
loopDelay?: number;
|
|
56
|
+
/** A photo behind the glass (same origin), covering the element; the glass is then clear and bends it. */
|
|
57
|
+
backdrop?: string;
|
|
58
|
+
/** How soft the backdrop is round the glass (a mip bias, 0–5); through the glass it stays sharp, as a lens brings it into focus. Default 0. */
|
|
59
|
+
soften?: number;
|
|
60
|
+
/** How bright the backdrop shows round the glass, 0–1. Default 0.82. */
|
|
61
|
+
dim?: number;
|
|
62
|
+
/** A slow swell over the glass's top, like liquid settling, 0–2; 0 for none. Default 0. */
|
|
63
|
+
flow?: number;
|
|
64
|
+
/** How much the glass's flat middle magnifies what is behind, 0–0.3. Default 0.05. */
|
|
65
|
+
magnify?: number;
|
|
66
|
+
/** The glass's shadow on what is behind, with light focused into it, 0–2; 0 for none. Default 0. */
|
|
67
|
+
shadow?: number;
|
|
68
|
+
/** How far the light swings about `lightAngle` over time, degrees; 0 holds it. Default 0. */
|
|
69
|
+
lightDrift?: number;
|
|
56
70
|
/** How it ends: `flat`, the glass melted and the logo left on the ground, or `glass`, the glass held. Default `flat`. */
|
|
57
71
|
rest?: 'flat' | 'glass';
|
|
58
72
|
}
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
* a circle, a rounded square or the logo's own field, mixed as the drop
|
|
15
15
|
* spreads — lit by the shared studio (./glass-optics.js).
|
|
16
16
|
*
|
|
17
|
+
* Over a `backdrop` photo it is clear glass: the photo shows through it,
|
|
18
|
+
* magnified in its flat middle and bent hard at its bevel, the colours
|
|
19
|
+
* parting there, darker in a band inside the rim, tinted the logo's colour
|
|
20
|
+
* as light through tinted glass is, casting a shadow with a caustic in it.
|
|
21
|
+
* `flow` swells its top slowly, like liquid, and `lightDrift` moves the light.
|
|
22
|
+
*
|
|
17
23
|
* Opaque: it paints its `background` everywhere. Without WebGL the canvas
|
|
18
24
|
* goes and the element's background shows. With reduced motion it is one
|
|
19
25
|
* still frame: the final state (the logo at rest, or the glass held).
|
|
@@ -24,6 +30,7 @@ import { drawShape, distanceField, blurField } from './shape.js';
|
|
|
24
30
|
import { parseColor } from './color.js';
|
|
25
31
|
import { GLSL_STUDIO, lightVector } from './glass-optics.js';
|
|
26
32
|
import { DROP_SIZE, dropAt, dropLayout } from './glass-drop-plan.js';
|
|
33
|
+
import { loadImage, imageTexture, coverScale } from './image.js';
|
|
27
34
|
|
|
28
35
|
/**
|
|
29
36
|
* @typedef {import('./glass-drop.js').GlassDropConfig} GlassDropConfig
|
|
@@ -61,6 +68,17 @@ uniform float uBloom;
|
|
|
61
68
|
uniform float uRipples;
|
|
62
69
|
uniform float uTint;
|
|
63
70
|
uniform vec2 uLightDir;
|
|
71
|
+
uniform sampler2D uPhoto;
|
|
72
|
+
uniform float uHasPhoto;
|
|
73
|
+
uniform float uAspect;
|
|
74
|
+
uniform vec2 uCover;
|
|
75
|
+
uniform float uDim;
|
|
76
|
+
uniform float uSoft;
|
|
77
|
+
// the mip bias the backdrop is read at: soft round the glass, sharp through it (a lens brings what is behind into focus)
|
|
78
|
+
float gBias = 0.0;
|
|
79
|
+
uniform float uFlow;
|
|
80
|
+
uniform float uMagnify;
|
|
81
|
+
uniform float uShadow;
|
|
64
82
|
${GLSL_STUDIO}
|
|
65
83
|
|
|
66
84
|
// The logo's coverage at p (heights from the glass's middle), its box 'box' high.
|
|
@@ -105,9 +123,22 @@ float heightAt(float g, float b) {
|
|
|
105
123
|
return sqrt(s * (2.0 - s));
|
|
106
124
|
}
|
|
107
125
|
|
|
126
|
+
// A slow swell over the glass's top, like liquid still settling: a height to add inside the bevel.
|
|
127
|
+
float flowAt(vec2 p) {
|
|
128
|
+
if (uFlow <= 0.0) return 0.0;
|
|
129
|
+
float t = uTime;
|
|
130
|
+
return uFlow * 0.05 * (sin(p.x * 17.0 + t * 0.9) * cos(p.y * 13.0 - t * 0.7) + 0.6 * sin((p.x + p.y) * 23.0 - t * 1.3));
|
|
131
|
+
}
|
|
132
|
+
|
|
108
133
|
// The ground: its colour, a faint pool of light about the middle, and the rings the drop sent out.
|
|
109
134
|
vec3 ground(vec2 p) {
|
|
110
135
|
vec3 col = uGround + (uLight - uGround) * 0.03 * uGlass * exp(-dot(p, p) * 5.0);
|
|
136
|
+
if (uHasPhoto > 0.5) {
|
|
137
|
+
// a photo behind the glass, covering the element as CSS 'cover' does, dimmed so the glass reads over it
|
|
138
|
+
vec2 sp = p + uCentre;
|
|
139
|
+
vec2 uv = (vec2(sp.x / uAspect, 1.0 - sp.y) - 0.5) * uCover + 0.5;
|
|
140
|
+
col = texture2D(uPhoto, clamp(uv, 0.001, 0.999), gBias).rgb * uDim;
|
|
141
|
+
}
|
|
111
142
|
if (uRipple > 0.0) {
|
|
112
143
|
float r = length(p);
|
|
113
144
|
for (int k = 0; k < 3; k++) {
|
|
@@ -140,6 +171,8 @@ void main() {
|
|
|
140
171
|
float hx = heightAt(glassField(p + e.xy), b) - heightAt(glassField(p - e.xy), b);
|
|
141
172
|
float hy = heightAt(glassField(p + e.yx), b) - heightAt(glassField(p - e.yx), b);
|
|
142
173
|
vec2 slope = vec2(hx, hy) / (2.0 * e.x) * b;
|
|
174
|
+
float inGlass = smoothstep(0.0, b, g);
|
|
175
|
+
slope += vec2(flowAt(p + e.xy) - flowAt(p - e.xy), flowAt(p + e.yx) - flowAt(p - e.yx)) / (2.0 * e.x) * b * inGlass;
|
|
143
176
|
float h = heightAt(g, b);
|
|
144
177
|
vec3 n = normalize(vec3(-slope * uDepth * 0.55 * uGlass, 1.0));
|
|
145
178
|
vec2 outward = length(slope) > 1e-5 ? -normalize(slope) : vec2(0.0);
|
|
@@ -148,9 +181,11 @@ void main() {
|
|
|
148
181
|
float plate = uForm < 0.5 ? cover : 0.0;
|
|
149
182
|
|
|
150
183
|
// Through the glass: magnified a little, bent at the rim, the colours parting there.
|
|
151
|
-
|
|
152
|
-
vec2
|
|
153
|
-
|
|
184
|
+
// (over a photo the bend is stronger, so it visibly bends and magnifies what is behind; the colours part as far as it bends)
|
|
185
|
+
vec2 rim = n.xy * uDepth * mix(0.06, 0.11, uHasPhoto);
|
|
186
|
+
vec2 lens = p * (1.0 - h * uMagnify * uGlass);
|
|
187
|
+
float split = uDispersion * mix(0.3, 0.45, uHasPhoto);
|
|
188
|
+
gBias = 0.0;
|
|
154
189
|
vec3 through = vec3(
|
|
155
190
|
scene(lens - rim * (1.0 + split), plate).r,
|
|
156
191
|
scene(lens - rim, plate).g,
|
|
@@ -158,8 +193,16 @@ void main() {
|
|
|
158
193
|
);
|
|
159
194
|
if (uForm > 0.5) {
|
|
160
195
|
// The logo made of glass: the ground through it, tinted the logo's colour, deepest where it is thickest.
|
|
161
|
-
|
|
162
|
-
|
|
196
|
+
if (uHasPhoto > 0.5) {
|
|
197
|
+
// clear glass over a photo: the photo through it, taking the logo's colour as light does through tinted glass
|
|
198
|
+
// (deeper where it is thicker), lifted, as glass gathers light from the room round it: over a dark part of the
|
|
199
|
+
// photo it still glows a little, never a black hole
|
|
200
|
+
vec3 absorb = pow(max(uInk, vec3(0.02)), vec3((0.35 + 0.9 * h) * uTint));
|
|
201
|
+
through = through * mix(vec3(1.0), absorb, uGlass) * (1.0 + 0.3 * uGlass) + mix(uLight, uInk, 0.35) * 0.07 * uGlass;
|
|
202
|
+
} else {
|
|
203
|
+
float tint = mix(1.0, uTint * (0.75 + 0.25 * h), uGlass);
|
|
204
|
+
through = mix(through, uInk * (0.82 + 0.18 * h + 0.12 * (1.0 - uGlass)), tint);
|
|
205
|
+
}
|
|
163
206
|
}
|
|
164
207
|
|
|
165
208
|
// What the glass mirrors: the studio, along the bevels as they turn toward it.
|
|
@@ -167,7 +210,17 @@ void main() {
|
|
|
167
210
|
vec3 mirrored = studio(reflect(view, n), uLightDir, uLight);
|
|
168
211
|
float fres = schlick(n.z, 0.04);
|
|
169
212
|
vec3 col = through * (1.0 - fres * 0.6) + mirrored * (0.25 + fres * 1.6) * uHighlights * uGlass;
|
|
213
|
+
if (uHasPhoto > 0.5) {
|
|
214
|
+
// the room the glass mirrors on its face too: a soft window of light swept across it from the light's side, and a
|
|
215
|
+
// faint lit inner edge all round, so the glass reads even over the darkest part of the photo
|
|
216
|
+
float across = dot(p, uLightDir) / max(uMarkBox, 1e-4);
|
|
217
|
+
float window = smoothstep(-0.1, 0.45, across) * (1.0 - smoothstep(0.45, 0.75, across));
|
|
218
|
+
col += uLight * window * (0.07 + 0.18 * h) * uHighlights * uGlass;
|
|
219
|
+
col += mix(uLight, uInk, 0.4) * 0.16 * uGlass * smoothstep(b * 0.7, b * 0.05, g) * smoothstep(0.0, px * 2.0, g);
|
|
220
|
+
}
|
|
170
221
|
|
|
222
|
+
// Thick glass goes dark in a band just inside its rim, where the view inside reflects back off the far wall.
|
|
223
|
+
col *= 1.0 - 0.26 * uHasPhoto * uGlass * smoothstep(b * 0.85, b * 0.2, g) * smoothstep(0.0, px * 2.5, g);
|
|
171
224
|
// The lip: a hairline brightest facing the light; light gathered just inside the rim on the far side.
|
|
172
225
|
float facing = dot(outward, uLightDir);
|
|
173
226
|
float lip = exp(-pow(g / (px * 1.3), 2.0));
|
|
@@ -176,12 +229,22 @@ void main() {
|
|
|
176
229
|
col += mix(uLight, uInk, 0.5) * inner * max(-facing, 0.0) * 0.32 * uCaustics * uGlass;
|
|
177
230
|
|
|
178
231
|
// Outside: the ground, the light the glass focuses onto it on the side away from the light, and a soft bloom.
|
|
232
|
+
gBias = uSoft * uHasPhoto;
|
|
179
233
|
vec3 outside = scene(p, 0.0);
|
|
180
234
|
// (the logo's own field stops a little way out, so its glow stays closer)
|
|
181
235
|
float reach = uForm < 0.5 ? uEdge : uMarkBox * 0.4;
|
|
182
236
|
float near = exp(min(g, 0.0) / (reach * 0.05 + 1e-4));
|
|
183
237
|
outside += mix(uLight, uInk, 0.6) * near * max(-facing, 0.0) * 0.14 * uCaustics * uGlass;
|
|
184
238
|
outside += mix(uLight, uInk, 0.5) * exp(min(g, 0.0) / (reach * 0.09 + 1e-4)) * 0.12 * uBloom * uGlass;
|
|
239
|
+
if (uShadow > 0.0) {
|
|
240
|
+
// its shadow on what is behind, cast away from the light, and the light the glass focuses into it
|
|
241
|
+
float gs = glassField(p + uLightDir * reach * 0.07);
|
|
242
|
+
float shade = smoothstep(-reach * 0.05, reach * 0.03, gs);
|
|
243
|
+
outside *= 1.0 - 0.5 * uShadow * shade * uGlass;
|
|
244
|
+
float gc = glassField(p + uLightDir * reach * 0.035);
|
|
245
|
+
float focus = exp(-pow(gc / (reach * 0.012 + 1e-4), 2.0)) * step(g, 0.0);
|
|
246
|
+
outside += mix(uLight, uInk, 0.45) * focus * 0.35 * uShadow * uCaustics * uGlass;
|
|
247
|
+
}
|
|
185
248
|
|
|
186
249
|
gl_FragColor = vec4(mix(outside, col, cover), 1.0);
|
|
187
250
|
}
|
|
@@ -203,6 +266,12 @@ const DEFAULTS = Object.freeze({
|
|
|
203
266
|
ripples: 1,
|
|
204
267
|
tint: 0.88,
|
|
205
268
|
lightAngle: 125,
|
|
269
|
+
dim: 0.82,
|
|
270
|
+
flow: 0,
|
|
271
|
+
magnify: 0.05,
|
|
272
|
+
shadow: 0,
|
|
273
|
+
lightDrift: 0,
|
|
274
|
+
soften: 0,
|
|
206
275
|
});
|
|
207
276
|
|
|
208
277
|
/** The finest the logo's mask and field are drawn, in pixels across. */
|
|
@@ -261,6 +330,11 @@ export function glassDrop(el, config) {
|
|
|
261
330
|
/** The shape's textures, made in setup. */
|
|
262
331
|
let mask = /** @type {WebGLTexture | null} */ (null);
|
|
263
332
|
let sdf = /** @type {WebGLTexture | null} */ (null);
|
|
333
|
+
/** The backdrop photo's texture, its aspect, and the element's, once known. */
|
|
334
|
+
let photo = /** @type {WebGLTexture | null} */ (null);
|
|
335
|
+
let photoAspect = 1;
|
|
336
|
+
let boxAspect = 1;
|
|
337
|
+
let alive = true;
|
|
264
338
|
|
|
265
339
|
const { stage, stop } = createStage(el, {
|
|
266
340
|
fragment: FRAG,
|
|
@@ -285,9 +359,20 @@ export function glassDrop(el, config) {
|
|
|
285
359
|
gl.uniform3fv(uniform('uInk'), parseColor(c.color));
|
|
286
360
|
gl.uniform3fv(uniform('uPlate'), parseColor(c.plate));
|
|
287
361
|
gl.uniform3fv(uniform('uLight'), parseColor(c.light));
|
|
362
|
+
gl.uniform1i(uniform('uPhoto'), 2);
|
|
363
|
+
gl.uniform1f(uniform('uHasPhoto'), 0);
|
|
364
|
+
gl.uniform1f(uniform('uDim'), c.dim);
|
|
365
|
+
gl.uniform1f(uniform('uSoft'), Math.max(0, Math.min(5, c.soften)));
|
|
366
|
+
gl.uniform1f(uniform('uFlow'), Math.max(0, Math.min(2, c.flow)));
|
|
367
|
+
gl.uniform1f(uniform('uMagnify'), c.magnify);
|
|
368
|
+
gl.uniform1f(uniform('uShadow'), Math.max(0, Math.min(2, c.shadow)));
|
|
369
|
+
return () => gl.deleteTexture(photo);
|
|
288
370
|
},
|
|
289
371
|
resize({ gl, uniform, canvas }) {
|
|
290
372
|
const aspect = canvas.width / canvas.height;
|
|
373
|
+
boxAspect = aspect;
|
|
374
|
+
gl.uniform1f(uniform('uAspect'), aspect);
|
|
375
|
+
gl.uniform2fv(uniform('uCover'), coverScale(photoAspect, aspect));
|
|
291
376
|
const layout = dropLayout(c, aspect);
|
|
292
377
|
gl.uniform2f(uniform('uCentre'), layout.centre.x * aspect, 1 - layout.centre.y);
|
|
293
378
|
tile = layout.tile;
|
|
@@ -325,7 +410,32 @@ export function glassDrop(el, config) {
|
|
|
325
410
|
gl.uniform1f(uniform('uMarkIn'), s.markIn);
|
|
326
411
|
gl.uniform1f(uniform('uGlass'), s.glass);
|
|
327
412
|
gl.uniform1f(uniform('uScale'), s.scale);
|
|
413
|
+
// the light drifts slowly about its angle, so the glass's rims and reflections move
|
|
414
|
+
const drift = still || !c.lightDrift ? 0 : Math.sin(seconds * 0.23) * c.lightDrift * 0.7 + Math.sin(seconds * 0.11 + 1.3) * c.lightDrift * 0.3;
|
|
415
|
+
gl.uniform2fv(uniform('uLightDir'), lightVector(c.lightAngle + drift));
|
|
416
|
+
if (photo) {
|
|
417
|
+
gl.activeTexture(gl.TEXTURE2);
|
|
418
|
+
gl.bindTexture(gl.TEXTURE_2D, photo);
|
|
419
|
+
}
|
|
328
420
|
},
|
|
329
421
|
});
|
|
330
|
-
|
|
422
|
+
if (stage && c.backdrop) {
|
|
423
|
+
loadImage(c.backdrop)
|
|
424
|
+
.then((image) => {
|
|
425
|
+
if (!alive) return;
|
|
426
|
+
const { gl, uniform, program } = stage;
|
|
427
|
+
gl.activeTexture(gl.TEXTURE2);
|
|
428
|
+
photo = imageTexture(gl, image, { mipmap: true });
|
|
429
|
+
photoAspect = image.naturalWidth / image.naturalHeight;
|
|
430
|
+
gl.useProgram(program);
|
|
431
|
+
gl.uniform1f(uniform('uHasPhoto'), 1);
|
|
432
|
+
gl.uniform2fv(uniform('uCover'), coverScale(photoAspect, boxAspect));
|
|
433
|
+
stage.redraw();
|
|
434
|
+
})
|
|
435
|
+
.catch((error) => console.warn('[effects-astro]', error));
|
|
436
|
+
}
|
|
437
|
+
return () => {
|
|
438
|
+
alive = false;
|
|
439
|
+
stop();
|
|
440
|
+
};
|
|
331
441
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export interface GlassPlatesConfig {
|
|
2
|
+
/** An image (an SVG logo) to cut the plates from. */
|
|
3
|
+
src?: string;
|
|
4
|
+
/** A character or word instead of an image. */
|
|
5
|
+
text?: string;
|
|
6
|
+
/** Its CSS font, without the size. */
|
|
7
|
+
font?: string;
|
|
8
|
+
/** Where the stack sits, each 0–1 from the top left. Default all of the element. */
|
|
9
|
+
area?: { x: number; y: number; width: number; height: number };
|
|
10
|
+
/** The logo's box, a share of the area's shorter side. Default 0.7. */
|
|
11
|
+
logoScale?: number;
|
|
12
|
+
/** The plates' tints, back to front (blended between). Default pale blues. */
|
|
13
|
+
colors?: string[];
|
|
14
|
+
/** The colour of the glass seen through its edge. Default `#5FD6B8`. */
|
|
15
|
+
edge?: string;
|
|
16
|
+
/** How many plates, 2–4. Default 3. */
|
|
17
|
+
plates?: number;
|
|
18
|
+
/** The step between plates, a share of the box. Default 0.07. */
|
|
19
|
+
spread?: number;
|
|
20
|
+
/** How thick each plate's edge shows, a share of the box. Default 0.045. */
|
|
21
|
+
thickness?: number;
|
|
22
|
+
/** How wide each face's bevel is, a share of the box. Default 0.035. */
|
|
23
|
+
bevel?: number;
|
|
24
|
+
/** How deep the tints are (they deepen where plates overlap). Default 0.6. */
|
|
25
|
+
density?: number;
|
|
26
|
+
/** How hard a face bends the photo, in heights. Default 0.022. */
|
|
27
|
+
bend?: number;
|
|
28
|
+
/** How far the colours part where it bends, 0–1. Default 0.35. */
|
|
29
|
+
dispersion?: number;
|
|
30
|
+
/** The streak of reflected light across each face, 0–2. Default 1. */
|
|
31
|
+
streak?: number;
|
|
32
|
+
/** The stack's shadow on the photo, 0–2. Default 0.6. */
|
|
33
|
+
shadow?: number;
|
|
34
|
+
/** A photo behind (same origin), covering the element. */
|
|
35
|
+
backdrop?: string;
|
|
36
|
+
/** How bright the photo shows, 0–1. Default 0.75. */
|
|
37
|
+
dim?: number;
|
|
38
|
+
/** How soft the photo is round the plates (a mip bias, 0–5); through them it is sharp. Default 2. */
|
|
39
|
+
soften?: number;
|
|
40
|
+
/** The ground without a photo. Default `#0b0b0b`. */
|
|
41
|
+
background?: string;
|
|
42
|
+
/** The studio light. Default `#ffffff`. */
|
|
43
|
+
light?: string;
|
|
44
|
+
/** Where the light comes from, degrees (0 right, 90 top). Default 120. */
|
|
45
|
+
lightAngle?: number;
|
|
46
|
+
/** How much the plates and the light drift, 0–2; 0 holds them. Default 1. */
|
|
47
|
+
drift?: number;
|
|
48
|
+
/** Slide the plates apart when it first shows. Default true. */
|
|
49
|
+
intro?: boolean;
|
|
50
|
+
/** Seconds the plates take to slide apart. Default 1.4. */
|
|
51
|
+
introDuration?: number;
|
|
52
|
+
/** Seconds before it starts. Default 0. */
|
|
53
|
+
delay?: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** The plates' tints, back to front, blended in Oklab (RGB 0–1). */
|
|
57
|
+
export declare function plateTints(colors: string[], plates: number): Array<[number, number, number]>;
|
|
58
|
+
|
|
59
|
+
/** Where plate `k` of `n` sits: its offset from the stack's middle, a share of the box (x right, y down). */
|
|
60
|
+
export declare function plateOffset(k: number, n: number, spread: number): { x: number; y: number };
|
|
61
|
+
|
|
62
|
+
/** Starts the glass plates on an element (its first canvas). Returns a function that stops it. */
|
|
63
|
+
export declare function glassPlates(el: HTMLElement, config: GlassPlatesConfig): () => void;
|