@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.
Files changed (314) hide show
  1. package/AGENTS.md +85 -0
  2. package/COMPONENTS.md +1264 -0
  3. package/LICENSE +139 -0
  4. package/README.md +197 -2
  5. package/package.json +60 -4
  6. package/src/components/AsciiRain.astro +36 -0
  7. package/src/components/BorderSweep.astro +39 -0
  8. package/src/components/Caustics.astro +39 -0
  9. package/src/components/ColorPanels.astro +62 -0
  10. package/src/components/Cursor.astro +97 -0
  11. package/src/components/DotGrid.astro +34 -0
  12. package/src/components/DotSurface.astro +35 -0
  13. package/src/components/EffectCanvas.astro +152 -0
  14. package/src/components/FitText.astro +35 -0
  15. package/src/components/FlutedGlass.astro +36 -0
  16. package/src/components/Glass.astro +69 -0
  17. package/src/components/GlassGlyph.astro +38 -0
  18. package/src/components/GlowField.astro +177 -0
  19. package/src/components/Grain.astro +98 -0
  20. package/src/components/HaloRing.astro +38 -0
  21. package/src/components/HighlightSweep.astro +74 -0
  22. package/src/components/ImageRipple.astro +56 -0
  23. package/src/components/Ink.astro +37 -0
  24. package/src/components/InkField.astro +45 -0
  25. package/src/components/IsoCity.astro +54 -0
  26. package/src/components/LightField.astro +40 -0
  27. package/src/components/LiquidMetal.astro +41 -0
  28. package/src/components/Magnetic.astro +52 -0
  29. package/src/components/Marquee.astro +216 -0
  30. package/src/components/MosaicReveal.astro +196 -0
  31. package/src/components/NebulaLogo.astro +38 -0
  32. package/src/components/NeonSwarm.astro +38 -0
  33. package/src/components/Ocean.astro +40 -0
  34. package/src/components/OutlineWordmark.astro +222 -0
  35. package/src/components/PaperBackground.astro +40 -0
  36. package/src/components/PaperShader.astro +55 -0
  37. package/src/components/Parallax.astro +49 -0
  38. package/src/components/ParticleLogo.astro +37 -0
  39. package/src/components/PixelGlitchText.astro +70 -0
  40. package/src/components/PointCloud.astro +37 -0
  41. package/src/components/ProductStack.astro +298 -0
  42. package/src/components/PulseMark.astro +189 -0
  43. package/src/components/RadiantGlass.astro +38 -0
  44. package/src/components/RainOnGlass.astro +71 -0
  45. package/src/components/Reveal.astro +115 -0
  46. package/src/components/ScrambleText.astro +52 -0
  47. package/src/components/ScrollReveal.astro +38 -0
  48. package/src/components/ShaderBackground.astro +55 -0
  49. package/src/components/SignalLines.astro +41 -0
  50. package/src/components/SilkRibbon.astro +37 -0
  51. package/src/components/SpotlightText.astro +131 -0
  52. package/src/components/Tilt.astro +79 -0
  53. package/src/components/Topography.astro +38 -0
  54. package/src/components/Typewriter.astro +66 -0
  55. package/src/components/VariableType.astro +59 -0
  56. package/src/components/VoxelLogo.astro +46 -0
  57. package/src/components/WaveBars.astro +41 -0
  58. package/src/components/WorldRoutes.astro +41 -0
  59. package/src/components/style.js +19 -0
  60. package/src/index.d.ts +143 -0
  61. package/src/index.js +105 -0
  62. package/src/runtime/ascii-rain.d.ts +53 -0
  63. package/src/runtime/ascii-rain.js +355 -0
  64. package/src/runtime/audio-meter.d.ts +65 -0
  65. package/src/runtime/audio-meter.js +282 -0
  66. package/src/runtime/audio.d.ts +26 -0
  67. package/src/runtime/audio.js +453 -0
  68. package/src/runtime/blur.d.ts +2 -0
  69. package/src/runtime/blur.js +56 -0
  70. package/src/runtime/canvas2d.d.ts +23 -0
  71. package/src/runtime/canvas2d.js +105 -0
  72. package/src/runtime/caustics.d.ts +40 -0
  73. package/src/runtime/caustics.js +286 -0
  74. package/src/runtime/color.d.ts +33 -0
  75. package/src/runtime/color.js +213 -0
  76. package/src/runtime/curl.d.ts +5 -0
  77. package/src/runtime/curl.js +81 -0
  78. package/src/runtime/cursor.d.ts +9 -0
  79. package/src/runtime/cursor.js +80 -0
  80. package/src/runtime/device.d.ts +14 -0
  81. package/src/runtime/device.js +73 -0
  82. package/src/runtime/dot-grid.d.ts +27 -0
  83. package/src/runtime/dot-grid.js +245 -0
  84. package/src/runtime/dot-surface.d.ts +46 -0
  85. package/src/runtime/dot-surface.js +429 -0
  86. package/src/runtime/feedback.d.ts +18 -0
  87. package/src/runtime/feedback.js +131 -0
  88. package/src/runtime/fit-text.d.ts +5 -0
  89. package/src/runtime/fit-text.js +60 -0
  90. package/src/runtime/fluid.d.ts +55 -0
  91. package/src/runtime/fluid.js +504 -0
  92. package/src/runtime/fluted-glass.d.ts +27 -0
  93. package/src/runtime/fluted-glass.js +157 -0
  94. package/src/runtime/gl.d.ts +19 -0
  95. package/src/runtime/gl.js +104 -0
  96. package/src/runtime/glass-glyph.d.ts +49 -0
  97. package/src/runtime/glass-glyph.js +355 -0
  98. package/src/runtime/glass-sheen.d.ts +2 -0
  99. package/src/runtime/glass-sheen.js +30 -0
  100. package/src/runtime/glsl.d.ts +17 -0
  101. package/src/runtime/glsl.js +78 -0
  102. package/src/runtime/glyphs.d.ts +22 -0
  103. package/src/runtime/glyphs.js +107 -0
  104. package/src/runtime/halo-ring.d.ts +47 -0
  105. package/src/runtime/halo-ring.js +334 -0
  106. package/src/runtime/height-field.d.ts +50 -0
  107. package/src/runtime/height-field.js +176 -0
  108. package/src/runtime/image-ripple.d.ts +25 -0
  109. package/src/runtime/image-ripple.js +353 -0
  110. package/src/runtime/image.d.ts +11 -0
  111. package/src/runtime/image.js +81 -0
  112. package/src/runtime/in-view.d.ts +6 -0
  113. package/src/runtime/in-view.js +36 -0
  114. package/src/runtime/ink-field/shaders.js +258 -0
  115. package/src/runtime/ink-field/sim.js +582 -0
  116. package/src/runtime/ink-field.d.ts +39 -0
  117. package/src/runtime/ink-field.js +311 -0
  118. package/src/runtime/ink.d.ts +31 -0
  119. package/src/runtime/ink.js +109 -0
  120. package/src/runtime/instancing.d.ts +12 -0
  121. package/src/runtime/instancing.js +37 -0
  122. package/src/runtime/iso-camera.d.ts +35 -0
  123. package/src/runtime/iso-camera.js +85 -0
  124. package/src/runtime/iso-city/figures.d.ts +30 -0
  125. package/src/runtime/iso-city/figures.js +136 -0
  126. package/src/runtime/iso-city/look.d.ts +34 -0
  127. package/src/runtime/iso-city/look.js +105 -0
  128. package/src/runtime/iso-city/plan.d.ts +59 -0
  129. package/src/runtime/iso-city/plan.js +463 -0
  130. package/src/runtime/iso-city/roads.d.ts +64 -0
  131. package/src/runtime/iso-city/roads.js +320 -0
  132. package/src/runtime/iso-city/scene.d.ts +27 -0
  133. package/src/runtime/iso-city/scene.js +432 -0
  134. package/src/runtime/iso-city/shaders.d.ts +6 -0
  135. package/src/runtime/iso-city/shaders.js +233 -0
  136. package/src/runtime/iso-city/shadows.d.ts +13 -0
  137. package/src/runtime/iso-city/shadows.js +148 -0
  138. package/src/runtime/iso-city/traffic.d.ts +80 -0
  139. package/src/runtime/iso-city/traffic.js +457 -0
  140. package/src/runtime/iso-city.d.ts +37 -0
  141. package/src/runtime/iso-city.js +458 -0
  142. package/src/runtime/lens-map.d.ts +11 -0
  143. package/src/runtime/lens-map.js +146 -0
  144. package/src/runtime/light-field.d.ts +29 -0
  145. package/src/runtime/light-field.js +292 -0
  146. package/src/runtime/liquid-glass.d.ts +48 -0
  147. package/src/runtime/liquid-glass.js +423 -0
  148. package/src/runtime/liquid-metal/beads.js +217 -0
  149. package/src/runtime/liquid-metal/field.js +88 -0
  150. package/src/runtime/liquid-metal/look.js +64 -0
  151. package/src/runtime/liquid-metal/shaders.js +255 -0
  152. package/src/runtime/liquid-metal/wave.js +53 -0
  153. package/src/runtime/liquid-metal.d.ts +46 -0
  154. package/src/runtime/liquid-metal.js +366 -0
  155. package/src/runtime/loop.d.ts +7 -0
  156. package/src/runtime/loop.js +112 -0
  157. package/src/runtime/magnetic.d.ts +9 -0
  158. package/src/runtime/magnetic.js +46 -0
  159. package/src/runtime/marquee.d.ts +2 -0
  160. package/src/runtime/marquee.js +27 -0
  161. package/src/runtime/mesh.d.ts +30 -0
  162. package/src/runtime/mesh.js +217 -0
  163. package/src/runtime/mosaic-reveal.d.ts +34 -0
  164. package/src/runtime/mosaic-reveal.js +504 -0
  165. package/src/runtime/motion.d.ts +2 -0
  166. package/src/runtime/motion.js +21 -0
  167. package/src/runtime/mount.d.ts +13 -0
  168. package/src/runtime/mount.js +120 -0
  169. package/src/runtime/nebula-logo.d.ts +31 -0
  170. package/src/runtime/nebula-logo.js +282 -0
  171. package/src/runtime/neon-swarm.d.ts +31 -0
  172. package/src/runtime/neon-swarm.js +258 -0
  173. package/src/runtime/ocean/presets.d.ts +54 -0
  174. package/src/runtime/ocean/presets.js +184 -0
  175. package/src/runtime/ocean/shader.d.ts +14 -0
  176. package/src/runtime/ocean/shader.js +389 -0
  177. package/src/runtime/ocean/view.d.ts +24 -0
  178. package/src/runtime/ocean/view.js +98 -0
  179. package/src/runtime/ocean/waves.d.ts +29 -0
  180. package/src/runtime/ocean/waves.js +119 -0
  181. package/src/runtime/ocean.d.ts +31 -0
  182. package/src/runtime/ocean.js +173 -0
  183. package/src/runtime/palettes.d.ts +37 -0
  184. package/src/runtime/palettes.js +75 -0
  185. package/src/runtime/paper-look.d.ts +42 -0
  186. package/src/runtime/paper-look.js +91 -0
  187. package/src/runtime/paper-looks.d.ts +17 -0
  188. package/src/runtime/paper-looks.js +21 -0
  189. package/src/runtime/paper.d.ts +37 -0
  190. package/src/runtime/paper.js +285 -0
  191. package/src/runtime/particle-logo.d.ts +31 -0
  192. package/src/runtime/particle-logo.js +196 -0
  193. package/src/runtime/ping-pong.d.ts +43 -0
  194. package/src/runtime/ping-pong.js +175 -0
  195. package/src/runtime/pixel-glitch.d.ts +17 -0
  196. package/src/runtime/pixel-glitch.js +287 -0
  197. package/src/runtime/point-cloud.d.ts +33 -0
  198. package/src/runtime/point-cloud.js +287 -0
  199. package/src/runtime/pointer.d.ts +27 -0
  200. package/src/runtime/pointer.js +128 -0
  201. package/src/runtime/points.d.ts +25 -0
  202. package/src/runtime/points.js +130 -0
  203. package/src/runtime/pools.d.ts +2 -0
  204. package/src/runtime/pools.js +25 -0
  205. package/src/runtime/product-stack.d.ts +24 -0
  206. package/src/runtime/product-stack.js +210 -0
  207. package/src/runtime/radiant-glass.d.ts +29 -0
  208. package/src/runtime/radiant-glass.js +282 -0
  209. package/src/runtime/rain-on-glass/backdrop.d.ts +22 -0
  210. package/src/runtime/rain-on-glass/backdrop.js +185 -0
  211. package/src/runtime/rain-on-glass/shader.d.ts +2 -0
  212. package/src/runtime/rain-on-glass/shader.js +168 -0
  213. package/src/runtime/rain-on-glass/wipe.d.ts +16 -0
  214. package/src/runtime/rain-on-glass/wipe.js +65 -0
  215. package/src/runtime/rain-on-glass.d.ts +27 -0
  216. package/src/runtime/rain-on-glass.js +210 -0
  217. package/src/runtime/ramp.d.ts +2 -0
  218. package/src/runtime/ramp.js +30 -0
  219. package/src/runtime/random.d.ts +2 -0
  220. package/src/runtime/random.js +22 -0
  221. package/src/runtime/scroll-reveal.d.ts +22 -0
  222. package/src/runtime/scroll-reveal.js +73 -0
  223. package/src/runtime/shader-background.d.ts +42 -0
  224. package/src/runtime/shader-background.js +261 -0
  225. package/src/runtime/shader-backgrounds/band-lens.js +72 -0
  226. package/src/runtime/shader-backgrounds/common.js +53 -0
  227. package/src/runtime/shader-backgrounds/grain-gradient.js +87 -0
  228. package/src/runtime/shader-backgrounds/grid.js +33 -0
  229. package/src/runtime/shader-backgrounds/mesh-gradient.js +74 -0
  230. package/src/runtime/shader-backgrounds/silk.js +57 -0
  231. package/src/runtime/shader-backgrounds/waves.js +31 -0
  232. package/src/runtime/shape.d.ts +42 -0
  233. package/src/runtime/shape.js +313 -0
  234. package/src/runtime/silk-ribbon.d.ts +23 -0
  235. package/src/runtime/silk-ribbon.js +206 -0
  236. package/src/runtime/slideshow.d.ts +27 -0
  237. package/src/runtime/slideshow.js +234 -0
  238. package/src/runtime/spotlight.d.ts +9 -0
  239. package/src/runtime/spotlight.js +97 -0
  240. package/src/runtime/stack-poses.d.ts +53 -0
  241. package/src/runtime/stack-poses.js +273 -0
  242. package/src/runtime/stage.d.ts +47 -0
  243. package/src/runtime/stage.js +187 -0
  244. package/src/runtime/swarm.d.ts +49 -0
  245. package/src/runtime/swarm.js +199 -0
  246. package/src/runtime/text-motion.d.ts +41 -0
  247. package/src/runtime/text-motion.js +165 -0
  248. package/src/runtime/text.d.ts +11 -0
  249. package/src/runtime/text.js +90 -0
  250. package/src/runtime/tilt.d.ts +19 -0
  251. package/src/runtime/tilt.js +116 -0
  252. package/src/runtime/topography.d.ts +71 -0
  253. package/src/runtime/topography.js +650 -0
  254. package/src/runtime/trackers.d.ts +21 -0
  255. package/src/runtime/trackers.js +76 -0
  256. package/src/runtime/variable-type.d.ts +43 -0
  257. package/src/runtime/variable-type.js +358 -0
  258. package/src/runtime/voxel-logo.d.ts +31 -0
  259. package/src/runtime/voxel-logo.js +237 -0
  260. package/src/runtime/waves.d.ts +70 -0
  261. package/src/runtime/waves.js +799 -0
  262. package/src/runtime/world-labels.d.ts +29 -0
  263. package/src/runtime/world-labels.js +59 -0
  264. package/src/runtime/world-land.d.ts +8 -0
  265. package/src/runtime/world-land.js +105 -0
  266. package/src/runtime/world-map.d.ts +69 -0
  267. package/src/runtime/world-map.js +308 -0
  268. package/src/runtime/world-plan.d.ts +101 -0
  269. package/src/runtime/world-plan.js +333 -0
  270. package/src/runtime/world-routes.d.ts +75 -0
  271. package/src/runtime/world-routes.js +673 -0
  272. package/src/styles/border-sweep.css +82 -0
  273. package/src/styles/glass.css +104 -0
  274. package/src/styles/motion.css +218 -0
  275. package/src/styles/reveal.css +51 -0
  276. package/src/vendor/paper/LICENSE +201 -0
  277. package/src/vendor/paper/NOTICE +5 -0
  278. package/src/vendor/paper/README.md +8 -0
  279. package/src/vendor/paper/get-shader-color-from-string.js +100 -0
  280. package/src/vendor/paper/get-shader-noise-texture.js +17 -0
  281. package/src/vendor/paper/presets.js +3678 -0
  282. package/src/vendor/paper/shader-sizing.js +37 -0
  283. package/src/vendor/paper/shader-utils.js +130 -0
  284. package/src/vendor/paper/shaders/color-panels.js +223 -0
  285. package/src/vendor/paper/shaders/dithering.js +270 -0
  286. package/src/vendor/paper/shaders/dot-grid.js +109 -0
  287. package/src/vendor/paper/shaders/dot-orbit.js +122 -0
  288. package/src/vendor/paper/shaders/fluted-glass.js +360 -0
  289. package/src/vendor/paper/shaders/gem-smoke.js +572 -0
  290. package/src/vendor/paper/shaders/god-rays.js +132 -0
  291. package/src/vendor/paper/shaders/grain-gradient.js +300 -0
  292. package/src/vendor/paper/shaders/halftone-cmyk.js +294 -0
  293. package/src/vendor/paper/shaders/halftone-dots.js +320 -0
  294. package/src/vendor/paper/shaders/heatmap.js +383 -0
  295. package/src/vendor/paper/shaders/image-dithering.js +198 -0
  296. package/src/vendor/paper/shaders/lens-distortion.js +275 -0
  297. package/src/vendor/paper/shaders/liquid-metal.js +632 -0
  298. package/src/vendor/paper/shaders/mesh-gradient.js +130 -0
  299. package/src/vendor/paper/shaders/metaballs.js +110 -0
  300. package/src/vendor/paper/shaders/neuro-noise.js +76 -0
  301. package/src/vendor/paper/shaders/paper-texture.js +526 -0
  302. package/src/vendor/paper/shaders/perlin-noise.js +166 -0
  303. package/src/vendor/paper/shaders/pulsing-border.js +238 -0
  304. package/src/vendor/paper/shaders/simplex-noise.js +91 -0
  305. package/src/vendor/paper/shaders/smoke-ring.js +132 -0
  306. package/src/vendor/paper/shaders/spiral.js +82 -0
  307. package/src/vendor/paper/shaders/static-mesh-gradient.js +130 -0
  308. package/src/vendor/paper/shaders/static-radial-gradient.js +187 -0
  309. package/src/vendor/paper/shaders/swirl.js +103 -0
  310. package/src/vendor/paper/shaders/voronoi.js +138 -0
  311. package/src/vendor/paper/shaders/warp.js +129 -0
  312. package/src/vendor/paper/shaders/water.js +121 -0
  313. package/src/vendor/paper/shaders/waves.js +65 -0
  314. package/src/vendor/paper/vertex-shader.js +159 -0
@@ -0,0 +1,216 @@
1
+ ---
2
+ /**
3
+ * Marquee: an endless strip that scrolls sideways, for "as featured in"
4
+ * logos, artist names, a ticker of offers. Pass `items` (text), or
5
+ * anything as the slot (logos, images, cards).
6
+ *
7
+ * The content is laid four times and the strip moves by one set, so the
8
+ * loop is seamless even when a set is narrower than the screen. The edges
9
+ * fade out rather than cutting, it can pause under the pointer, and a
10
+ * small pause button stops it for good (moving content needs one, WCAG
11
+ * 2.2.2). With reduced motion it is a still row, scrollable by hand.
12
+ * Screen readers get the content once.
13
+ *
14
+ * Merges the marquees of the WaveGrid, SellGrid, LinkGrid and LaunchGrid
15
+ * themes.
16
+ *
17
+ * @example
18
+ * <Marquee items={['Marcus Vane', 'Vivid Skye', 'Lunaire']} separator="✦" />
19
+ * <Marquee speed={30} direction="right"><img src="/press/wire.svg" alt="Wire" />…</Marquee>
20
+ */
21
+
22
+ interface Props {
23
+ /** Text items; or pass content as the slot. */
24
+ items?: string[];
25
+ /** Seconds for one set to pass. Default 40. */
26
+ speed?: number;
27
+ /** `left` scrolls right to left. Default `left`. */
28
+ direction?: 'left' | 'right';
29
+ /** Shown between items (text items only). */
30
+ separator?: string;
31
+ /** Space between items, CSS length. Default `2.5rem`. */
32
+ gap?: string;
33
+ /** Pause while the pointer is over it. Default true. */
34
+ pauseOnHover?: boolean;
35
+ /** Show a pause button. Default true. */
36
+ pauseButton?: boolean;
37
+ /** How wide the faded edges are, % of the strip. Default 8. */
38
+ fade?: number;
39
+ /** The pause button's labels, for other languages. Default English. */
40
+ labels?: { pause: string; resume: string };
41
+ /** What the strip is, for screen readers. Default the items joined. */
42
+ label?: string;
43
+ class?: string;
44
+ }
45
+
46
+ const {
47
+ items,
48
+ speed = 40,
49
+ direction = 'left',
50
+ separator,
51
+ gap = '2.5rem',
52
+ pauseOnHover = true,
53
+ pauseButton = true,
54
+ fade = 8,
55
+ labels = { pause: 'Pause scrolling', resume: 'Resume scrolling' },
56
+ label,
57
+ class: className,
58
+ } = Astro.props;
59
+
60
+ // Slot content is rendered once and laid again for the copies.
61
+ const slotted = items ? '' : await Astro.slots.render('default');
62
+ const sets = [0, 1, 2, 3];
63
+ ---
64
+
65
+ <div
66
+ class:list={['effect-marquee', `is-${direction}`, { 'pause-on-hover': pauseOnHover }, className]}
67
+ style={`--marquee-speed: ${speed}s; --marquee-gap: ${gap}; --marquee-fade: ${fade}%`}
68
+ role="region"
69
+ aria-label={label ?? items?.join(', ')}
70
+ data-effect-marquee
71
+ >
72
+ {
73
+ pauseButton && (
74
+ <button
75
+ type="button"
76
+ class="toggle"
77
+ data-marquee-toggle
78
+ data-pause={labels.pause}
79
+ data-resume={labels.resume}
80
+ aria-pressed="false"
81
+ aria-label={labels.pause}
82
+ >
83
+ <svg class="icon-pause" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
84
+ <rect x="6" y="5" width="4" height="14" rx="1" />
85
+ <rect x="14" y="5" width="4" height="14" rx="1" />
86
+ </svg>
87
+ <svg class="icon-play" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
88
+ <path d="M8 5v14l11-7z" />
89
+ </svg>
90
+ </button>
91
+ )
92
+ }
93
+ <div class="viewport">
94
+ <div class="track">
95
+ {
96
+ sets.map((set) => (
97
+ <div class="set" aria-hidden={set > 0 ? 'true' : undefined}>
98
+ {items
99
+ ? items.map((item) => (
100
+ <>
101
+ <span class="item">{item}</span>
102
+ {/* After every item, the last too: it separates the sets. */}
103
+ {separator && (
104
+ <span class="sep" aria-hidden="true">
105
+ {separator}
106
+ </span>
107
+ )}
108
+ </>
109
+ ))
110
+ : <Fragment set:html={slotted} />}
111
+ </div>
112
+ ))
113
+ }
114
+ </div>
115
+ </div>
116
+ </div>
117
+
118
+ <script>
119
+ import { mount } from '../runtime/mount.js';
120
+ import { marquee } from '../runtime/marquee.js';
121
+
122
+ mount('[data-effect-marquee]', marquee);
123
+ </script>
124
+
125
+ <style>
126
+ .effect-marquee {
127
+ position: relative;
128
+ }
129
+ /* The fade is on the strip, not the whole: the pause button stays clear of it. */
130
+ .viewport {
131
+ overflow: hidden;
132
+ -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--marquee-fade), #000 calc(100% - var(--marquee-fade)), transparent);
133
+ mask-image: linear-gradient(to right, transparent, #000 var(--marquee-fade), #000 calc(100% - var(--marquee-fade)), transparent);
134
+ }
135
+ .track {
136
+ display: flex;
137
+ width: max-content;
138
+ animation: effect-marquee var(--marquee-speed) linear infinite;
139
+ }
140
+ .is-right .track {
141
+ animation-direction: reverse;
142
+ }
143
+ .set {
144
+ display: flex;
145
+ align-items: center;
146
+ gap: var(--marquee-gap);
147
+ padding-right: var(--marquee-gap);
148
+ flex-shrink: 0;
149
+ white-space: nowrap;
150
+ }
151
+ .item,
152
+ .sep {
153
+ flex-shrink: 0;
154
+ }
155
+ .sep {
156
+ opacity: 0.5;
157
+ }
158
+ .pause-on-hover:hover .track,
159
+ .effect-marquee:global(.is-paused) .track {
160
+ animation-play-state: paused;
161
+ }
162
+ @keyframes effect-marquee {
163
+ to {
164
+ transform: translateX(-25%);
165
+ }
166
+ }
167
+
168
+ /* The pause button: small, pinned to the corner, above the faded edge. */
169
+ .toggle {
170
+ position: absolute;
171
+ top: 50%;
172
+ right: 0.35rem;
173
+ z-index: 2;
174
+ translate: 0 -50%;
175
+ display: inline-grid;
176
+ place-items: center;
177
+ width: 1.75rem;
178
+ height: 1.75rem;
179
+ padding: 0;
180
+ border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
181
+ border-radius: 999px;
182
+ background: color-mix(in srgb, Canvas 80%, transparent);
183
+ color: inherit;
184
+ cursor: pointer;
185
+ opacity: 0.7;
186
+ transition: opacity 0.15s;
187
+ }
188
+ .toggle:hover,
189
+ .toggle:focus-visible {
190
+ opacity: 1;
191
+ }
192
+ .toggle svg {
193
+ width: 0.85rem;
194
+ height: 0.85rem;
195
+ }
196
+ .icon-play,
197
+ .effect-marquee:global(.is-paused) .icon-pause {
198
+ display: none;
199
+ }
200
+ .effect-marquee:global(.is-paused) .icon-play {
201
+ display: block;
202
+ }
203
+
204
+ @media (prefers-reduced-motion: reduce) {
205
+ .viewport {
206
+ overflow-x: auto;
207
+ }
208
+ .track {
209
+ animation: none;
210
+ }
211
+ .set[aria-hidden='true'],
212
+ .toggle {
213
+ display: none;
214
+ }
215
+ }
216
+ </style>
@@ -0,0 +1,196 @@
1
+ ---
2
+ /**
3
+ * MosaicReveal: a slideshow of pictures that change through a GPU
4
+ * transition: tiles flipping over in a diagonal wave, a melt into sorted
5
+ * streaks, blocks coarsening and refining, or a dissolve with a glowing
6
+ * edge. For a product gallery or a portfolio hero. See
7
+ * src/runtime/mosaic-reveal.js.
8
+ *
9
+ * Fills its nearest positioned ancestor. It moves on every `interval`,
10
+ * held while hovered, focused or off screen; the arrow keys (once it has
11
+ * focus), a swipe and the dots move it too. The pictures are real images,
12
+ * so they are read out and show without WebGL, where they crossfade, as
13
+ * they do with reduced motion.
14
+ *
15
+ * @example
16
+ * <section class="hero" style="position: relative">
17
+ * <MosaicReveal images={[{ src: '/work/1.jpg', alt: 'A walnut stool' }, { src: '/work/2.jpg', alt: 'An oak bench' }]} transition="dissolve" />
18
+ * <h1>Furniture made <em>to outlive us.</em></h1>
19
+ * </section>
20
+ */
21
+ import type { MosaicRevealConfig } from '../runtime/mosaic-reveal.js';
22
+
23
+ interface Props extends MosaicRevealConfig {
24
+ /** The pictures, in order, each `{ src, alt }`: same origin, or served with CORS. */
25
+ images: { src: string; alt: string }[];
26
+ /** Dots that pick a picture, the current one filling as it plays. Default true. */
27
+ controls?: boolean;
28
+ /** What the slideshow is called, for assistive technology. Default `'Gallery'`. */
29
+ label?: string;
30
+ class?: string;
31
+ style?: string;
32
+ }
33
+
34
+ const { images, controls = true, label = 'Gallery', class: className, style, ...config } = Astro.props;
35
+ ---
36
+
37
+ <div
38
+ class:list={['mosaic-reveal', { 'has-controls': controls && images.length > 1 }, className]}
39
+ role="region"
40
+ aria-roledescription="carousel"
41
+ aria-label={label}
42
+ tabindex="0"
43
+ data-effect-mosaic-reveal
44
+ data-effect-config={JSON.stringify(config)}
45
+ style={[`background: ${config.background ?? '#0c0b0a'}`, style].filter(Boolean).join('; ')}
46
+ >
47
+ {
48
+ images.map((image, i) => (
49
+ <img
50
+ data-slide
51
+ src={image.src}
52
+ alt={image.alt}
53
+ crossorigin="anonymous"
54
+ decoding="async"
55
+ draggable="false"
56
+ loading={i === 0 ? 'eager' : 'lazy'}
57
+ fetchpriority={i === 0 ? 'high' : undefined}
58
+ class:list={{ 'is-front': i === 0 }}
59
+ hidden={i !== 0}
60
+ />
61
+ ))
62
+ }
63
+ <canvas aria-hidden="true"></canvas>
64
+ <div class="mosaic-reveal__dots">
65
+ {images.map((image, i) => <button type="button" data-slide-dot aria-current={i === 0 ? 'true' : undefined} aria-label={`Show picture ${i + 1} of ${images.length}: ${image.alt}`}></button>)}
66
+ </div>
67
+ <p class="mosaic-reveal__live" aria-live="polite" aria-atomic="true" data-slide-live></p>
68
+ </div>
69
+
70
+ <style>
71
+ .mosaic-reveal {
72
+ position: absolute;
73
+ inset: 0;
74
+ overflow: hidden;
75
+ touch-action: pan-y;
76
+ -webkit-user-select: none;
77
+ user-select: none;
78
+ -webkit-tap-highlight-color: transparent;
79
+ }
80
+ .mosaic-reveal:focus {
81
+ outline: none;
82
+ }
83
+ .mosaic-reveal:focus-visible {
84
+ outline: 2px solid rgb(255 255 255 / 0.85);
85
+ outline-offset: -6px;
86
+ }
87
+ img,
88
+ canvas {
89
+ position: absolute;
90
+ inset: 0;
91
+ display: block;
92
+ width: 100%;
93
+ height: 100%;
94
+ }
95
+ img {
96
+ object-fit: cover;
97
+ }
98
+ img[hidden] {
99
+ display: none;
100
+ }
101
+ img.is-front {
102
+ z-index: 1;
103
+ }
104
+ /* The canvas lies over the images once it has drawn (the runtime adds is-drawn). */
105
+ canvas {
106
+ z-index: 2;
107
+ opacity: 0;
108
+ pointer-events: none;
109
+ }
110
+ .is-drawn canvas {
111
+ opacity: 1;
112
+ }
113
+ .mosaic-reveal__dots {
114
+ position: absolute;
115
+ left: 50%;
116
+ bottom: var(--mosaic-reveal-dots-bottom, 28px);
117
+ z-index: 3;
118
+ display: none;
119
+ padding: 0 6px;
120
+ border-radius: 999px;
121
+ background: rgb(10 10 10 / 0.32);
122
+ -webkit-backdrop-filter: blur(10px);
123
+ backdrop-filter: blur(10px);
124
+ translate: -50% 0;
125
+ }
126
+ .has-controls .mosaic-reveal__dots {
127
+ display: flex;
128
+ }
129
+ /* A dot: a wide target round a small pill; the current one a longer track that fills as it plays. */
130
+ button {
131
+ position: relative;
132
+ width: 20px;
133
+ height: 28px;
134
+ padding: 0;
135
+ border: 0;
136
+ background: none;
137
+ cursor: pointer;
138
+ transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
139
+ }
140
+ button[aria-current] {
141
+ width: 44px;
142
+ }
143
+ button::before,
144
+ button::after {
145
+ content: '';
146
+ position: absolute;
147
+ top: 50%;
148
+ left: 6px;
149
+ right: 6px;
150
+ height: 8px;
151
+ margin-top: -4px;
152
+ border-radius: 4px;
153
+ background: rgb(255 255 255 / 0.42);
154
+ transition: background 0.2s;
155
+ }
156
+ button:hover::before {
157
+ background: rgb(255 255 255 / 0.7);
158
+ }
159
+ button::after {
160
+ background: #fff;
161
+ transform-origin: left;
162
+ scale: 0 1;
163
+ }
164
+ button[aria-current]::after {
165
+ scale: var(--slide-progress, 1) 1;
166
+ }
167
+ button:focus-visible {
168
+ outline: 2px solid #fff;
169
+ outline-offset: -2px;
170
+ border-radius: 8px;
171
+ }
172
+ @media (prefers-reduced-motion: reduce) {
173
+ button {
174
+ transition: none;
175
+ }
176
+ button[aria-current]::after {
177
+ scale: 1 1;
178
+ }
179
+ }
180
+ .mosaic-reveal__live {
181
+ position: absolute;
182
+ width: 1px;
183
+ height: 1px;
184
+ margin: -1px;
185
+ overflow: hidden;
186
+ clip-path: inset(50%);
187
+ white-space: nowrap;
188
+ }
189
+ </style>
190
+
191
+ <script>
192
+ import { mount } from '../runtime/mount.js';
193
+ import { mosaicReveal } from '../runtime/mosaic-reveal.js';
194
+
195
+ mount('[data-effect-mosaic-reveal]', mosaicReveal);
196
+ </script>
@@ -0,0 +1,38 @@
1
+ ---
2
+ /**
3
+ * NebulaLogo: a logo or a word filled with drifting nebula gas in the
4
+ * palette's colours, brightest towards its edges, with a glowing rim, a
5
+ * soft halo of gas leaking past the edge and faint stars twinkling inside.
6
+ * The pointer brightens the gas near it and stirs it as it moves.
7
+ * See src/runtime/nebula-logo.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
+ * <NebulaLogo src="/logo.svg" />
16
+ * <h1>…</h1>
17
+ * </section>
18
+ */
19
+ import EffectCanvas from './EffectCanvas.astro';
20
+ import type { NebulaLogoConfig } from '../runtime/nebula-logo.js';
21
+
22
+ interface Props extends NebulaLogoConfig {
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="nebula-logo" config={config} fixed={fixed} class={className} behind background={config.background ?? '#05070a'} />
32
+
33
+ <script>
34
+ import { mount } from '../runtime/mount.js';
35
+ import { nebulaLogo } from '../runtime/nebula-logo.js';
36
+
37
+ mount('[data-effect-nebula-logo]', nebulaLogo);
38
+ </script>
@@ -0,0 +1,38 @@
1
+ ---
2
+ /**
3
+ * NeonSwarm: a logo or a word held by a swarm of glowing particles that
4
+ * flows like a flock round its shape, shimmering and breathing, with short
5
+ * neon trails in the palette's colours. The pointer scatters them and they
6
+ * stream back; on arrival they gather from a loose cloud.
7
+ * See src/runtime/neon-swarm.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
+ * <NeonSwarm src="/logo.svg" />
16
+ * <h1>…</h1>
17
+ * </section>
18
+ */
19
+ import EffectCanvas from './EffectCanvas.astro';
20
+ import type { NeonSwarmConfig } from '../runtime/neon-swarm.js';
21
+
22
+ interface Props extends NeonSwarmConfig {
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="neon-swarm" config={config} fixed={fixed} class={className} behind background={config.background ?? '#030406'} />
32
+
33
+ <script>
34
+ import { mount } from '../runtime/mount.js';
35
+ import { neonSwarm } from '../runtime/neon-swarm.js';
36
+
37
+ mount('[data-effect-neon-swarm]', neonSwarm);
38
+ </script>
@@ -0,0 +1,40 @@
1
+ ---
2
+ /**
3
+ * Ocean: open sea to the horizon, photoreal, as a hero background. Waves
4
+ * at every scale run before the wind, sunlight glows through their thin
5
+ * crests, a glittering path runs out under the sun, whitecaps break on a
6
+ * rough sea and high cloud drifts in the sky and its reflection. `time`
7
+ * sets the hour (dawn, noon, sunset, a moonlit night); the camera drifts
8
+ * with the pointer. See src/runtime/ocean.js.
9
+ *
10
+ * Opaque: it is the whole background of what it fills (its nearest
11
+ * positioned ancestor, or the viewport with `fixed`). Without WebGL the
12
+ * scene shows as a gradient.
13
+ *
14
+ * @example
15
+ * <section class="hero" style="position: relative">
16
+ * <Ocean time="sunset" />
17
+ * <h1>Out past the <em>break.</em></h1>
18
+ * </section>
19
+ */
20
+ import EffectCanvas from './EffectCanvas.astro';
21
+ import { oceanBackdrop, oceanLook } from '../runtime/ocean/presets.js';
22
+ import type { OceanConfig } from '../runtime/ocean.js';
23
+
24
+ interface Props extends OceanConfig {
25
+ /** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
26
+ fixed?: boolean;
27
+ class?: string;
28
+ }
29
+
30
+ const { fixed = false, class: className, ...config } = Astro.props;
31
+ ---
32
+
33
+ <EffectCanvas name="ocean" config={config} fixed={fixed} class={className} behind background={oceanBackdrop(oceanLook(config), config.horizon)} />
34
+
35
+ <script>
36
+ import { mount } from '../runtime/mount.js';
37
+ import { ocean } from '../runtime/ocean.js';
38
+
39
+ mount('[data-effect-ocean]', ocean);
40
+ </script>