@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,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* VariableType: a headline in a variable font whose letters swell under
|
|
4
|
+
* the pointer, heavier and wider in a smooth wave, and ease back when it
|
|
5
|
+
* leaves; with nothing over it, a gentle swell travels along the line.
|
|
6
|
+
* For a type foundry, or any bold brand. The text stays real text. See
|
|
7
|
+
* src/runtime/variable-type.js.
|
|
8
|
+
*
|
|
9
|
+
* Set it in a variable font with the axes it moves (CSS `font-family`).
|
|
10
|
+
* Each letter carries `--swell` (0 rest, 1 peak), so CSS can follow it:
|
|
11
|
+
* `color: color-mix(in oklab, currentColor, #ff5a1f calc(var(--swell) * 100%))`.
|
|
12
|
+
* A swell widens the line, so leave it room; with `fit`, the line is sized
|
|
13
|
+
* so that at its widest swell it spans its parent's width.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <VariableType as="h1" fit>Torsion</VariableType>
|
|
17
|
+
* <VariableType as="h2" axes={{ wght: [300, 1000], wdth: [100, 151], slnt: [0, -10] }}>Bend</VariableType>
|
|
18
|
+
*/
|
|
19
|
+
import type { HTMLTag } from 'astro/types';
|
|
20
|
+
import type { VariableTypeConfig } from '../runtime/variable-type.js';
|
|
21
|
+
import { axisList, variation } from '../runtime/variable-type.js';
|
|
22
|
+
import { withStyle } from './style.js';
|
|
23
|
+
|
|
24
|
+
interface Props extends VariableTypeConfig {
|
|
25
|
+
/** The element to render. Default `div`. */
|
|
26
|
+
as?: HTMLTag;
|
|
27
|
+
class?: string;
|
|
28
|
+
[attribute: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { as: Tag = 'div', axes, radius, falloff, idle, fit = false, class: className, style: given, ...attributes } = Astro.props;
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<Tag
|
|
35
|
+
class:list={['effect-variable-type', { 'is-fit': fit }, className]}
|
|
36
|
+
data-effect-variable-type
|
|
37
|
+
data-effect-config={JSON.stringify({ axes, radius, falloff, idle, fit })}
|
|
38
|
+
style={withStyle(`font-variation-settings: ${variation(axisList(axes), 0)}`, given)}
|
|
39
|
+
{...attributes}
|
|
40
|
+
>
|
|
41
|
+
<slot />
|
|
42
|
+
</Tag>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
import { mount } from '../runtime/mount.js';
|
|
46
|
+
import { variableType } from '../runtime/variable-type.js';
|
|
47
|
+
|
|
48
|
+
mount('[data-effect-variable-type]', variableType);
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.effect-variable-type {
|
|
53
|
+
/* A finger dragged across the line swells it; up and down still scrolls. */
|
|
54
|
+
touch-action: pan-y;
|
|
55
|
+
}
|
|
56
|
+
.is-fit {
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* VoxelLogo: a logo or character built of cubes, rocking slowly in
|
|
4
|
+
* perspective and turning towards the pointer, outlined where cubes meet
|
|
5
|
+
* and dithered down to two inks. With `markers`, tracking markers ring it.
|
|
6
|
+
* See src/runtime/voxel-logo.js.
|
|
7
|
+
*
|
|
8
|
+
* Opaque: it is the whole background of what it fills (its nearest
|
|
9
|
+
* positioned ancestor, or the viewport with `fixed`). Without WebGL the
|
|
10
|
+
* paper colour shows. Set `--effect-tracker-color` on it to colour any
|
|
11
|
+
* markers (the ink colour suits).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <section class="cta" style="position: relative">
|
|
15
|
+
* <VoxelLogo text="✳" colors={['#a7f3d0', '#08090a']} />
|
|
16
|
+
* <h2>Your next release starts here.</h2>
|
|
17
|
+
* </section>
|
|
18
|
+
*/
|
|
19
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
20
|
+
import type { VoxelLogoConfig } from '../runtime/voxel-logo.js';
|
|
21
|
+
|
|
22
|
+
interface Props extends VoxelLogoConfig {
|
|
23
|
+
/** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
|
|
24
|
+
fixed?: boolean;
|
|
25
|
+
class?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { fixed = false, class: className, ...config } = Astro.props;
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<EffectCanvas
|
|
32
|
+
name="voxel-logo"
|
|
33
|
+
config={config}
|
|
34
|
+
fixed={fixed}
|
|
35
|
+
class={className}
|
|
36
|
+
behind
|
|
37
|
+
pixelated
|
|
38
|
+
background={config.colors?.[1] ?? '#08090a'}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import { mount } from '../runtime/mount.js';
|
|
43
|
+
import { voxelLogo } from '../runtime/voxel-logo.js';
|
|
44
|
+
|
|
45
|
+
mount('[data-effect-voxel-logo]', voxelLogo);
|
|
46
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* WaveBars: a glowing bar waveform over its reflection, retuning every couple of seconds like a meter (peak marks that hold and drop), with a playhead sweeping across that lights and kicks the bars it plays, and the pointer scrubbing. A quiet audio motif for behind a hero's copy.
|
|
4
|
+
* See src/runtime/waves.js.
|
|
5
|
+
*
|
|
6
|
+
* Transparent, with its left and right edges faded out (`fade`). Fills its
|
|
7
|
+
* nearest positioned ancestor. Still with reduced motion. WebGL; without
|
|
8
|
+
* it the canvas is removed and the section shows.
|
|
9
|
+
*
|
|
10
|
+
* With `audio` (`"page"`, or a selector for an `<audio>` or a WaveformPlayer)
|
|
11
|
+
* the bars show the sound's spectrum and the playhead follows the track;
|
|
12
|
+
* while nothing plays they keep their own motion.
|
|
13
|
+
*
|
|
14
|
+
* From the waveform-player site.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <section class="hero" style="position: relative">
|
|
18
|
+
* <WaveBars />
|
|
19
|
+
* <h1>…</h1>
|
|
20
|
+
* </section>
|
|
21
|
+
*/
|
|
22
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
23
|
+
import type { WaveBarsConfig } from '../runtime/waves.js';
|
|
24
|
+
|
|
25
|
+
interface Props extends WaveBarsConfig {
|
|
26
|
+
/** Fade the left and right edges out. Default true. */
|
|
27
|
+
fade?: boolean;
|
|
28
|
+
class?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { fade = true, class: className, ...config } = Astro.props;
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<EffectCanvas name="wave-bars" config={config} class={className} fade={fade} />
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import { mount } from '../runtime/mount.js';
|
|
38
|
+
import { waveBars } from '../runtime/waves.js';
|
|
39
|
+
|
|
40
|
+
mount('[data-effect-wave-bars]', waveBars);
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* WorldRoutes: a dotted world map with routes arcing between cities, a
|
|
4
|
+
* comet of light running along each and pinging the city it lands on.
|
|
5
|
+
* For "sell worldwide" and "customers in 40 countries" sections, or with
|
|
6
|
+
* `home`, "shipped from our studio to everywhere". Name cities (`london`,
|
|
7
|
+
* `tokyo`… see CITIES in src/runtime/world-plan.js) or give [latitude,
|
|
8
|
+
* longitude] or `{ name, lat, lon }`. Routes take their own colour,
|
|
9
|
+
* label, speed, width and dash; `colors` gives each city a colour of a
|
|
10
|
+
* palette, and `gradient` blends each route between its two. The map
|
|
11
|
+
* shows the world or a `region` (`europe`, `routes`, a box), fitted to
|
|
12
|
+
* its box; hovering a city or a route picks it out and names it.
|
|
13
|
+
*
|
|
14
|
+
* Transparent: it lays over the section's background. Fills its nearest
|
|
15
|
+
* positioned ancestor, or the viewport behind the page with `fixed`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <WorldRoutes home="london" routes={['new-york', 'tokyo', { to: 'sydney', color: '#f97316' }]} colors={['#e0f2fe', '#38bdf8', '#2dd4bf']} gradient labels />
|
|
19
|
+
*/
|
|
20
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
21
|
+
import type { WorldRoutesConfig } from '../runtime/world-routes.js';
|
|
22
|
+
|
|
23
|
+
interface Props extends WorldRoutesConfig {
|
|
24
|
+
/** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
|
|
25
|
+
fixed?: boolean;
|
|
26
|
+
/** Fade the edges out, for a cropped map: true for the left and right, or 'top', 'bottom' or 'both'. Default false. */
|
|
27
|
+
fade?: boolean | 'top' | 'bottom' | 'both';
|
|
28
|
+
class?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { fixed = false, fade = false, class: className, ...config } = Astro.props;
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<EffectCanvas name="world-routes" config={config} fixed={fixed} fade={fade} class={className} behind />
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import { mount } from '../runtime/mount.js';
|
|
38
|
+
import { worldRoutes } from '../runtime/world-routes.js';
|
|
39
|
+
|
|
40
|
+
mount('[data-effect-world-routes]', worldRoutes);
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @arraypress/effects-astro/components/style
|
|
3
|
+
*
|
|
4
|
+
* One `style` attribute from a component's own custom properties and the
|
|
5
|
+
* style a site passes: the site's comes last, so it can override, but no
|
|
6
|
+
* longer replaces the properties the effect needs.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Joins a component's own style with the one it was given.
|
|
11
|
+
*
|
|
12
|
+
* @param {string | false | null | undefined} own The component's declarations.
|
|
13
|
+
* @param {unknown} given The `style` prop, if any (a string; other values are ignored).
|
|
14
|
+
* @returns {string | undefined} The joined declarations, or undefined when there are none.
|
|
15
|
+
*/
|
|
16
|
+
export function withStyle(own, given) {
|
|
17
|
+
const parts = [own, typeof given === 'string' ? given : ''].map((part) => (part || '').trim().replace(/;$/, '')).filter(Boolean);
|
|
18
|
+
return parts.length ? parts.join('; ') : undefined;
|
|
19
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export { lightField } from './runtime/light-field.js';
|
|
2
|
+
export type { LightFieldConfig } from './runtime/light-field.js';
|
|
3
|
+
export { ink } from './runtime/ink.js';
|
|
4
|
+
export type { InkConfig } from './runtime/ink.js';
|
|
5
|
+
export { spotlight } from './runtime/spotlight.js';
|
|
6
|
+
export type { SpotlightConfig } from './runtime/spotlight.js';
|
|
7
|
+
export { asciiRain } from './runtime/ascii-rain.js';
|
|
8
|
+
export type { AsciiRainConfig } from './runtime/ascii-rain.js';
|
|
9
|
+
export { glassGlyph } from './runtime/glass-glyph.js';
|
|
10
|
+
export type { GlassGlyphConfig } from './runtime/glass-glyph.js';
|
|
11
|
+
export { flutedGlass } from './runtime/fluted-glass.js';
|
|
12
|
+
export type { FlutedGlassConfig } from './runtime/fluted-glass.js';
|
|
13
|
+
export { particleLogo } from './runtime/particle-logo.js';
|
|
14
|
+
export type { ParticleLogoConfig } from './runtime/particle-logo.js';
|
|
15
|
+
export { pointCloud } from './runtime/point-cloud.js';
|
|
16
|
+
export type { PointCloudConfig } from './runtime/point-cloud.js';
|
|
17
|
+
export { voxelLogo } from './runtime/voxel-logo.js';
|
|
18
|
+
export type { VoxelLogoConfig } from './runtime/voxel-logo.js';
|
|
19
|
+
export { pixelGlitch } from './runtime/pixel-glitch.js';
|
|
20
|
+
export type { PixelGlitchConfig } from './runtime/pixel-glitch.js';
|
|
21
|
+
export { fit, fitText } from './runtime/fit-text.js';
|
|
22
|
+
export { textNodes, textRange, splitLetters, joinLetters } from './runtime/text.js';
|
|
23
|
+
export { variableType, DEFAULT_AXES } from './runtime/variable-type.js';
|
|
24
|
+
export type { VariableTypeConfig, Axes } from './runtime/variable-type.js';
|
|
25
|
+
export { dotGrid } from './runtime/dot-grid.js';
|
|
26
|
+
export type { DotGridConfig } from './runtime/dot-grid.js';
|
|
27
|
+
export { signalLines, waveBars } from './runtime/waves.js';
|
|
28
|
+
export type { SignalLinesConfig, WaveBarsConfig } from './runtime/waves.js';
|
|
29
|
+
export { dotSurface } from './runtime/dot-surface.js';
|
|
30
|
+
export type { DotSurfaceConfig } from './runtime/dot-surface.js';
|
|
31
|
+
export { tilt, parallax } from './runtime/tilt.js';
|
|
32
|
+
export type { TiltConfig, ParallaxConfig } from './runtime/tilt.js';
|
|
33
|
+
export { magnetic } from './runtime/magnetic.js';
|
|
34
|
+
export type { MagneticConfig } from './runtime/magnetic.js';
|
|
35
|
+
export { cursor } from './runtime/cursor.js';
|
|
36
|
+
export type { CursorConfig } from './runtime/cursor.js';
|
|
37
|
+
export { scramble, typewriter, reveal } from './runtime/text-motion.js';
|
|
38
|
+
export type { ScrambleConfig, TypewriterConfig, RevealConfig } from './runtime/text-motion.js';
|
|
39
|
+
export { marquee } from './runtime/marquee.js';
|
|
40
|
+
export { glassSheen } from './runtime/glass-sheen.js';
|
|
41
|
+
export { liquidGlass, glassLens, lensSupported, LENS_DEFAULTS } from './runtime/liquid-glass.js';
|
|
42
|
+
export { lensMap, roundedRect } from './runtime/lens-map.js';
|
|
43
|
+
export { bump } from './runtime/motion.js';
|
|
44
|
+
export { worldRoutes, CITIES } from './runtime/world-routes.js';
|
|
45
|
+
export type { WorldRoutesConfig, Place, Route, RouteSpec, CityKey, RegionName, Bounds } from './runtime/world-routes.js';
|
|
46
|
+
export { REGIONS } from './runtime/world-map.js';
|
|
47
|
+
export { isLand, LAND } from './runtime/world-land.js';
|
|
48
|
+
export { inView } from './runtime/in-view.js';
|
|
49
|
+
export { scrollReveal, REVEAL_CLASSES } from './runtime/scroll-reveal.js';
|
|
50
|
+
export type { ScrollRevealConfig } from './runtime/scroll-reveal.js';
|
|
51
|
+
export { shaderBackground, shaderBackgroundPalette, shaderBackgroundSettings } from './runtime/shader-background.js';
|
|
52
|
+
export type { ShaderBackgroundConfig, ShaderBackgroundName } from './runtime/shader-background.js';
|
|
53
|
+
export { inkField, inkFieldSettings } from './runtime/ink-field.js';
|
|
54
|
+
export type { InkFieldConfig } from './runtime/ink-field.js';
|
|
55
|
+
export { PALETTES, findPalette, pickColors } from './runtime/palettes.js';
|
|
56
|
+
export type { Palette, PaletteName } from './runtime/palettes.js';
|
|
57
|
+
export { neonSwarm } from './runtime/neon-swarm.js';
|
|
58
|
+
export type { NeonSwarmConfig } from './runtime/neon-swarm.js';
|
|
59
|
+
export { nebulaLogo } from './runtime/nebula-logo.js';
|
|
60
|
+
export type { NebulaLogoConfig } from './runtime/nebula-logo.js';
|
|
61
|
+
export { liquidMetal } from './runtime/liquid-metal.js';
|
|
62
|
+
export type { LiquidMetalConfig, MetalName } from './runtime/liquid-metal.js';
|
|
63
|
+
export { haloRing } from './runtime/halo-ring.js';
|
|
64
|
+
export type { HaloRingConfig, HaloShape } from './runtime/halo-ring.js';
|
|
65
|
+
export { silkRibbon } from './runtime/silk-ribbon.js';
|
|
66
|
+
export type { SilkRibbonConfig } from './runtime/silk-ribbon.js';
|
|
67
|
+
export { radiantGlass } from './runtime/radiant-glass.js';
|
|
68
|
+
export type { RadiantGlassConfig } from './runtime/radiant-glass.js';
|
|
69
|
+
export { topography } from './runtime/topography.js';
|
|
70
|
+
export type { TopographyConfig } from './runtime/topography.js';
|
|
71
|
+
export { caustics, causticTones } from './runtime/caustics.js';
|
|
72
|
+
export type { CausticsConfig, CausticTones } from './runtime/caustics.js';
|
|
73
|
+
export { rainOnGlass } from './runtime/rain-on-glass.js';
|
|
74
|
+
export type { RainOnGlassConfig } from './runtime/rain-on-glass.js';
|
|
75
|
+
export { ocean } from './runtime/ocean.js';
|
|
76
|
+
export type { OceanConfig } from './runtime/ocean.js';
|
|
77
|
+
export { OCEAN_TIMES, oceanLook, oceanBackdrop } from './runtime/ocean/presets.js';
|
|
78
|
+
export type { OceanLook, OceanTime } from './runtime/ocean/presets.js';
|
|
79
|
+
export { isoCity } from './runtime/iso-city.js';
|
|
80
|
+
export type { IsoCityConfig } from './runtime/iso-city.js';
|
|
81
|
+
export { mosaicReveal, tileGrid } from './runtime/mosaic-reveal.js';
|
|
82
|
+
export type { MosaicRevealConfig, MosaicTransition } from './runtime/mosaic-reveal.js';
|
|
83
|
+
export { slideshow } from './runtime/slideshow.js';
|
|
84
|
+
export type { SlideshowOptions } from './runtime/slideshow.js';
|
|
85
|
+
export { productStack } from './runtime/product-stack.js';
|
|
86
|
+
export type { ProductStackConfig } from './runtime/product-stack.js';
|
|
87
|
+
export { imageRipple, fitScale } from './runtime/image-ripple.js';
|
|
88
|
+
export type { ImageRippleConfig } from './runtime/image-ripple.js';
|
|
89
|
+
export { stackPoses, stackBounds, poseTransform, poseFilter, LAYOUTS as STACK_LAYOUTS } from './runtime/stack-poses.js';
|
|
90
|
+
export type { Layout as StackLayout, Pose, PoseState } from './runtime/stack-poses.js';
|
|
91
|
+
export { createCanvas2D, grainPattern, grainOnto } from './runtime/canvas2d.js';
|
|
92
|
+
export type { Canvas2D } from './runtime/canvas2d.js';
|
|
93
|
+
export { loadImage, imageTexture, coverScale, GLSL_COVER } from './runtime/image.js';
|
|
94
|
+
export { boxBlur } from './runtime/blur.js';
|
|
95
|
+
export { paperShader, paperSettings, paperUniforms } from './runtime/paper.js';
|
|
96
|
+
export type { PaperConfig, PaperShaderName } from './runtime/paper.js';
|
|
97
|
+
export { paperLook, paperLookSettings } from './runtime/paper-look.js';
|
|
98
|
+
export type { PaperLookConfig, PaperLookOptions } from './runtime/paper-look.js';
|
|
99
|
+
export { PAPER_LOOKS } from './runtime/paper-looks.js';
|
|
100
|
+
export type { PaperLook, PaperLookName } from './runtime/paper-looks.js';
|
|
101
|
+
export { createStage } from './runtime/stage.js';
|
|
102
|
+
export type { Stage, StageOptions } from './runtime/stage.js';
|
|
103
|
+
export { createMesh, STRIDE } from './runtime/mesh.js';
|
|
104
|
+
export type { Mesh } from './runtime/mesh.js';
|
|
105
|
+
export { isoCamera, ISO_PITCH } from './runtime/iso-camera.js';
|
|
106
|
+
export type { IsoCamera, IsoCameraOptions } from './runtime/iso-camera.js';
|
|
107
|
+
export { instancing } from './runtime/instancing.js';
|
|
108
|
+
export type { Instancing } from './runtime/instancing.js';
|
|
109
|
+
export { seededRandom } from './runtime/random.js';
|
|
110
|
+
export { createPingPong, floatFormats } from './runtime/ping-pong.js';
|
|
111
|
+
export type { PingPong, FloatFormat } from './runtime/ping-pong.js';
|
|
112
|
+
export { createHeightField, GLSL_HEIGHT_FIELD, MAX_PUSHES } from './runtime/height-field.js';
|
|
113
|
+
export type { HeightField, WaveMotion } from './runtime/height-field.js';
|
|
114
|
+
export { createPoints, projectPoint, GLSL_PROJECT } from './runtime/points.js';
|
|
115
|
+
export type { Points } from './runtime/points.js';
|
|
116
|
+
export { createTrackers } from './runtime/trackers.js';
|
|
117
|
+
export type { TrackerBox } from './runtime/trackers.js';
|
|
118
|
+
export { drawShape, samplePoints, gridPoints, distanceField, blurField, fontAt } from './runtime/shape.js';
|
|
119
|
+
export type { ShapeSource, Mask } from './runtime/shape.js';
|
|
120
|
+
export { createGlyphs, GLYPH_SETS, GLSL_GLYPHS } from './runtime/glyphs.js';
|
|
121
|
+
export { GLSL_RAMP } from './runtime/ramp.js';
|
|
122
|
+
export { GLSL_NOISE, GLSL_PALETTE, GLSL_QUIET, paletteUniform, quietUniform } from './runtime/glsl.js';
|
|
123
|
+
export { createFluid, stir } from './runtime/fluid.js';
|
|
124
|
+
export type { Fluid, FluidOptions, StirOptions } from './runtime/fluid.js';
|
|
125
|
+
export { parseColor, toHex, toOklab, fromOklab, mixOklab, paletteAt, turnHue, GLSL_OKLAB } from './runtime/color.js';
|
|
126
|
+
export type { Rgb } from './runtime/color.js';
|
|
127
|
+
export { animate } from './runtime/loop.js';
|
|
128
|
+
export { audioSignal } from './runtime/audio.js';
|
|
129
|
+
export type { AudioSignal, AudioReading, AudioSource } from './runtime/audio.js';
|
|
130
|
+
export { pointerIn, trail, pressAt, CLICK_IGNORE } from './runtime/pointer.js';
|
|
131
|
+
export type { StrokePoint } from './runtime/pointer.js';
|
|
132
|
+
export { pixelRatio, isMobileGpu, prefersReducedMotion, canHover } from './runtime/device.js';
|
|
133
|
+
export { getContext, createProgram, bindTriangle, VERTEX } from './runtime/gl.js';
|
|
134
|
+
export type { GL, Program } from './runtime/gl.js';
|
|
135
|
+
export { mount, readConfig, watchColors } from './runtime/mount.js';
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Changes the colours of a WebGL effect (`<LightField>`, `<Ink>`, `<AsciiRain>`,
|
|
139
|
+
* `<FlutedGlass>`, `<GlassGlyph>`, `<LiquidMetal>`, `<ParticleLogo>`, `<PointCloud>`,
|
|
140
|
+
* `<VoxelLogo>`, `<HaloRing>`, `<SilkRibbon>`, `<RadiantGlass>`, `<Topography>`, `<Caustics>`, `<RainOnGlass>`, `<MosaicReveal>`, `<Ocean>`, `<IsoCity>`),
|
|
141
|
+
* in the order its `colors` takes. A light eases to them; the others take them next frame.
|
|
142
|
+
*/
|
|
143
|
+
export function setColors(el: Element | null, colors: string[], glint?: string): void;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @arraypress/effects-astro
|
|
3
|
+
*
|
|
4
|
+
* GPU effects for Astro sites, as components imported from their own paths
|
|
5
|
+
* (`@arraypress/effects-astro/LightField.astro`, …). This entry is the
|
|
6
|
+
* runtime underneath, for use without Astro or to build more: the effects
|
|
7
|
+
* as plain functions, the stage they share, the fluid simulation, point and
|
|
8
|
+
* shape helpers, colour in Oklab, the shared animation loop, the pointer,
|
|
9
|
+
* and the device checks every effect makes.
|
|
10
|
+
*
|
|
11
|
+
* @module @arraypress/effects-astro
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export { lightField } from './runtime/light-field.js';
|
|
15
|
+
export { ink } from './runtime/ink.js';
|
|
16
|
+
export { spotlight } from './runtime/spotlight.js';
|
|
17
|
+
export { asciiRain } from './runtime/ascii-rain.js';
|
|
18
|
+
export { glassGlyph } from './runtime/glass-glyph.js';
|
|
19
|
+
export { flutedGlass } from './runtime/fluted-glass.js';
|
|
20
|
+
export { particleLogo } from './runtime/particle-logo.js';
|
|
21
|
+
export { pointCloud } from './runtime/point-cloud.js';
|
|
22
|
+
export { voxelLogo } from './runtime/voxel-logo.js';
|
|
23
|
+
export { pixelGlitch } from './runtime/pixel-glitch.js';
|
|
24
|
+
export { fit, fitText } from './runtime/fit-text.js';
|
|
25
|
+
export { textNodes, textRange, splitLetters, joinLetters } from './runtime/text.js';
|
|
26
|
+
export { variableType, DEFAULT_AXES } from './runtime/variable-type.js';
|
|
27
|
+
export { dotGrid } from './runtime/dot-grid.js';
|
|
28
|
+
export { signalLines, waveBars } from './runtime/waves.js';
|
|
29
|
+
export { dotSurface } from './runtime/dot-surface.js';
|
|
30
|
+
export { tilt, parallax } from './runtime/tilt.js';
|
|
31
|
+
export { magnetic } from './runtime/magnetic.js';
|
|
32
|
+
export { cursor } from './runtime/cursor.js';
|
|
33
|
+
export { scramble, typewriter, reveal } from './runtime/text-motion.js';
|
|
34
|
+
export { marquee } from './runtime/marquee.js';
|
|
35
|
+
export { glassSheen } from './runtime/glass-sheen.js';
|
|
36
|
+
export { liquidGlass, glassLens, lensSupported, LENS_DEFAULTS } from './runtime/liquid-glass.js';
|
|
37
|
+
export { lensMap, roundedRect } from './runtime/lens-map.js';
|
|
38
|
+
export { bump } from './runtime/motion.js';
|
|
39
|
+
export { worldRoutes, CITIES } from './runtime/world-routes.js';
|
|
40
|
+
export { REGIONS } from './runtime/world-map.js';
|
|
41
|
+
export { isLand, LAND } from './runtime/world-land.js';
|
|
42
|
+
export { inView } from './runtime/in-view.js';
|
|
43
|
+
export { scrollReveal, REVEAL_CLASSES } from './runtime/scroll-reveal.js';
|
|
44
|
+
export { shaderBackground, shaderBackgroundPalette, shaderBackgroundSettings } from './runtime/shader-background.js';
|
|
45
|
+
export { inkField, inkFieldSettings } from './runtime/ink-field.js';
|
|
46
|
+
export { PALETTES, findPalette, pickColors } from './runtime/palettes.js';
|
|
47
|
+
export { neonSwarm } from './runtime/neon-swarm.js';
|
|
48
|
+
export { nebulaLogo } from './runtime/nebula-logo.js';
|
|
49
|
+
export { liquidMetal } from './runtime/liquid-metal.js';
|
|
50
|
+
export { haloRing } from './runtime/halo-ring.js';
|
|
51
|
+
export { silkRibbon } from './runtime/silk-ribbon.js';
|
|
52
|
+
export { radiantGlass } from './runtime/radiant-glass.js';
|
|
53
|
+
export { topography } from './runtime/topography.js';
|
|
54
|
+
export { caustics, causticTones } from './runtime/caustics.js';
|
|
55
|
+
export { rainOnGlass } from './runtime/rain-on-glass.js';
|
|
56
|
+
export { ocean } from './runtime/ocean.js';
|
|
57
|
+
export { isoCity } from './runtime/iso-city.js';
|
|
58
|
+
export { OCEAN_TIMES, oceanLook, oceanBackdrop } from './runtime/ocean/presets.js';
|
|
59
|
+
export { mosaicReveal, tileGrid } from './runtime/mosaic-reveal.js';
|
|
60
|
+
export { slideshow } from './runtime/slideshow.js';
|
|
61
|
+
export { productStack } from './runtime/product-stack.js';
|
|
62
|
+
export { imageRipple, fitScale } from './runtime/image-ripple.js';
|
|
63
|
+
export { stackPoses, stackBounds, poseTransform, poseFilter, LAYOUTS as STACK_LAYOUTS } from './runtime/stack-poses.js';
|
|
64
|
+
export { createCanvas2D, grainPattern, grainOnto } from './runtime/canvas2d.js';
|
|
65
|
+
export { loadImage, imageTexture, coverScale, GLSL_COVER } from './runtime/image.js';
|
|
66
|
+
export { boxBlur } from './runtime/blur.js';
|
|
67
|
+
export { paperShader, paperSettings, paperUniforms } from './runtime/paper.js';
|
|
68
|
+
export { paperLook, paperLookSettings } from './runtime/paper-look.js';
|
|
69
|
+
export { PAPER_LOOKS } from './runtime/paper-looks.js';
|
|
70
|
+
export { createStage } from './runtime/stage.js';
|
|
71
|
+
export { createMesh, STRIDE } from './runtime/mesh.js';
|
|
72
|
+
export { isoCamera, ISO_PITCH } from './runtime/iso-camera.js';
|
|
73
|
+
export { instancing } from './runtime/instancing.js';
|
|
74
|
+
export { seededRandom } from './runtime/random.js';
|
|
75
|
+
export { createPingPong, floatFormats } from './runtime/ping-pong.js';
|
|
76
|
+
export { createHeightField, GLSL_HEIGHT_FIELD, MAX_PUSHES } from './runtime/height-field.js';
|
|
77
|
+
export { createPoints, projectPoint, GLSL_PROJECT } from './runtime/points.js';
|
|
78
|
+
export { createTrackers } from './runtime/trackers.js';
|
|
79
|
+
export { drawShape, samplePoints, gridPoints, distanceField, blurField, fontAt } from './runtime/shape.js';
|
|
80
|
+
export { createGlyphs, GLYPH_SETS, GLSL_GLYPHS } from './runtime/glyphs.js';
|
|
81
|
+
export { GLSL_RAMP } from './runtime/ramp.js';
|
|
82
|
+
export { GLSL_NOISE, GLSL_PALETTE, GLSL_QUIET, paletteUniform, quietUniform } from './runtime/glsl.js';
|
|
83
|
+
export { createFluid, stir } from './runtime/fluid.js';
|
|
84
|
+
export { parseColor, toHex, toOklab, fromOklab, mixOklab, paletteAt, turnHue, GLSL_OKLAB } from './runtime/color.js';
|
|
85
|
+
export { animate } from './runtime/loop.js';
|
|
86
|
+
export { audioSignal } from './runtime/audio.js';
|
|
87
|
+
export { pointerIn, trail, pressAt, CLICK_IGNORE } from './runtime/pointer.js';
|
|
88
|
+
export { pixelRatio, isMobileGpu, prefersReducedMotion, canHover } from './runtime/device.js';
|
|
89
|
+
export { getContext, createProgram, bindTriangle, VERTEX } from './runtime/gl.js';
|
|
90
|
+
export { mount, readConfig, watchColors } from './runtime/mount.js';
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Changes the colours of a WebGL effect (`<LightField>`, `<Ink>`,
|
|
94
|
+
* `<AsciiRain>`, `<FlutedGlass>`, `<GlassGlyph>`, `<LiquidMetal>`,
|
|
95
|
+
* `<ParticleLogo>`, `<PointCloud>`, `<VoxelLogo>`, `<HaloRing>`, `<SilkRibbon>`, `<RadiantGlass>`, `<Topography>`, `<Caustics>`, `<RainOnGlass>`, `<MosaicReveal>`, `<Ocean>`, `<IsoCity>`): a light
|
|
96
|
+
* eases to them in about a second, the others take them from their next frame.
|
|
97
|
+
*
|
|
98
|
+
* @param {Element | null} el The effect's element (`[data-effect-light-field]` and so on).
|
|
99
|
+
* @param {string[]} colors The new palette, as CSS hex, in the order the effect's `colors` takes.
|
|
100
|
+
* @param {string} [glint] A light field's new glint colour.
|
|
101
|
+
*/
|
|
102
|
+
export function setColors(el, colors, glint) {
|
|
103
|
+
if (!(el instanceof HTMLElement)) return;
|
|
104
|
+
el.dataset.colors = JSON.stringify(glint ? { colors, glint } : { colors });
|
|
105
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { PaletteName } from './palettes.js';
|
|
2
|
+
|
|
3
|
+
export interface AsciiRainConfig {
|
|
4
|
+
/** Three CSS hex colours the glyphs take, the brightest nearly white. Default a cool cyan and green. */
|
|
5
|
+
colors?: string[];
|
|
6
|
+
/** A shared palette by name (`PALETTES`, any case), when there are no `colors`. */
|
|
7
|
+
palette?: PaletteName | (string & {});
|
|
8
|
+
/** How often rows jump sideways for a moment, their colours splitting wider; 0 for never. Default 1. */
|
|
9
|
+
glitch?: number;
|
|
10
|
+
/** A character set (`data`: hollow and solid bars; `bars`, `ascii`, `blocks`, `binary`, `boxes`) or the characters, darkest first. Default `data`. */
|
|
11
|
+
glyphs?: string;
|
|
12
|
+
/** A character cell's height in CSS px. Default 14. */
|
|
13
|
+
cell?: number;
|
|
14
|
+
/** A cell's width over its height. Default 1 for `data`, 0.6 for type. */
|
|
15
|
+
aspect?: number;
|
|
16
|
+
/** Which way the streaks run, degrees: 0 rightwards, 90 down, 180 left, 270 up. Default 0. */
|
|
17
|
+
angle?: number;
|
|
18
|
+
/** Streak lanes across the surface. Default 40. */
|
|
19
|
+
lines?: number;
|
|
20
|
+
/** A streak's length, a share of the gap between them (0–1). Default 0.3. */
|
|
21
|
+
trail?: number;
|
|
22
|
+
/** How many lanes have a streak at any time, 0–1. Default 0.7. */
|
|
23
|
+
density?: number;
|
|
24
|
+
/** A lane's streak width, a share of the lane (0–1). Default 0.9. */
|
|
25
|
+
width?: number;
|
|
26
|
+
/** A still cloud of data, or streaks running on a rippling surface. Default `cloud`. */
|
|
27
|
+
pattern?: 'cloud' | 'waves';
|
|
28
|
+
/** How fast it moves: the rows stream, or the streaks run; 0 for one still frame. Default 1. */
|
|
29
|
+
speed?: number;
|
|
30
|
+
/** How much each lane's speed differs, 0–1. Default 0.6. */
|
|
31
|
+
variance?: number;
|
|
32
|
+
/** How tall the surface's waves are; 0 for flat. Default 1. */
|
|
33
|
+
ripple?: number;
|
|
34
|
+
/** How close together the waves are. Default 1. */
|
|
35
|
+
waves?: number;
|
|
36
|
+
/** How far the surface leans back, degrees (0 face-on, 80 nearly edge-on). Default 58. */
|
|
37
|
+
tilt?: number;
|
|
38
|
+
/** How much of the surface fills the frame (larger is closer). Default 1. */
|
|
39
|
+
zoom?: number;
|
|
40
|
+
/** How strongly the waves are lit and shaded; 0 for flat. Default 1. */
|
|
41
|
+
lighting?: number;
|
|
42
|
+
/** How far blue bleeds left and red right of each glyph, CSS px; 0 for none. Default 3. */
|
|
43
|
+
aberration?: number;
|
|
44
|
+
/** With `waves`, whether the pointer ripples the surface and a click drops a ring. Default true. */
|
|
45
|
+
interactive?: boolean;
|
|
46
|
+
/** An area kept clear: centre (0–1 from the top left), radius (share of the height), depth (0–1). */
|
|
47
|
+
quiet?: { x?: number; y?: number; radius?: number; depth?: number } | null;
|
|
48
|
+
/** The font the glyphs are drawn in. Default a monospace stack. */
|
|
49
|
+
font?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Starts ASCII rain in `el`'s canvas (transparent where there is none). Returns a function that stops it. */
|
|
53
|
+
export function asciiRain(el: HTMLElement, config: AsciiRainConfig): () => void;
|