@arraypress/effects-astro 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +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 +285 -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,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Grain: a film-grain texture over a section (or the whole page with
|
|
4
|
+
* `fixed`). Big smooth gradients band on 8-bit screens; grain dithers them,
|
|
5
|
+
* so a shader reads as film rather than plastic. Blended with `overlay`,
|
|
6
|
+
* which keeps blacks black and textures the mid-tones, as film grain does,
|
|
7
|
+
* where plain alpha would lift the blacks into fog.
|
|
8
|
+
*
|
|
9
|
+
* SVG turbulence in a data URI: no request, any pixel ratio. Fills its
|
|
10
|
+
* nearest positioned ancestor; place it after the background and before
|
|
11
|
+
* the content. The grain jumps a dozen times a second, as film does
|
|
12
|
+
* (a transform on one layer, so it costs next to nothing); `still` holds
|
|
13
|
+
* it. High-frequency noise can trouble some people, so with
|
|
14
|
+
* prefers-reduced-motion it holds still and is reduced (not removed).
|
|
15
|
+
*
|
|
16
|
+
* From the SellGrid and ArrayPress themes.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <section style="position: relative">
|
|
20
|
+
* <LightField colors={…} />
|
|
21
|
+
* <Grain opacity={0.2} />
|
|
22
|
+
* <h1>…</h1>
|
|
23
|
+
* </section>
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
interface Props {
|
|
27
|
+
/** How strong, 0–1 (stronger than the number suggests, with overlay). Default 0.22. */
|
|
28
|
+
opacity?: number;
|
|
29
|
+
/** How fine; higher is finer (0.75 is about 1px). Default 0.75. */
|
|
30
|
+
frequency?: number;
|
|
31
|
+
/** Cover the viewport (position: fixed). Default false. */
|
|
32
|
+
fixed?: boolean;
|
|
33
|
+
/** The blend with what is under it. Default `overlay`. */
|
|
34
|
+
blend?: string;
|
|
35
|
+
/** Hold the grain still. Default false. */
|
|
36
|
+
still?: boolean;
|
|
37
|
+
class?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const { opacity = 0.22, frequency = 0.75, fixed = false, blend = 'overlay', still = false, class: className } = Astro.props;
|
|
41
|
+
// numOctaves 4 gives a natural grain; 1 looks like regular dithering.
|
|
42
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="${frequency}" numOctaves="4" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/></filter><rect width="256" height="256" filter="url(#n)"/></svg>`;
|
|
43
|
+
const uri = `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
<div
|
|
47
|
+
class:list={['effect-grain', { 'is-fixed': fixed, 'is-still': still }, className]}
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
style={`--grain-opacity: ${opacity}; --grain-image: url("${uri}"); mix-blend-mode: ${blend}`}
|
|
50
|
+
>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<style>
|
|
54
|
+
.effect-grain {
|
|
55
|
+
position: absolute;
|
|
56
|
+
inset: 0;
|
|
57
|
+
z-index: 1;
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
opacity: var(--grain-opacity);
|
|
61
|
+
}
|
|
62
|
+
.effect-grain.is-fixed {
|
|
63
|
+
position: fixed;
|
|
64
|
+
}
|
|
65
|
+
/* The grain, twice the size of what it covers, so it can jump about
|
|
66
|
+
without showing an edge. */
|
|
67
|
+
.effect-grain::before {
|
|
68
|
+
content: '';
|
|
69
|
+
position: absolute;
|
|
70
|
+
inset: -50%;
|
|
71
|
+
background: var(--grain-image) repeat;
|
|
72
|
+
background-size: 256px 256px;
|
|
73
|
+
animation: grain-jump 0.8s steps(1) infinite;
|
|
74
|
+
}
|
|
75
|
+
.effect-grain.is-still::before {
|
|
76
|
+
animation: none;
|
|
77
|
+
}
|
|
78
|
+
@keyframes grain-jump {
|
|
79
|
+
0%, 100% { transform: translate(0, 0); }
|
|
80
|
+
10% { transform: translate(-4%, -8%); }
|
|
81
|
+
20% { transform: translate(-12%, 4%); }
|
|
82
|
+
30% { transform: translate(6%, -18%); }
|
|
83
|
+
40% { transform: translate(-4%, 18%); }
|
|
84
|
+
50% { transform: translate(-12%, 8%); }
|
|
85
|
+
60% { transform: translate(12%, 0); }
|
|
86
|
+
70% { transform: translate(0, 12%); }
|
|
87
|
+
80% { transform: translate(3%, 16%); }
|
|
88
|
+
90% { transform: translate(-8%, 8%); }
|
|
89
|
+
}
|
|
90
|
+
@media (prefers-reduced-motion: reduce) {
|
|
91
|
+
.effect-grain {
|
|
92
|
+
opacity: min(var(--grain-opacity), 0.1);
|
|
93
|
+
}
|
|
94
|
+
.effect-grain::before {
|
|
95
|
+
animation: none;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* HaloRing: a ring of light on a dark ground, a soft-cornered outline
|
|
4
|
+
* around the copy whose bright core line glows inward a little and far
|
|
5
|
+
* outward. Colour travels around it, and its hottest stretches burn to
|
|
6
|
+
* white; the pointer draws it close and lights it up. See
|
|
7
|
+
* src/runtime/halo-ring.js.
|
|
8
|
+
*
|
|
9
|
+
* Opaque: it is the whole background of what it fills (its nearest
|
|
10
|
+
* positioned ancestor, or the viewport with `fixed`). Without WebGL the
|
|
11
|
+
* `background` colour shows.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <section class="hero" style="position: relative">
|
|
15
|
+
* <HaloRing colors={['#ffb020', '#ff5a6e', '#2f7bff']} />
|
|
16
|
+
* <h1>Something new arrives Friday.</h1>
|
|
17
|
+
* </section>
|
|
18
|
+
*/
|
|
19
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
20
|
+
import type { HaloRingConfig } from '../runtime/halo-ring.js';
|
|
21
|
+
|
|
22
|
+
interface Props extends HaloRingConfig {
|
|
23
|
+
/** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
|
|
24
|
+
fixed?: boolean;
|
|
25
|
+
class?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { fixed = false, class: className, ...config } = Astro.props;
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<EffectCanvas name="halo-ring" config={config} fixed={fixed} class={className} behind background={config.background ?? '#0d0c10'} />
|
|
32
|
+
|
|
33
|
+
<script>
|
|
34
|
+
import { mount } from '../runtime/mount.js';
|
|
35
|
+
import { haloRing } from '../runtime/halo-ring.js';
|
|
36
|
+
|
|
37
|
+
mount('[data-effect-halo-ring]', haloRing);
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* HighlightSweep: a marker-pen underline that sweeps in under a word,
|
|
4
|
+
* once, after the page has drawn. For the one phrase a headline turns on.
|
|
5
|
+
* CSS only; with reduced motion the underline is simply there.
|
|
6
|
+
*
|
|
7
|
+
* From the WaveGrid (SampleGrid) hero.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <h1>Sell <HighlightSweep color="#c084fc">beats</HighlightSweep> online.</h1>
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
/** The underline's colour. Default the text colour. */
|
|
15
|
+
color?: string;
|
|
16
|
+
/** How thick, em. Default 0.18. */
|
|
17
|
+
thickness?: number;
|
|
18
|
+
/** How strong, 0–1. Default 0.45. */
|
|
19
|
+
opacity?: number;
|
|
20
|
+
/** Seconds before it starts. Default 0.4. */
|
|
21
|
+
delay?: number;
|
|
22
|
+
/** Seconds the sweep takes. Default 1.6. */
|
|
23
|
+
duration?: number;
|
|
24
|
+
class?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { color = 'currentColor', thickness = 0.18, opacity = 0.45, delay = 0.4, duration = 1.6, class: className } = Astro.props;
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<span
|
|
31
|
+
class:list={['effect-highlight', className]}
|
|
32
|
+
style={`--hl-color: ${color}; --hl-thickness: ${thickness}em; --hl-opacity: ${opacity}; --hl-delay: ${delay}s; --hl-duration: ${duration}s`}
|
|
33
|
+
><slot /></span
|
|
34
|
+
>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.effect-highlight {
|
|
38
|
+
position: relative;
|
|
39
|
+
display: inline-block;
|
|
40
|
+
/* Its own layer, so the underline (z-index -1) sits behind the word, not the page. */
|
|
41
|
+
isolation: isolate;
|
|
42
|
+
}
|
|
43
|
+
.effect-highlight::after {
|
|
44
|
+
content: '';
|
|
45
|
+
position: absolute;
|
|
46
|
+
left: 0;
|
|
47
|
+
bottom: 0.08em;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: var(--hl-thickness);
|
|
50
|
+
border-radius: 2px;
|
|
51
|
+
background: linear-gradient(
|
|
52
|
+
90deg,
|
|
53
|
+
color-mix(in srgb, var(--hl-color) 30%, transparent),
|
|
54
|
+
var(--hl-color) 50%,
|
|
55
|
+
color-mix(in srgb, var(--hl-color) 30%, transparent)
|
|
56
|
+
);
|
|
57
|
+
opacity: var(--hl-opacity);
|
|
58
|
+
transform-origin: left;
|
|
59
|
+
transform: scaleX(0);
|
|
60
|
+
animation: effect-highlight-sweep var(--hl-duration) cubic-bezier(0.65, 0, 0.35, 1) var(--hl-delay) forwards;
|
|
61
|
+
z-index: -1;
|
|
62
|
+
}
|
|
63
|
+
@keyframes effect-highlight-sweep {
|
|
64
|
+
to {
|
|
65
|
+
transform: scaleX(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
@media (prefers-reduced-motion: reduce) {
|
|
69
|
+
.effect-highlight::after {
|
|
70
|
+
animation: none;
|
|
71
|
+
transform: none;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ImageRipple: a photo under a skin of water. The pointer drags a wake
|
|
4
|
+
* through it and a click drops a ring; the waves bend the photo, part its
|
|
5
|
+
* colours a little at their fronts and catch the light on their crests,
|
|
6
|
+
* then settle back to the still, sharp photo. See
|
|
7
|
+
* src/runtime/image-ripple.js.
|
|
8
|
+
*
|
|
9
|
+
* A real `<img>` sits under the canvas, so the photo is there for screen
|
|
10
|
+
* readers, before the script runs, and without WebGL or with reduced
|
|
11
|
+
* motion. Fills its nearest positioned ancestor.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <section class="hero" style="position: relative">
|
|
15
|
+
* <ImageRipple src="/photos/lake.jpg" alt="A misty lake at dawn" />
|
|
16
|
+
* <h1>…</h1>
|
|
17
|
+
* </section>
|
|
18
|
+
*/
|
|
19
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
20
|
+
import type { ImageRippleConfig } from '../runtime/image-ripple.js';
|
|
21
|
+
|
|
22
|
+
interface Props extends ImageRippleConfig {
|
|
23
|
+
/** The photo's text alternative. Default empty: decoration. */
|
|
24
|
+
alt?: string;
|
|
25
|
+
class?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { alt = '', class: className, ...config } = Astro.props;
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<div class:list={['image-ripple', className]}>
|
|
32
|
+
<img class="image-ripple__photo" src={config.src} alt={alt} decoding="async" style={config.fit === 'contain' ? 'object-fit: contain' : undefined} />
|
|
33
|
+
<EffectCanvas name="image-ripple" config={config} />
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.image-ripple {
|
|
38
|
+
position: absolute;
|
|
39
|
+
inset: 0;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}
|
|
42
|
+
.image-ripple__photo {
|
|
43
|
+
position: absolute;
|
|
44
|
+
inset: 0;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
object-fit: cover;
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
50
|
+
|
|
51
|
+
<script>
|
|
52
|
+
import { mount } from '../runtime/mount.js';
|
|
53
|
+
import { imageRipple } from '../runtime/image-ripple.js';
|
|
54
|
+
|
|
55
|
+
mount('[data-effect-image-ripple]', imageRipple);
|
|
56
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Ink: ink in water over whatever is behind it. The pointer stirs it and
|
|
4
|
+
* trails ink in the palette's colours; a click drops a bloom that bursts
|
|
5
|
+
* open and curls into eddies, then fades. Clear where there is no ink.
|
|
6
|
+
* See src/runtime/ink.js.
|
|
7
|
+
*
|
|
8
|
+
* Fills its nearest positioned ancestor, or the viewport with `fixed`.
|
|
9
|
+
* Needs WebGL 2; without it, or with prefers-reduced-motion, nothing is
|
|
10
|
+
* drawn and what is behind shows as it is.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <section class="hero" style="position: relative">
|
|
14
|
+
* <Ink colors={['#2216f7', '#55bdff', '#a702ff']} />
|
|
15
|
+
* <h1>…</h1>
|
|
16
|
+
* </section>
|
|
17
|
+
*/
|
|
18
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
19
|
+
import type { InkConfig } from '../runtime/ink.js';
|
|
20
|
+
|
|
21
|
+
interface Props extends InkConfig {
|
|
22
|
+
/** Fill the viewport (position: fixed). Default false. */
|
|
23
|
+
fixed?: boolean;
|
|
24
|
+
class?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { fixed = false, class: className, ...config } = Astro.props;
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<EffectCanvas name="ink" config={config} fixed={fixed} class={className} />
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
import { mount } from '../runtime/mount.js';
|
|
34
|
+
import { ink } from '../runtime/ink.js';
|
|
35
|
+
|
|
36
|
+
mount('[data-effect-ink]', ink);
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* InkField: ink in water, lit by a lamp that follows the pointer. Slow
|
|
4
|
+
* emitters keep the ink moving across the whole field; moving the pointer
|
|
5
|
+
* pushes it aside and leaves a faint trail, and the lamp rests at the upper
|
|
6
|
+
* left when the pointer is away. The field dims in the middle, behind the
|
|
7
|
+
* copy. Twelve named palettes (Trirat's), or colours of your own. See
|
|
8
|
+
* src/runtime/ink-field.js.
|
|
9
|
+
*
|
|
10
|
+
* Fills its nearest positioned ancestor, or the viewport behind the page
|
|
11
|
+
* with `fixed` (give `body` a transparent background so it shows through).
|
|
12
|
+
* With prefers-reduced-motion it holds one settled frame; without a float
|
|
13
|
+
* render target the palette's colours stand in, still.
|
|
14
|
+
*
|
|
15
|
+
* With `audio` (`"page"`, or a selector for an `<audio>` or a WaveformPlayer)
|
|
16
|
+
* each kick stirs the ink and it brightens with the beat; while nothing
|
|
17
|
+
* plays it keeps its own motion.
|
|
18
|
+
*
|
|
19
|
+
* A palette switcher recolours the ink already on screen with
|
|
20
|
+
* `setColors(el, PALETTES[name].colors, PALETTES[name].glint)`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <InkField fixed palette="Peacock" />
|
|
24
|
+
*/
|
|
25
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
26
|
+
import type { InkFieldConfig } from '../runtime/ink-field.js';
|
|
27
|
+
import { inkFieldSettings, inkFallback } from '../runtime/ink-field.js';
|
|
28
|
+
|
|
29
|
+
interface Props extends InkFieldConfig {
|
|
30
|
+
/** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
|
|
31
|
+
fixed?: boolean;
|
|
32
|
+
class?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const { fixed = false, class: className, ...config } = Astro.props;
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
<EffectCanvas name="ink-field" config={config} fixed={fixed} class={className} behind background={inkFallback(inkFieldSettings(config).colors)} />
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
import { mount } from '../runtime/mount.js';
|
|
42
|
+
import { inkField } from '../runtime/ink-field.js';
|
|
43
|
+
|
|
44
|
+
mount('[data-effect-ink-field]', inkField);
|
|
45
|
+
</script>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* IsoCity: a small isometric city in flat-shaded low poly, with cars
|
|
4
|
+
* driving its streets and the brand's taxis among them, in its `accent`.
|
|
5
|
+
* Click a street and the nearest taxi comes: its route draws in, it pulls
|
|
6
|
+
* in at the pin, and it picks up with a hop. `night` lights the windows,
|
|
7
|
+
* lamps and headlights. See src/runtime/iso-city.js.
|
|
8
|
+
*
|
|
9
|
+
* Opaque: it is the whole background of what it fills (its nearest
|
|
10
|
+
* positioned ancestor, or the viewport with `fixed`). With reduced motion
|
|
11
|
+
* the cars are parked and the city holds still; without WebGL a plain
|
|
12
|
+
* street grid in the city's colours shows.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <section class="hero" style="position: relative">
|
|
16
|
+
* <IsoCity accent="#f2a53a" side="right" quiet={{ x: 0.25, radius: 0.5 }} />
|
|
17
|
+
* <h1>Your ride, <em>two streets away.</em></h1>
|
|
18
|
+
* </section>
|
|
19
|
+
*/
|
|
20
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
21
|
+
import type { IsoCityConfig } from '../runtime/iso-city.js';
|
|
22
|
+
import { cityLook } from '../runtime/iso-city/look.js';
|
|
23
|
+
import { toHex } from '../runtime/color.js';
|
|
24
|
+
|
|
25
|
+
interface Props extends IsoCityConfig {
|
|
26
|
+
/** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
|
|
27
|
+
fixed?: boolean;
|
|
28
|
+
class?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { fixed = false, class: className, ...config } = Astro.props;
|
|
32
|
+
const ground = toHex(cityLook(config).background);
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
<EffectCanvas name="iso-city" config={config} fixed={fixed} class={className} behind background={ground} />
|
|
36
|
+
|
|
37
|
+
<style>
|
|
38
|
+
/* Without WebGL: the street grid as an isometric pattern, fading out at the edges.
|
|
39
|
+
Important, to win over the ground colour EffectCanvas sets inline. */
|
|
40
|
+
:global([data-effect-iso-city].is-flat) {
|
|
41
|
+
background:
|
|
42
|
+
radial-gradient(ellipse 62% 58% at 62% 52%, transparent 30%, var(--iso-ground) 92%),
|
|
43
|
+
repeating-linear-gradient(150deg, transparent 0 84px, var(--iso-road) 84px 96px),
|
|
44
|
+
repeating-linear-gradient(30deg, transparent 0 84px, var(--iso-road) 84px 96px),
|
|
45
|
+
var(--iso-block) !important;
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
import { mount } from '../runtime/mount.js';
|
|
51
|
+
import { isoCity } from '../runtime/iso-city.js';
|
|
52
|
+
|
|
53
|
+
mount('[data-effect-iso-city]', isoCity);
|
|
54
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* LightField: liquid light in three colours, bending around the pointer,
|
|
4
|
+
* with a real fluid under it that the pointer stirs and a click drops ink
|
|
5
|
+
* into. See src/runtime/light-field.js for how it is drawn.
|
|
6
|
+
*
|
|
7
|
+
* Fills its nearest positioned ancestor, or the viewport behind the page
|
|
8
|
+
* with `fixed` (give `body` a transparent background so it shows through).
|
|
9
|
+
* Without WebGL a still gradient in the same colours stands in.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <LightField fixed colors={['#7c3aed', '#db2777', '#06b6d4']} quiet={{ y: 0.45 }} />
|
|
13
|
+
*/
|
|
14
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
15
|
+
import type { LightFieldConfig } from '../runtime/light-field.js';
|
|
16
|
+
import { colorPools } from '../runtime/pools.js';
|
|
17
|
+
import { PALETTES, pickColors } from '../runtime/palettes.js';
|
|
18
|
+
|
|
19
|
+
interface Props extends LightFieldConfig {
|
|
20
|
+
/** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
|
|
21
|
+
fixed?: boolean;
|
|
22
|
+
/** The colour under the light, and under the fallback gradient. Default `#08080a`. */
|
|
23
|
+
background?: string;
|
|
24
|
+
class?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { fixed = false, background = '#08080a', class: className, ...config } = Astro.props;
|
|
28
|
+
|
|
29
|
+
// The no-WebGL look: the palette as soft pools of light, still.
|
|
30
|
+
const fallback = colorPools(pickColors(config, [...PALETTES.Lumetri.colors]), background);
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<EffectCanvas name="light-field" config={config} fixed={fixed} class={className} behind background={fallback} />
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import { mount } from '../runtime/mount.js';
|
|
37
|
+
import { lightField } from '../runtime/light-field.js';
|
|
38
|
+
|
|
39
|
+
mount('[data-effect-light-field]', lightField);
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* LiquidMetal: a logo or a word made of liquid chrome. At rest it is a
|
|
4
|
+
* polished slab of metal reflecting a slowly turning studio; the pointer
|
|
5
|
+
* dents it and sends ripples across it, a stroke parts it, a click
|
|
6
|
+
* splashes it (a crater, a ring wave, droplets that fall and crawl back),
|
|
7
|
+
* and surface tension pulls it back into shape with a last wobble.
|
|
8
|
+
* See src/runtime/liquid-metal.js.
|
|
9
|
+
*
|
|
10
|
+
* Transparent round the logo, so it lays over any section (or give it a
|
|
11
|
+
* `background`). Fills its nearest positioned ancestor, or the viewport
|
|
12
|
+
* with `fixed`. Without WebGL nothing is drawn.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <section class="hero" style="position: relative; background: #0b0c0e">
|
|
16
|
+
* <LiquidMetal src="/logo.svg" />
|
|
17
|
+
* <h1>…</h1>
|
|
18
|
+
* </section>
|
|
19
|
+
*/
|
|
20
|
+
import EffectCanvas from './EffectCanvas.astro';
|
|
21
|
+
import type { LiquidMetalConfig } from '../runtime/liquid-metal.js';
|
|
22
|
+
|
|
23
|
+
interface Props extends LiquidMetalConfig {
|
|
24
|
+
/** A ground behind the metal (any CSS background). Default none: transparent. */
|
|
25
|
+
background?: string;
|
|
26
|
+
/** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
|
|
27
|
+
fixed?: boolean;
|
|
28
|
+
class?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { background, fixed = false, class: className, ...config } = Astro.props;
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<EffectCanvas name="liquid-metal" config={config} fixed={fixed} class={className} behind background={background} />
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import { mount } from '../runtime/mount.js';
|
|
38
|
+
import { liquidMetal } from '../runtime/liquid-metal.js';
|
|
39
|
+
|
|
40
|
+
mount('[data-effect-liquid-metal]', liquidMetal);
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Magnetic: an element the pointer pulls on. As the pointer comes near it
|
|
4
|
+
* leans towards it, its contents a little further, and springs back when
|
|
5
|
+
* the pointer goes: a call to action that feels like a soft object. See
|
|
6
|
+
* src/runtime/magnetic.js. Still on touch screens and with reduced motion.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Magnetic as="a" href="/start" class="button" strength={0.35}>Start selling</Magnetic>
|
|
10
|
+
*/
|
|
11
|
+
import type { HTMLTag } from 'astro/types';
|
|
12
|
+
import type { MagneticConfig } from '../runtime/magnetic.js';
|
|
13
|
+
|
|
14
|
+
interface Props extends MagneticConfig {
|
|
15
|
+
/** The element to render. Default `span`. */
|
|
16
|
+
as?: HTMLTag;
|
|
17
|
+
class?: string;
|
|
18
|
+
[attribute: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { as: Tag = 'span', strength, reach, class: className, ...attributes } = Astro.props;
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<Tag class:list={['effect-magnetic', className]} data-effect-magnetic data-effect-config={JSON.stringify({ strength, reach })} {...attributes}>
|
|
25
|
+
<span class="inner"><slot /></span>
|
|
26
|
+
</Tag>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import { mount } from '../runtime/mount.js';
|
|
30
|
+
import { magnetic } from '../runtime/magnetic.js';
|
|
31
|
+
|
|
32
|
+
mount('[data-effect-magnetic]', magnetic);
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.effect-magnetic {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
translate: var(--magnet-x, 0px) var(--magnet-y, 0px);
|
|
39
|
+
transition: translate 0.5s cubic-bezier(0.2, 0.9, 0.2, 1.2);
|
|
40
|
+
}
|
|
41
|
+
.inner {
|
|
42
|
+
display: inherit;
|
|
43
|
+
align-items: inherit;
|
|
44
|
+
gap: inherit;
|
|
45
|
+
translate: var(--magnet-inner-x, 0px) var(--magnet-inner-y, 0px);
|
|
46
|
+
transition: translate 0.5s cubic-bezier(0.2, 0.9, 0.2, 1.2);
|
|
47
|
+
}
|
|
48
|
+
.effect-magnetic:global(.is-pulled),
|
|
49
|
+
.effect-magnetic:global(.is-pulled) .inner {
|
|
50
|
+
transition-duration: 0.15s;
|
|
51
|
+
}
|
|
52
|
+
</style>
|