@arraypress/effects-astro 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +85 -0
- package/COMPONENTS.md +1264 -0
- package/LICENSE +139 -0
- package/README.md +197 -2
- package/package.json +60 -4
- package/src/components/AsciiRain.astro +36 -0
- package/src/components/BorderSweep.astro +39 -0
- package/src/components/Caustics.astro +39 -0
- package/src/components/ColorPanels.astro +62 -0
- package/src/components/Cursor.astro +97 -0
- package/src/components/DotGrid.astro +34 -0
- package/src/components/DotSurface.astro +35 -0
- package/src/components/EffectCanvas.astro +152 -0
- package/src/components/FitText.astro +35 -0
- package/src/components/FlutedGlass.astro +36 -0
- package/src/components/Glass.astro +69 -0
- package/src/components/GlassGlyph.astro +38 -0
- package/src/components/GlowField.astro +177 -0
- package/src/components/Grain.astro +98 -0
- package/src/components/HaloRing.astro +38 -0
- package/src/components/HighlightSweep.astro +74 -0
- package/src/components/ImageRipple.astro +56 -0
- package/src/components/Ink.astro +37 -0
- package/src/components/InkField.astro +45 -0
- package/src/components/IsoCity.astro +54 -0
- package/src/components/LightField.astro +40 -0
- package/src/components/LiquidMetal.astro +41 -0
- package/src/components/Magnetic.astro +52 -0
- package/src/components/Marquee.astro +216 -0
- package/src/components/MosaicReveal.astro +196 -0
- package/src/components/NebulaLogo.astro +38 -0
- package/src/components/NeonSwarm.astro +38 -0
- package/src/components/Ocean.astro +40 -0
- package/src/components/OutlineWordmark.astro +222 -0
- package/src/components/PaperBackground.astro +40 -0
- package/src/components/PaperShader.astro +55 -0
- package/src/components/Parallax.astro +49 -0
- package/src/components/ParticleLogo.astro +37 -0
- package/src/components/PixelGlitchText.astro +70 -0
- package/src/components/PointCloud.astro +37 -0
- package/src/components/ProductStack.astro +298 -0
- package/src/components/PulseMark.astro +189 -0
- package/src/components/RadiantGlass.astro +38 -0
- package/src/components/RainOnGlass.astro +71 -0
- package/src/components/Reveal.astro +115 -0
- package/src/components/ScrambleText.astro +52 -0
- package/src/components/ScrollReveal.astro +38 -0
- package/src/components/ShaderBackground.astro +55 -0
- package/src/components/SignalLines.astro +41 -0
- package/src/components/SilkRibbon.astro +37 -0
- package/src/components/SpotlightText.astro +131 -0
- package/src/components/Tilt.astro +79 -0
- package/src/components/Topography.astro +38 -0
- package/src/components/Typewriter.astro +66 -0
- package/src/components/VariableType.astro +59 -0
- package/src/components/VoxelLogo.astro +46 -0
- package/src/components/WaveBars.astro +41 -0
- package/src/components/WorldRoutes.astro +41 -0
- package/src/components/style.js +19 -0
- package/src/index.d.ts +143 -0
- package/src/index.js +105 -0
- package/src/runtime/ascii-rain.d.ts +53 -0
- package/src/runtime/ascii-rain.js +355 -0
- package/src/runtime/audio-meter.d.ts +65 -0
- package/src/runtime/audio-meter.js +282 -0
- package/src/runtime/audio.d.ts +26 -0
- package/src/runtime/audio.js +453 -0
- package/src/runtime/blur.d.ts +2 -0
- package/src/runtime/blur.js +56 -0
- package/src/runtime/canvas2d.d.ts +23 -0
- package/src/runtime/canvas2d.js +105 -0
- package/src/runtime/caustics.d.ts +40 -0
- package/src/runtime/caustics.js +286 -0
- package/src/runtime/color.d.ts +33 -0
- package/src/runtime/color.js +213 -0
- package/src/runtime/curl.d.ts +5 -0
- package/src/runtime/curl.js +81 -0
- package/src/runtime/cursor.d.ts +9 -0
- package/src/runtime/cursor.js +80 -0
- package/src/runtime/device.d.ts +14 -0
- package/src/runtime/device.js +73 -0
- package/src/runtime/dot-grid.d.ts +27 -0
- package/src/runtime/dot-grid.js +245 -0
- package/src/runtime/dot-surface.d.ts +46 -0
- package/src/runtime/dot-surface.js +429 -0
- package/src/runtime/feedback.d.ts +18 -0
- package/src/runtime/feedback.js +131 -0
- package/src/runtime/fit-text.d.ts +5 -0
- package/src/runtime/fit-text.js +60 -0
- package/src/runtime/fluid.d.ts +55 -0
- package/src/runtime/fluid.js +504 -0
- package/src/runtime/fluted-glass.d.ts +27 -0
- package/src/runtime/fluted-glass.js +157 -0
- package/src/runtime/gl.d.ts +19 -0
- package/src/runtime/gl.js +104 -0
- package/src/runtime/glass-glyph.d.ts +49 -0
- package/src/runtime/glass-glyph.js +355 -0
- package/src/runtime/glass-sheen.d.ts +2 -0
- package/src/runtime/glass-sheen.js +30 -0
- package/src/runtime/glsl.d.ts +17 -0
- package/src/runtime/glsl.js +78 -0
- package/src/runtime/glyphs.d.ts +22 -0
- package/src/runtime/glyphs.js +107 -0
- package/src/runtime/halo-ring.d.ts +47 -0
- package/src/runtime/halo-ring.js +334 -0
- package/src/runtime/height-field.d.ts +50 -0
- package/src/runtime/height-field.js +176 -0
- package/src/runtime/image-ripple.d.ts +25 -0
- package/src/runtime/image-ripple.js +353 -0
- package/src/runtime/image.d.ts +11 -0
- package/src/runtime/image.js +81 -0
- package/src/runtime/in-view.d.ts +6 -0
- package/src/runtime/in-view.js +36 -0
- package/src/runtime/ink-field/shaders.js +258 -0
- package/src/runtime/ink-field/sim.js +582 -0
- package/src/runtime/ink-field.d.ts +39 -0
- package/src/runtime/ink-field.js +311 -0
- package/src/runtime/ink.d.ts +31 -0
- package/src/runtime/ink.js +109 -0
- package/src/runtime/instancing.d.ts +12 -0
- package/src/runtime/instancing.js +37 -0
- package/src/runtime/iso-camera.d.ts +35 -0
- package/src/runtime/iso-camera.js +85 -0
- package/src/runtime/iso-city/figures.d.ts +30 -0
- package/src/runtime/iso-city/figures.js +136 -0
- package/src/runtime/iso-city/look.d.ts +34 -0
- package/src/runtime/iso-city/look.js +105 -0
- package/src/runtime/iso-city/plan.d.ts +59 -0
- package/src/runtime/iso-city/plan.js +463 -0
- package/src/runtime/iso-city/roads.d.ts +64 -0
- package/src/runtime/iso-city/roads.js +320 -0
- package/src/runtime/iso-city/scene.d.ts +27 -0
- package/src/runtime/iso-city/scene.js +432 -0
- package/src/runtime/iso-city/shaders.d.ts +6 -0
- package/src/runtime/iso-city/shaders.js +233 -0
- package/src/runtime/iso-city/shadows.d.ts +13 -0
- package/src/runtime/iso-city/shadows.js +148 -0
- package/src/runtime/iso-city/traffic.d.ts +80 -0
- package/src/runtime/iso-city/traffic.js +457 -0
- package/src/runtime/iso-city.d.ts +37 -0
- package/src/runtime/iso-city.js +458 -0
- package/src/runtime/lens-map.d.ts +11 -0
- package/src/runtime/lens-map.js +146 -0
- package/src/runtime/light-field.d.ts +29 -0
- package/src/runtime/light-field.js +292 -0
- package/src/runtime/liquid-glass.d.ts +48 -0
- package/src/runtime/liquid-glass.js +423 -0
- package/src/runtime/liquid-metal/beads.js +217 -0
- package/src/runtime/liquid-metal/field.js +88 -0
- package/src/runtime/liquid-metal/look.js +64 -0
- package/src/runtime/liquid-metal/shaders.js +255 -0
- package/src/runtime/liquid-metal/wave.js +53 -0
- package/src/runtime/liquid-metal.d.ts +46 -0
- package/src/runtime/liquid-metal.js +366 -0
- package/src/runtime/loop.d.ts +7 -0
- package/src/runtime/loop.js +112 -0
- package/src/runtime/magnetic.d.ts +9 -0
- package/src/runtime/magnetic.js +46 -0
- package/src/runtime/marquee.d.ts +2 -0
- package/src/runtime/marquee.js +27 -0
- package/src/runtime/mesh.d.ts +30 -0
- package/src/runtime/mesh.js +217 -0
- package/src/runtime/mosaic-reveal.d.ts +34 -0
- package/src/runtime/mosaic-reveal.js +504 -0
- package/src/runtime/motion.d.ts +2 -0
- package/src/runtime/motion.js +21 -0
- package/src/runtime/mount.d.ts +13 -0
- package/src/runtime/mount.js +120 -0
- package/src/runtime/nebula-logo.d.ts +31 -0
- package/src/runtime/nebula-logo.js +282 -0
- package/src/runtime/neon-swarm.d.ts +31 -0
- package/src/runtime/neon-swarm.js +258 -0
- package/src/runtime/ocean/presets.d.ts +54 -0
- package/src/runtime/ocean/presets.js +184 -0
- package/src/runtime/ocean/shader.d.ts +14 -0
- package/src/runtime/ocean/shader.js +389 -0
- package/src/runtime/ocean/view.d.ts +24 -0
- package/src/runtime/ocean/view.js +98 -0
- package/src/runtime/ocean/waves.d.ts +29 -0
- package/src/runtime/ocean/waves.js +119 -0
- package/src/runtime/ocean.d.ts +31 -0
- package/src/runtime/ocean.js +173 -0
- package/src/runtime/palettes.d.ts +37 -0
- package/src/runtime/palettes.js +75 -0
- package/src/runtime/paper-look.d.ts +42 -0
- package/src/runtime/paper-look.js +91 -0
- package/src/runtime/paper-looks.d.ts +17 -0
- package/src/runtime/paper-looks.js +21 -0
- package/src/runtime/paper.d.ts +37 -0
- package/src/runtime/paper.js +303 -0
- package/src/runtime/particle-logo.d.ts +31 -0
- package/src/runtime/particle-logo.js +196 -0
- package/src/runtime/ping-pong.d.ts +43 -0
- package/src/runtime/ping-pong.js +175 -0
- package/src/runtime/pixel-glitch.d.ts +17 -0
- package/src/runtime/pixel-glitch.js +287 -0
- package/src/runtime/point-cloud.d.ts +33 -0
- package/src/runtime/point-cloud.js +287 -0
- package/src/runtime/pointer.d.ts +27 -0
- package/src/runtime/pointer.js +128 -0
- package/src/runtime/points.d.ts +25 -0
- package/src/runtime/points.js +130 -0
- package/src/runtime/pools.d.ts +2 -0
- package/src/runtime/pools.js +25 -0
- package/src/runtime/product-stack.d.ts +24 -0
- package/src/runtime/product-stack.js +210 -0
- package/src/runtime/radiant-glass.d.ts +29 -0
- package/src/runtime/radiant-glass.js +282 -0
- package/src/runtime/rain-on-glass/backdrop.d.ts +22 -0
- package/src/runtime/rain-on-glass/backdrop.js +185 -0
- package/src/runtime/rain-on-glass/shader.d.ts +2 -0
- package/src/runtime/rain-on-glass/shader.js +168 -0
- package/src/runtime/rain-on-glass/wipe.d.ts +16 -0
- package/src/runtime/rain-on-glass/wipe.js +65 -0
- package/src/runtime/rain-on-glass.d.ts +27 -0
- package/src/runtime/rain-on-glass.js +210 -0
- package/src/runtime/ramp.d.ts +2 -0
- package/src/runtime/ramp.js +30 -0
- package/src/runtime/random.d.ts +2 -0
- package/src/runtime/random.js +22 -0
- package/src/runtime/scroll-reveal.d.ts +22 -0
- package/src/runtime/scroll-reveal.js +73 -0
- package/src/runtime/shader-background.d.ts +42 -0
- package/src/runtime/shader-background.js +261 -0
- package/src/runtime/shader-backgrounds/band-lens.js +72 -0
- package/src/runtime/shader-backgrounds/common.js +53 -0
- package/src/runtime/shader-backgrounds/grain-gradient.js +87 -0
- package/src/runtime/shader-backgrounds/grid.js +33 -0
- package/src/runtime/shader-backgrounds/mesh-gradient.js +74 -0
- package/src/runtime/shader-backgrounds/silk.js +57 -0
- package/src/runtime/shader-backgrounds/waves.js +31 -0
- package/src/runtime/shape.d.ts +42 -0
- package/src/runtime/shape.js +313 -0
- package/src/runtime/silk-ribbon.d.ts +23 -0
- package/src/runtime/silk-ribbon.js +206 -0
- package/src/runtime/slideshow.d.ts +27 -0
- package/src/runtime/slideshow.js +234 -0
- package/src/runtime/spotlight.d.ts +9 -0
- package/src/runtime/spotlight.js +97 -0
- package/src/runtime/stack-poses.d.ts +53 -0
- package/src/runtime/stack-poses.js +273 -0
- package/src/runtime/stage.d.ts +47 -0
- package/src/runtime/stage.js +187 -0
- package/src/runtime/swarm.d.ts +49 -0
- package/src/runtime/swarm.js +199 -0
- package/src/runtime/text-motion.d.ts +41 -0
- package/src/runtime/text-motion.js +165 -0
- package/src/runtime/text.d.ts +11 -0
- package/src/runtime/text.js +90 -0
- package/src/runtime/tilt.d.ts +19 -0
- package/src/runtime/tilt.js +116 -0
- package/src/runtime/topography.d.ts +71 -0
- package/src/runtime/topography.js +650 -0
- package/src/runtime/trackers.d.ts +21 -0
- package/src/runtime/trackers.js +76 -0
- package/src/runtime/variable-type.d.ts +43 -0
- package/src/runtime/variable-type.js +358 -0
- package/src/runtime/voxel-logo.d.ts +31 -0
- package/src/runtime/voxel-logo.js +237 -0
- package/src/runtime/waves.d.ts +70 -0
- package/src/runtime/waves.js +799 -0
- package/src/runtime/world-labels.d.ts +29 -0
- package/src/runtime/world-labels.js +59 -0
- package/src/runtime/world-land.d.ts +8 -0
- package/src/runtime/world-land.js +105 -0
- package/src/runtime/world-map.d.ts +69 -0
- package/src/runtime/world-map.js +308 -0
- package/src/runtime/world-plan.d.ts +101 -0
- package/src/runtime/world-plan.js +333 -0
- package/src/runtime/world-routes.d.ts +75 -0
- package/src/runtime/world-routes.js +673 -0
- package/src/styles/border-sweep.css +82 -0
- package/src/styles/glass.css +104 -0
- package/src/styles/motion.css +218 -0
- package/src/styles/reveal.css +51 -0
- package/src/vendor/paper/LICENSE +201 -0
- package/src/vendor/paper/NOTICE +5 -0
- package/src/vendor/paper/README.md +8 -0
- package/src/vendor/paper/get-shader-color-from-string.js +100 -0
- package/src/vendor/paper/get-shader-noise-texture.js +17 -0
- package/src/vendor/paper/presets.js +3678 -0
- package/src/vendor/paper/shader-sizing.js +37 -0
- package/src/vendor/paper/shader-utils.js +130 -0
- package/src/vendor/paper/shaders/color-panels.js +223 -0
- package/src/vendor/paper/shaders/dithering.js +270 -0
- package/src/vendor/paper/shaders/dot-grid.js +109 -0
- package/src/vendor/paper/shaders/dot-orbit.js +122 -0
- package/src/vendor/paper/shaders/fluted-glass.js +360 -0
- package/src/vendor/paper/shaders/gem-smoke.js +572 -0
- package/src/vendor/paper/shaders/god-rays.js +132 -0
- package/src/vendor/paper/shaders/grain-gradient.js +300 -0
- package/src/vendor/paper/shaders/halftone-cmyk.js +294 -0
- package/src/vendor/paper/shaders/halftone-dots.js +320 -0
- package/src/vendor/paper/shaders/heatmap.js +383 -0
- package/src/vendor/paper/shaders/image-dithering.js +198 -0
- package/src/vendor/paper/shaders/lens-distortion.js +275 -0
- package/src/vendor/paper/shaders/liquid-metal.js +632 -0
- package/src/vendor/paper/shaders/mesh-gradient.js +130 -0
- package/src/vendor/paper/shaders/metaballs.js +110 -0
- package/src/vendor/paper/shaders/neuro-noise.js +76 -0
- package/src/vendor/paper/shaders/paper-texture.js +526 -0
- package/src/vendor/paper/shaders/perlin-noise.js +166 -0
- package/src/vendor/paper/shaders/pulsing-border.js +238 -0
- package/src/vendor/paper/shaders/simplex-noise.js +91 -0
- package/src/vendor/paper/shaders/smoke-ring.js +132 -0
- package/src/vendor/paper/shaders/spiral.js +82 -0
- package/src/vendor/paper/shaders/static-mesh-gradient.js +130 -0
- package/src/vendor/paper/shaders/static-radial-gradient.js +187 -0
- package/src/vendor/paper/shaders/swirl.js +103 -0
- package/src/vendor/paper/shaders/voronoi.js +138 -0
- package/src/vendor/paper/shaders/warp.js +129 -0
- package/src/vendor/paper/shaders/water.js +121 -0
- package/src/vendor/paper/shaders/waves.js +65 -0
- package/src/vendor/paper/vertex-shader.js +159 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @arraypress/effects-astro/rain-on-glass/wipe
|
|
3
|
+
*
|
|
4
|
+
* Where the pointer has wiped the fog off the glass: a coarse grid that a
|
|
5
|
+
* soft brush clears along each stroke and that fogs back over, from the
|
|
6
|
+
* edges of each patch inwards, a few seconds later.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** How clear a fresh wipe is: over 1, so its middle holds clear a moment before fading. */
|
|
10
|
+
const FRESH = 1.6;
|
|
11
|
+
/** How fast the fog returns, in clearness a second. */
|
|
12
|
+
const RETURN = 0.36;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {object} Wipe
|
|
16
|
+
* @property {number} width Cells across.
|
|
17
|
+
* @property {number} height Cells up.
|
|
18
|
+
* @property {(x: number, y: number, radius: number) => void} stamp Wipes a soft spot at x, y (0–1, y up), `radius` a share of the height.
|
|
19
|
+
* @property {(dt: number) => boolean} settle Lets the fog return for `dt` seconds; true when `bytes` changed (upload them), false while the glass stays all fogged.
|
|
20
|
+
* @property {Uint8Array} bytes Clearness per cell, 0–255, bottom row first: for a LUMINANCE texture.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Makes a wipe grid.
|
|
25
|
+
*
|
|
26
|
+
* @param {number} width Cells across.
|
|
27
|
+
* @param {number} height Cells up.
|
|
28
|
+
* @returns {Wipe} The grid, all fogged.
|
|
29
|
+
*/
|
|
30
|
+
export function createWipe(width, height) {
|
|
31
|
+
const clear = new Float32Array(width * height);
|
|
32
|
+
const bytes = new Uint8Array(width * height);
|
|
33
|
+
let active = false;
|
|
34
|
+
return {
|
|
35
|
+
width,
|
|
36
|
+
height,
|
|
37
|
+
bytes,
|
|
38
|
+
stamp(x, y, radius) {
|
|
39
|
+
const r = Math.max(1, radius * height);
|
|
40
|
+
const cx = x * width;
|
|
41
|
+
const cy = y * height;
|
|
42
|
+
for (let j = Math.max(0, Math.floor(cy - r)); j <= Math.min(height - 1, Math.ceil(cy + r)); j++) {
|
|
43
|
+
for (let i = Math.max(0, Math.floor(cx - r)); i <= Math.min(width - 1, Math.ceil(cx + r)); i++) {
|
|
44
|
+
const d = Math.hypot(i + 0.5 - cx, j + 0.5 - cy) / r;
|
|
45
|
+
if (d >= 1) continue;
|
|
46
|
+
const k = 1 - d * d;
|
|
47
|
+
clear[j * width + i] = Math.max(clear[j * width + i], FRESH * k * k * (3 - 2 * k));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
active = true;
|
|
51
|
+
},
|
|
52
|
+
settle(dt) {
|
|
53
|
+
if (!active) return false;
|
|
54
|
+
active = false;
|
|
55
|
+
const step = RETURN * dt;
|
|
56
|
+
for (let i = 0; i < clear.length; i++) {
|
|
57
|
+
const v = Math.max(0, clear[i] - step);
|
|
58
|
+
clear[i] = v;
|
|
59
|
+
bytes[i] = Math.min(255, Math.round(v * 255));
|
|
60
|
+
if (v > 0) active = true;
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PaletteName } from './palettes.js';
|
|
2
|
+
|
|
3
|
+
export interface RainOnGlassConfig {
|
|
4
|
+
/** The photo behind the glass (same origin, or served with CORS). */
|
|
5
|
+
src: string;
|
|
6
|
+
/** How much rain, 0–1: beads on the glass and drops running down it. Default 0.6. */
|
|
7
|
+
rain?: number;
|
|
8
|
+
/** How soft the photo is behind the glass, 0–1. Default 0.6. */
|
|
9
|
+
blur?: number;
|
|
10
|
+
/** How thick the condensation is, 0–1. Default 0.5. */
|
|
11
|
+
fog?: number;
|
|
12
|
+
/** How fast the drops run and the beads come and go, 0–3. Default 1. */
|
|
13
|
+
speed?: number;
|
|
14
|
+
/** The pointer wipes a clear patch that fogs back over. Default true. */
|
|
15
|
+
interactive?: boolean;
|
|
16
|
+
/** The colour of the fog. Default `#a3b8cc`. */
|
|
17
|
+
tint?: string;
|
|
18
|
+
/** How strongly the photo's lights open into bokeh discs, 0–1. Default 0.6. */
|
|
19
|
+
bokeh?: number;
|
|
20
|
+
/** Colours for the bokeh discs. Default: each light's own colour. */
|
|
21
|
+
colors?: string[];
|
|
22
|
+
/** A shared palette by name (`PALETTES`, any case), when there are no `colors`. */
|
|
23
|
+
palette?: PaletteName | (string & {});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Starts rain on glass in `el`'s canvas. Returns a function that stops it. */
|
|
27
|
+
export function rainOnGlass(el: HTMLElement, config: RainOnGlassConfig): () => void;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @arraypress/effects-astro/rain-on-glass
|
|
3
|
+
*
|
|
4
|
+
* Rain on a window over a photo, like looking out of a café on a wet
|
|
5
|
+
* evening. Small beads sit on the glass; larger drops slide down it in
|
|
6
|
+
* fits and starts, leaving clear trails that bead up and fog over again.
|
|
7
|
+
* Each drop is a little lens, holding the photo sharp and upside down; the
|
|
8
|
+
* rest of the photo is soft behind the condensation, its lights opened
|
|
9
|
+
* into bokeh. The pointer wipes a clear patch that fogs back over.
|
|
10
|
+
*
|
|
11
|
+
* Transparent until the photo has loaded, then fading in over the `<img>`
|
|
12
|
+
* under it (the component's), which is what shows without WebGL. With
|
|
13
|
+
* reduced motion it is one still frame, drops and all.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { createStage } from './stage.js';
|
|
17
|
+
import { parseColor } from './color.js';
|
|
18
|
+
import { trail } from './pointer.js';
|
|
19
|
+
import { watchColors } from './mount.js';
|
|
20
|
+
import { pickColors } from './palettes.js';
|
|
21
|
+
import { loadImage, imageTexture, coverScale } from './image.js';
|
|
22
|
+
import { backdrop } from './rain-on-glass/backdrop.js';
|
|
23
|
+
import { createWipe } from './rain-on-glass/wipe.js';
|
|
24
|
+
import { FRAG } from './rain-on-glass/shader.js';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {object} RainOnGlassConfig
|
|
28
|
+
* @property {string} src The photo behind the glass (same origin, or served with CORS).
|
|
29
|
+
* @property {number} [rain=0.6] How much rain, 0–1: beads on the glass and drops running down it.
|
|
30
|
+
* @property {number} [blur=0.6] How soft the photo is behind the glass, 0–1.
|
|
31
|
+
* @property {number} [fog=0.5] How thick the condensation is, 0–1.
|
|
32
|
+
* @property {number} [speed=1] How fast the drops run and the beads come and go, 0–3.
|
|
33
|
+
* @property {boolean} [interactive=true] The pointer wipes a clear patch that fogs back over.
|
|
34
|
+
* @property {string} [tint='#a3b8cc'] The colour of the fog.
|
|
35
|
+
* @property {number} [bokeh=0.6] How strongly the photo's lights open into bokeh discs, 0–1.
|
|
36
|
+
* @property {string[]} [colors] Colours for the bokeh discs (default: each light's own).
|
|
37
|
+
* @property {string} [palette] A shared palette by name (PALETTES; any case), when there are no `colors`.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/** CSS pixels to a unit of glass, the scale the drops are sized in. */
|
|
41
|
+
const UNIT = 720;
|
|
42
|
+
/** Seconds into the rain the first frame is, so it opens mid-shower; and the moment the still frame shows. */
|
|
43
|
+
const OPENING = 40;
|
|
44
|
+
/** The wiping brush's radius, CSS pixels. */
|
|
45
|
+
const BRUSH = 58;
|
|
46
|
+
/** Seconds the canvas takes to fade in over the `<img>` once the photo has loaded. */
|
|
47
|
+
const FADE = 0.9;
|
|
48
|
+
/** Cells across the wipe grid. */
|
|
49
|
+
const WIPE_CELLS = 96;
|
|
50
|
+
/** The largest side the photo is put on the GPU at, pixels. */
|
|
51
|
+
const LARGEST = 2560;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Starts rain on glass on an element: a canvas inside it, filling it.
|
|
55
|
+
*
|
|
56
|
+
* @param {HTMLElement} el The element (its first canvas is drawn into).
|
|
57
|
+
* @param {RainOnGlassConfig} config The settings.
|
|
58
|
+
* @returns {() => void} Stops it.
|
|
59
|
+
*/
|
|
60
|
+
export function rainOnGlass(el, config) {
|
|
61
|
+
const speed = config.speed ?? 1;
|
|
62
|
+
const blur = clamp01(config.blur ?? 0.6);
|
|
63
|
+
const bokeh = clamp01(config.bokeh ?? 0.6);
|
|
64
|
+
const interactive = config.interactive ?? true;
|
|
65
|
+
let colors = pickColors(config, []);
|
|
66
|
+
const strokes = trail(el, { step: 0.01, max: 24 });
|
|
67
|
+
const start = performance.now();
|
|
68
|
+
/** @type {HTMLImageElement | null} */
|
|
69
|
+
let photo = null;
|
|
70
|
+
/** @type {WebGLTexture | null} */
|
|
71
|
+
let softTexture = null;
|
|
72
|
+
/** @type {WebGLTexture | null} */
|
|
73
|
+
let photoTexture = null;
|
|
74
|
+
/** @type {WebGLTexture | null} */
|
|
75
|
+
let wipeTexture = null;
|
|
76
|
+
let wipe = createWipe(1, 1);
|
|
77
|
+
let shown = 0;
|
|
78
|
+
let stopped = false;
|
|
79
|
+
|
|
80
|
+
const { stage, stop } = createStage(el, {
|
|
81
|
+
fragment: FRAG,
|
|
82
|
+
setup({ gl, uniform }) {
|
|
83
|
+
gl.uniform1i(uniform('uPhoto'), 0);
|
|
84
|
+
gl.uniform1i(uniform('uSoft'), 1);
|
|
85
|
+
gl.uniform1i(uniform('uWipe'), 2);
|
|
86
|
+
gl.uniform1f(uniform('uRain'), clamp01(config.rain ?? 0.6));
|
|
87
|
+
gl.uniform1f(uniform('uFog'), clamp01(config.fog ?? 0.5));
|
|
88
|
+
gl.uniform1f(uniform('uClearBias'), 0.5 + blur * 1.5);
|
|
89
|
+
gl.uniform3fv(uniform('uTint'), parseColor(config.tint ?? '#a3b8cc'));
|
|
90
|
+
gl.activeTexture(gl.TEXTURE2);
|
|
91
|
+
wipeTexture = gl.createTexture();
|
|
92
|
+
gl.bindTexture(gl.TEXTURE_2D, wipeTexture);
|
|
93
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
94
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
95
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
96
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
97
|
+
return () => [photoTexture, softTexture, wipeTexture].forEach((t) => gl.deleteTexture(t));
|
|
98
|
+
},
|
|
99
|
+
resize(s) {
|
|
100
|
+
s.gl.uniform1f(s.uniform('uUnit'), s.ratio * UNIT);
|
|
101
|
+
fit(s);
|
|
102
|
+
// A fresh, fogged wipe grid in the canvas's proportions.
|
|
103
|
+
wipe = createWipe(WIPE_CELLS, Math.min(240, Math.max(12, Math.round((WIPE_CELLS * s.canvas.height) / s.canvas.width))));
|
|
104
|
+
upload(s.gl, true);
|
|
105
|
+
},
|
|
106
|
+
uniforms({ gl, uniform, still }, now, dt) {
|
|
107
|
+
if (photo && shown < 1) {
|
|
108
|
+
shown = still ? 1 : Math.min(1, shown + dt / FADE);
|
|
109
|
+
if (shown === 1) el.dataset.drawn = '';
|
|
110
|
+
}
|
|
111
|
+
if (interactive && !still) {
|
|
112
|
+
const radius = BRUSH / Math.max(1, el.clientHeight);
|
|
113
|
+
for (const p of strokes.read(dt)) wipe.stamp(p.x, p.y, radius);
|
|
114
|
+
}
|
|
115
|
+
if (wipe.settle(dt)) upload(gl, false);
|
|
116
|
+
gl.uniform1f(uniform('uTime'), OPENING + (still ? 0 : ((now - start) / 1000) * speed));
|
|
117
|
+
gl.uniform1f(uniform('uShow'), shown * shown * (3 - 2 * shown));
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
if (!stage) return stop;
|
|
121
|
+
const { gl } = stage;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Sets how the photo is cropped to cover the canvas, once it has loaded.
|
|
125
|
+
*
|
|
126
|
+
* @param {import('./stage.js').Stage} s The stage.
|
|
127
|
+
*/
|
|
128
|
+
function fit(s) {
|
|
129
|
+
if (!photo) return;
|
|
130
|
+
s.gl.useProgram(s.program);
|
|
131
|
+
s.gl.uniform2fv(s.uniform('uCover'), coverScale(photo.width / photo.height, s.canvas.width / s.canvas.height));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Puts the wipe grid on the GPU.
|
|
136
|
+
*
|
|
137
|
+
* @param {import('./gl.js').GL} gl The context.
|
|
138
|
+
* @param {boolean} fresh The grid is new (a new size): allocate the texture again.
|
|
139
|
+
*/
|
|
140
|
+
function upload(gl, fresh) {
|
|
141
|
+
gl.activeTexture(gl.TEXTURE2);
|
|
142
|
+
gl.bindTexture(gl.TEXTURE_2D, wipeTexture);
|
|
143
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);
|
|
144
|
+
if (fresh) gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, wipe.width, wipe.height, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, wipe.bytes);
|
|
145
|
+
else gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, wipe.width, wipe.height, gl.LUMINANCE, gl.UNSIGNED_BYTE, wipe.bytes);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Makes the soft, bokeh'd copy of the photo in the current colours and puts it on the GPU. */
|
|
149
|
+
function soften() {
|
|
150
|
+
if (!photo) return;
|
|
151
|
+
gl.activeTexture(gl.TEXTURE1);
|
|
152
|
+
gl.deleteTexture(softTexture);
|
|
153
|
+
softTexture = imageTexture(gl, backdrop(photo, { blur, bokeh, colors }));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
loadImage(config.src)
|
|
157
|
+
.then((img) => {
|
|
158
|
+
if (stopped) return;
|
|
159
|
+
photo = img;
|
|
160
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
161
|
+
photoTexture = imageTexture(gl, within(img, Math.min(LARGEST, gl.getParameter(gl.MAX_TEXTURE_SIZE))), { mipmap: true });
|
|
162
|
+
soften();
|
|
163
|
+
fit(stage);
|
|
164
|
+
if (stage.still) stage.redraw();
|
|
165
|
+
})
|
|
166
|
+
.catch((error) => {
|
|
167
|
+
console.warn('[effects-astro]', error);
|
|
168
|
+
stop();
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const unwatch = watchColors(el, (next) => {
|
|
172
|
+
colors = next.colors;
|
|
173
|
+
soften();
|
|
174
|
+
if (stage.still) stage.redraw();
|
|
175
|
+
});
|
|
176
|
+
return () => {
|
|
177
|
+
stopped = true;
|
|
178
|
+
stop();
|
|
179
|
+
unwatch();
|
|
180
|
+
delete el.dataset.drawn;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* A picture no larger than `largest` on either side: itself, or a copy
|
|
186
|
+
* scaled down on a canvas.
|
|
187
|
+
*
|
|
188
|
+
* @param {HTMLImageElement} img The picture.
|
|
189
|
+
* @param {number} largest The most pixels a side may have.
|
|
190
|
+
* @returns {HTMLImageElement | HTMLCanvasElement} It, or its smaller copy.
|
|
191
|
+
*/
|
|
192
|
+
function within(img, largest) {
|
|
193
|
+
const scale = largest / Math.max(img.width, img.height);
|
|
194
|
+
if (scale >= 1) return img;
|
|
195
|
+
const canvas = document.createElement('canvas');
|
|
196
|
+
canvas.width = Math.round(img.width * scale);
|
|
197
|
+
canvas.height = Math.round(img.height * scale);
|
|
198
|
+
canvas.getContext('2d')?.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
199
|
+
return canvas;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Clamps a number to 0–1.
|
|
204
|
+
*
|
|
205
|
+
* @param {number} n The number.
|
|
206
|
+
* @returns {number} It, clamped.
|
|
207
|
+
*/
|
|
208
|
+
function clamp01(n) {
|
|
209
|
+
return Math.min(1, Math.max(0, n));
|
|
210
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @arraypress/effects-astro/ramp
|
|
3
|
+
*
|
|
4
|
+
* A gradient for shaders: up to MAX_COLORS colours in Oklab (from
|
|
5
|
+
* `gradientUniform`), read at any point from the first to the last. Each
|
|
6
|
+
* stretch between two colours is blended in Oklab, so a ramp from navy to
|
|
7
|
+
* sand never passes through grey.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { MAX_COLORS } from './dot-surface.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* GLSL (ES 1.00): `uniform vec3 uRamp[MAX_COLORS]` (Oklab, from
|
|
14
|
+
* `gradientUniform`), `uniform float uRamps` (how many are set) and
|
|
15
|
+
* `vec3 ramp(float t)`, the gradient at t (0 the first colour, 1 the
|
|
16
|
+
* last), in Oklab.
|
|
17
|
+
*/
|
|
18
|
+
export const GLSL_RAMP = `
|
|
19
|
+
uniform vec3 uRamp[${MAX_COLORS}];
|
|
20
|
+
uniform float uRamps;
|
|
21
|
+
vec3 ramp(float t) {
|
|
22
|
+
float x = clamp(t, 0.0, 1.0) * (uRamps - 1.0);
|
|
23
|
+
float i = min(floor(x), max(uRamps - 2.0, 0.0));
|
|
24
|
+
vec3 a = uRamp[0], b = uRamp[0];
|
|
25
|
+
for (int n = 0; n < ${MAX_COLORS - 1}; n++) {
|
|
26
|
+
if (float(n) == i) { a = uRamp[n]; b = uRamp[n + 1]; }
|
|
27
|
+
}
|
|
28
|
+
return uRamps > 1.0 ? mix(a, b, x - i) : a;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @arraypress/effects-astro/random
|
|
3
|
+
*
|
|
4
|
+
* A small seeded random generator (mulberry32), for effects that build
|
|
5
|
+
* something from a `seed` and must build the same thing on every load.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Makes a seeded generator: the same seed gives the same sequence.
|
|
10
|
+
*
|
|
11
|
+
* @param {number} seed Any number; its integer part is used.
|
|
12
|
+
* @returns {() => number} The next value, 0 (inclusive) to 1 (exclusive).
|
|
13
|
+
*/
|
|
14
|
+
export function seededRandom(seed) {
|
|
15
|
+
let s = Math.floor(seed) >>> 0;
|
|
16
|
+
return () => {
|
|
17
|
+
s = (s + 0x6d2b79f5) >>> 0;
|
|
18
|
+
let t = Math.imul(s ^ (s >>> 15), 1 | s);
|
|
19
|
+
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
20
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** The classes reveal.css styles, as a selector list. */
|
|
2
|
+
export const REVEAL_CLASSES: string;
|
|
3
|
+
|
|
4
|
+
export interface ScrollRevealConfig {
|
|
5
|
+
/** What to reveal. Default the reveal.css classes. */
|
|
6
|
+
selector?: string;
|
|
7
|
+
/** The class added on arrival. Default `is-visible`. */
|
|
8
|
+
visibleClass?: string;
|
|
9
|
+
/** How much must be in view, 0–1. Default 0.08. */
|
|
10
|
+
threshold?: number;
|
|
11
|
+
/** The observer's margin. Default `0px 0px -10% 0px`. */
|
|
12
|
+
rootMargin?: string;
|
|
13
|
+
/** Reveal once; false hides it again when it leaves, to replay. Default true. */
|
|
14
|
+
once?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Adds `visibleClass` to each matching element as it scrolls into view
|
|
19
|
+
* (at once if already on screen), and marks the page `.fx-reveal`. Calling
|
|
20
|
+
* it again replaces the previous run. Returns a function that stops it.
|
|
21
|
+
*/
|
|
22
|
+
export function scrollReveal(config?: ScrollRevealConfig): () => void;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @arraypress/effects-astro/scroll-reveal
|
|
3
|
+
*
|
|
4
|
+
* Scroll reveal for a whole page from one IntersectionObserver: every
|
|
5
|
+
* element matching the selector gets a class (`is-visible`) as it scrolls
|
|
6
|
+
* into view, and the stylesheet (reveal.css, or your own) animates it
|
|
7
|
+
* there. Elements already on screen are shown at once, so nothing
|
|
8
|
+
* flashes. Marks the page `.fx-reveal` so that, until it runs, nothing is
|
|
9
|
+
* hidden. With prefers-reduced-motion it does nothing, and all shows.
|
|
10
|
+
*
|
|
11
|
+
* Runs again after each Astro view transition, picking up only the
|
|
12
|
+
* elements not yet shown.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { prefersReducedMotion } from './device.js';
|
|
16
|
+
|
|
17
|
+
/** The classes reveal.css styles. */
|
|
18
|
+
export const REVEAL_CLASSES =
|
|
19
|
+
'.fade-in, .fade-in-up, .fade-in-down, .fade-in-left, .fade-in-right, .slide-in-up, .slide-in-down, .slide-in-left, .slide-in-right, .zoom-in, .zoom-out, .flip-up, .flip-down, .flip-left, .flip-right, .blur-in';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {object} ScrollRevealConfig
|
|
23
|
+
* @property {string} [selector] What to reveal. Default the reveal.css classes.
|
|
24
|
+
* @property {string} [visibleClass='is-visible'] The class added on arrival.
|
|
25
|
+
* @property {number} [threshold=0.08] How much must be in view, 0–1.
|
|
26
|
+
* @property {string} [rootMargin='0px 0px -10% 0px'] The observer's margin.
|
|
27
|
+
* @property {boolean} [once=true] Reveal once; false hides it again when it leaves, to replay.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** @type {IntersectionObserver | null} */
|
|
31
|
+
let observer = null;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Starts revealing the page's matching elements (again, after a view
|
|
35
|
+
* transition: the previous observer is let go).
|
|
36
|
+
*
|
|
37
|
+
* @param {ScrollRevealConfig} [config] The settings.
|
|
38
|
+
* @returns {() => void} Stops it.
|
|
39
|
+
*/
|
|
40
|
+
export function scrollReveal(config = {}) {
|
|
41
|
+
const visible = config.visibleClass ?? 'is-visible';
|
|
42
|
+
const once = config.once !== false;
|
|
43
|
+
observer?.disconnect();
|
|
44
|
+
observer = null;
|
|
45
|
+
if (prefersReducedMotion() || typeof IntersectionObserver === 'undefined') return () => {};
|
|
46
|
+
document.documentElement.classList.add('fx-reveal');
|
|
47
|
+
|
|
48
|
+
const watcher = new IntersectionObserver(
|
|
49
|
+
(entries) => {
|
|
50
|
+
for (const entry of entries) {
|
|
51
|
+
if (entry.isIntersecting) {
|
|
52
|
+
entry.target.classList.add(visible);
|
|
53
|
+
if (once) watcher.unobserve(entry.target);
|
|
54
|
+
} else if (!once) {
|
|
55
|
+
entry.target.classList.remove(visible);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{ threshold: config.threshold ?? 0.08, rootMargin: config.rootMargin ?? '0px 0px -10% 0px' },
|
|
60
|
+
);
|
|
61
|
+
observer = watcher;
|
|
62
|
+
|
|
63
|
+
const pending = (config.selector ?? REVEAL_CLASSES)
|
|
64
|
+
.split(',')
|
|
65
|
+
.map((part) => `${part.trim()}:not(.${visible})`)
|
|
66
|
+
.join(',');
|
|
67
|
+
document.querySelectorAll(pending).forEach((el) => {
|
|
68
|
+
const box = el.getBoundingClientRect();
|
|
69
|
+
if (box.top < innerHeight && box.bottom > 0) el.classList.add(visible);
|
|
70
|
+
else watcher.observe(el);
|
|
71
|
+
});
|
|
72
|
+
return () => watcher.disconnect();
|
|
73
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PaletteName } from './palettes.js';
|
|
2
|
+
import type { Rgb } from './color.js';
|
|
3
|
+
|
|
4
|
+
/** The six shader backgrounds. */
|
|
5
|
+
export type ShaderBackgroundName = 'mesh-gradient' | 'grain-gradient' | 'silk' | 'band-lens' | 'grid' | 'waves';
|
|
6
|
+
|
|
7
|
+
export interface ShaderBackgroundConfig {
|
|
8
|
+
/** Which shader background. */
|
|
9
|
+
effect: ShaderBackgroundName;
|
|
10
|
+
/** Up to four colours (hex or `rgb()`); those missing come from `--color-accent` where it sits: the accent, the accent towards `--color-bg`, its hue turned 30° towards yellow and lifted, its hue turned 45° away from yellow (in Oklab). Only mesh-gradient, grain-gradient and silk use the fourth. Default all four from the accent. */
|
|
11
|
+
colors?: string[];
|
|
12
|
+
/** A shared palette by name (`PALETTES`, any case), when there are no `colors`. */
|
|
13
|
+
palette?: PaletteName | (string & {});
|
|
14
|
+
/** How fast it moves, 0–4. Default 1. */
|
|
15
|
+
speed?: number;
|
|
16
|
+
/** How strong it is (brightness and contrast, not opacity), 0–2. Default 1. */
|
|
17
|
+
intensity?: number;
|
|
18
|
+
/** One frame, never the loop: for a shader background that is wallpaper. Default false. */
|
|
19
|
+
static?: boolean;
|
|
20
|
+
/** With `static`, the moment drawn, in seconds. Default 12. */
|
|
21
|
+
frame?: number;
|
|
22
|
+
/** Lean towards the pointer, on devices that hover. Default false. */
|
|
23
|
+
interactive?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Every shader background's fragment shader, by name. */
|
|
27
|
+
export const SHADER_BACKGROUNDS: Record<ShaderBackgroundName, string>;
|
|
28
|
+
|
|
29
|
+
/** Reads `#rgb`, `#rrggbb` or `rgb()`/`rgba()`; null for anything else. */
|
|
30
|
+
export function readColor(value: string): Rgb | null;
|
|
31
|
+
|
|
32
|
+
/** The four colours: those given (unreadable ones skipped), the rest derived from the accent and background tokens. */
|
|
33
|
+
export function shaderBackgroundPalette(from: { accent?: string; background?: string; colors?: string[] }): [Rgb, Rgb, Rgb, Rgb];
|
|
34
|
+
|
|
35
|
+
/** Speed (0–4, default 1), intensity (0–2, default 1) and the still frame (default 12), read and clamped. */
|
|
36
|
+
export function shaderBackgroundSettings(config: Partial<ShaderBackgroundConfig>): { speed: number; intensity: number; frame: number };
|
|
37
|
+
|
|
38
|
+
/** The CSS `background` that stands in without WebGL: soft pools of the first and third colours. */
|
|
39
|
+
export function shaderBackgroundFallback(palette: Rgb[]): string;
|
|
40
|
+
|
|
41
|
+
/** Starts a shader background in `el`'s canvas. Returns a function that stops it. */
|
|
42
|
+
export function shaderBackground(el: HTMLElement, config: ShaderBackgroundConfig): () => void;
|