@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.
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 +303 -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,115 @@
1
+ ---
2
+ /**
3
+ * Reveal: content that rises, slides, zooms or un-blurs into place as it
4
+ * scrolls into view; with `words` and `text`, each word on its own, one
5
+ * after another. Visible without JavaScript (only once the script runs is
6
+ * it hidden to be revealed) and with reduced motion. See
7
+ * src/runtime/text-motion.js.
8
+ *
9
+ * For many elements by class across a site, use `<ScrollReveal />` and
10
+ * reveal.css instead.
11
+ *
12
+ * @example
13
+ * <Reveal from="up"><h2>Made for one kind of business</h2></Reveal>
14
+ * <Reveal as="h1" words text="Skip the build. Start selling." />
15
+ */
16
+ import type { HTMLTag } from 'astro/types';
17
+ import type { RevealConfig } from '../runtime/text-motion.js';
18
+ import { withStyle } from './style.js';
19
+
20
+ interface Props extends RevealConfig {
21
+ /** The element to render. Default `div`. */
22
+ as?: HTMLTag;
23
+ /** With `words`: the text, split into words. */
24
+ text?: string;
25
+ /** Seconds the arrival takes. Default 0.7. */
26
+ duration?: number;
27
+ /** How far it travels, px. Default 24. */
28
+ distance?: number;
29
+ class?: string;
30
+ [attribute: string]: unknown;
31
+ }
32
+
33
+ const {
34
+ as: Tag = 'div',
35
+ text,
36
+ words = false,
37
+ from = 'up',
38
+ stagger = 0.06,
39
+ delay = 0,
40
+ once = true,
41
+ duration = 0.7,
42
+ distance = 24,
43
+ class: className,
44
+ style: given,
45
+ ...attributes
46
+ } = Astro.props;
47
+ const split = words && text ? text.split(/(\s+)/) : null;
48
+ let index = 0;
49
+ ---
50
+
51
+ <Tag
52
+ class:list={['effect-reveal', `from-${from}`, { 'by-word': !!split }, className]}
53
+ data-effect-reveal
54
+ data-effect-config={JSON.stringify({ once })}
55
+ style={withStyle(`--reveal-duration: ${duration}s; --reveal-distance: ${distance}px; --reveal-delay: ${delay}s; --reveal-stagger: ${stagger}s`, given)}
56
+ aria-label={split ? text : undefined}
57
+ {...attributes}
58
+ >
59
+ {split ? split.map((part) => (/^\s+$/.test(part) ? part : <span class="word" aria-hidden="true" style={`--i: ${index++}`}>{part}</span>)) : <slot />}
60
+ </Tag>
61
+
62
+ <script>
63
+ import { mount } from '../runtime/mount.js';
64
+ import { reveal } from '../runtime/text-motion.js';
65
+
66
+ mount('[data-effect-reveal]', reveal);
67
+ </script>
68
+
69
+ <style>
70
+ .effect-reveal {
71
+ --reveal-from: translateY(var(--reveal-distance));
72
+ }
73
+ .from-down {
74
+ --reveal-from: translateY(calc(var(--reveal-distance) * -1));
75
+ }
76
+ .from-left {
77
+ --reveal-from: translateX(calc(var(--reveal-distance) * -1));
78
+ }
79
+ .from-right {
80
+ --reveal-from: translateX(var(--reveal-distance));
81
+ }
82
+ .from-fade {
83
+ --reveal-from: none;
84
+ }
85
+ .from-zoom {
86
+ --reveal-from: scale(0.94);
87
+ }
88
+ .from-blur {
89
+ --reveal-from: none;
90
+ }
91
+ .word {
92
+ display: inline-block;
93
+ }
94
+ /* Hidden only once the script has marked it waiting: without JS it shows. */
95
+ .effect-reveal:global(.is-waiting):not(.by-word),
96
+ .effect-reveal:global(.is-waiting) .word {
97
+ opacity: 0;
98
+ transform: var(--reveal-from);
99
+ transition:
100
+ opacity var(--reveal-duration) ease,
101
+ transform var(--reveal-duration) cubic-bezier(0.2, 0.8, 0.2, 1),
102
+ filter var(--reveal-duration) ease;
103
+ transition-delay: calc(var(--reveal-delay) + var(--i, 0) * var(--reveal-stagger));
104
+ }
105
+ .from-blur:global(.is-waiting):not(.by-word),
106
+ .from-blur:global(.is-waiting) .word {
107
+ filter: blur(8px);
108
+ }
109
+ .effect-reveal:global(.is-revealed):not(.by-word),
110
+ .effect-reveal:global(.is-revealed) .word {
111
+ opacity: 1;
112
+ transform: none;
113
+ filter: none;
114
+ }
115
+ </style>
@@ -0,0 +1,52 @@
1
+ ---
2
+ /**
3
+ * ScrambleText: text that resolves out of random characters, left to
4
+ * right, when it scrolls into view, and again on hover if asked. For a
5
+ * label, a stat, a short headline. Screen readers and search get the real
6
+ * text; the scramble is drawn over it. See src/runtime/text-motion.js.
7
+ *
8
+ * @example
9
+ * <h2><ScrambleText text="Inference at the edge" hover /></h2>
10
+ */
11
+ import type { HTMLTag } from 'astro/types';
12
+ import type { ScrambleConfig } from '../runtime/text-motion.js';
13
+
14
+ interface Props extends ScrambleConfig {
15
+ /** The text. */
16
+ text: string;
17
+ /** The element to render. Default `span`. */
18
+ as?: HTMLTag;
19
+ class?: string;
20
+ }
21
+
22
+ const { text, as: Tag = 'span', class: className, ...config } = Astro.props;
23
+ ---
24
+
25
+ <Tag class:list={['effect-scramble', className]} data-effect-scramble data-text={text} data-effect-config={JSON.stringify(config)}>
26
+ <span class="real">{text}</span>
27
+ <span class="shown" data-scramble-shown aria-hidden="true">{text}</span>
28
+ </Tag>
29
+
30
+ <script>
31
+ import { mount } from '../runtime/mount.js';
32
+ import { scramble } from '../runtime/text-motion.js';
33
+
34
+ mount('[data-effect-scramble]', scramble);
35
+ </script>
36
+
37
+ <style>
38
+ .effect-scramble {
39
+ position: relative;
40
+ display: inline-block;
41
+ }
42
+ /* The real text holds the space and is what assistive technology reads;
43
+ transparent, not hidden, so it is still read. */
44
+ .real {
45
+ color: transparent;
46
+ }
47
+ .shown {
48
+ position: absolute;
49
+ inset: 0;
50
+ white-space: nowrap;
51
+ }
52
+ </style>
@@ -0,0 +1,38 @@
1
+ ---
2
+ /**
3
+ * ScrollReveal: scroll reveal for a whole site by class. Put it once in
4
+ * the layout, then `class="fade-in-up"` (or any reveal.css class: fades,
5
+ * slides, zooms, flips, `blur-in`) on anything that should arrive as it
6
+ * scrolls into view. Survives view transitions; everything shows without
7
+ * JavaScript and with reduced motion. For one element, or word by word,
8
+ * use `<Reveal>`. See src/runtime/scroll-reveal.js.
9
+ *
10
+ * Replaces the reveal-astro package: the same classes and props.
11
+ *
12
+ * @example
13
+ * <ScrollReveal />
14
+ * <section class="fade-in-up">…</section>
15
+ * <div class="zoom-in" style="--reveal-delay: 0.1s">…</div>
16
+ */
17
+ import '../styles/reveal.css';
18
+ import type { ScrollRevealConfig } from '../runtime/scroll-reveal.js';
19
+
20
+ interface Props extends ScrollRevealConfig {}
21
+
22
+ const config = Astro.props;
23
+ ---
24
+
25
+ <script is:inline type="application/json" data-effect-scroll-reveal set:html={JSON.stringify(config)} />
26
+
27
+ <script>
28
+ import { scrollReveal } from '../runtime/scroll-reveal.js';
29
+
30
+ /** Starts (or restarts) the reveal with the settings the layout gave. */
31
+ const run = () => {
32
+ const settings = document.querySelector('[data-effect-scroll-reveal]');
33
+ scrollReveal(settings?.textContent ? JSON.parse(settings.textContent) : {});
34
+ };
35
+ document.addEventListener('astro:page-load', run);
36
+ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run, { once: true });
37
+ else run();
38
+ </script>
@@ -0,0 +1,55 @@
1
+ ---
2
+ /**
3
+ * ShaderBackground: six animated shader backgrounds for a hero or section,
4
+ * tinted from `--color-accent` with no settings (the page's, or a
5
+ * section's own): mesh-gradient, grain-gradient, silk, band-lens, grid
6
+ * and waves. See src/runtime/shader-background.js.
7
+ *
8
+ * Fills its nearest positioned ancestor (or the viewport with `fixed`)
9
+ * and fades out towards the bottom by default. Each is light over the
10
+ * page, clear where it is dark. Pass `static` for one frame when it is
11
+ * wallpaper behind body copy. Without WebGL, soft gradients in the same
12
+ * colours stand in.
13
+ *
14
+ * @example
15
+ * <section style="position: relative">
16
+ * <ShaderBackground effect="silk" speed={0.6} intensity={0.7} />
17
+ * <h1>Your hero</h1>
18
+ * </section>
19
+ * <ShaderBackground effect="mesh-gradient" static frame={14} intensity={0.45} fade="none" fixed />
20
+ */
21
+ import EffectCanvas from './EffectCanvas.astro';
22
+ import type { ShaderBackgroundConfig } from '../runtime/shader-background.js';
23
+
24
+ interface Props extends ShaderBackgroundConfig {
25
+ /** Its opacity, 0–1, to fade it against the section without changing the shader. Default 1. */
26
+ opacity?: number;
27
+ /** CSS `mix-blend-mode` with what is behind it (`screen`, `lighten`, `plus-lighter`…), for layering over imagery. Default normal. */
28
+ blend?: string;
29
+ /** Fade it out towards an edge, so it melts into the page: 'bottom', 'top', 'both' (top and bottom) or 'none'. Default 'bottom'. */
30
+ fade?: 'none' | 'bottom' | 'top' | 'both';
31
+ /** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
32
+ fixed?: boolean;
33
+ class?: string;
34
+ }
35
+
36
+ const { opacity = 1, blend, fade = 'bottom', fixed = false, class: className, ...config } = Astro.props;
37
+ ---
38
+
39
+ <EffectCanvas
40
+ name="shader-background"
41
+ config={config}
42
+ fixed={fixed}
43
+ behind
44
+ opacity={opacity}
45
+ blend={blend}
46
+ fade={fade === 'none' ? false : fade}
47
+ class={className}
48
+ />
49
+
50
+ <script>
51
+ import { mount } from '../runtime/mount.js';
52
+ import { shaderBackground } from '../runtime/shader-background.js';
53
+
54
+ mount('[data-effect-shader-background]', shaderBackground);
55
+ </script>
@@ -0,0 +1,41 @@
1
+ ---
2
+ /**
3
+ * SignalLines: layered waveform lines drawn as light, with a drifting loudness: sharp bright lines in front, soft out-of-focus ones behind, a shimmer where they cross, pulses of light running along them, and the pointer as a lens they part round. 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 lines carry the sound's waveform, as tall as it is loud, and kicks
12
+ * send pulses; 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
+ * <SignalLines />
19
+ * <h1>…</h1>
20
+ * </section>
21
+ */
22
+ import EffectCanvas from './EffectCanvas.astro';
23
+ import type { SignalLinesConfig } from '../runtime/waves.js';
24
+
25
+ interface Props extends SignalLinesConfig {
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="signal-lines" config={config} class={className} fade={fade} />
35
+
36
+ <script>
37
+ import { mount } from '../runtime/mount.js';
38
+ import { signalLines } from '../runtime/waves.js';
39
+
40
+ mount('[data-effect-signal-lines]', signalLines);
41
+ </script>
@@ -0,0 +1,37 @@
1
+ ---
2
+ /**
3
+ * SilkRibbon: a wide ribbon of satin twisting across a light ground, soft
4
+ * folds gathering where it turns and a sheen along each one, with an
5
+ * out-of-focus glow of the same colours behind it. The folds undulate
6
+ * slowly and lean towards the pointer. See src/runtime/silk-ribbon.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
+ * `background` colour shows.
11
+ *
12
+ * @example
13
+ * <section class="hero" style="position: relative">
14
+ * <SilkRibbon side="right" />
15
+ * <h1>Soft to the touch.</h1>
16
+ * </section>
17
+ */
18
+ import EffectCanvas from './EffectCanvas.astro';
19
+ import type { SilkRibbonConfig } from '../runtime/silk-ribbon.js';
20
+
21
+ interface Props extends SilkRibbonConfig {
22
+ /** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
23
+ fixed?: boolean;
24
+ class?: string;
25
+ }
26
+
27
+ const { fixed = false, class: className, ...config } = Astro.props;
28
+ ---
29
+
30
+ <EffectCanvas name="silk-ribbon" config={config} fixed={fixed} class={className} behind background={config.background ?? '#f6f4f1'} />
31
+
32
+ <script>
33
+ import { mount } from '../runtime/mount.js';
34
+ import { silkRibbon } from '../runtime/silk-ribbon.js';
35
+
36
+ mount('[data-effect-silk-ribbon]', silkRibbon);
37
+ </script>
@@ -0,0 +1,131 @@
1
+ ---
2
+ /**
3
+ * SpotlightText: one line of text as a faint outline that a light under
4
+ * the pointer fills in, falling off as light does: bright for a short
5
+ * way, then a long soft tail. See src/runtime/spotlight.js.
6
+ *
7
+ * Two fills:
8
+ * - `dodge` (default, for light text on a dark or colourful background):
9
+ * the lit letters show what is behind them, brightened, as light
10
+ * through glass. Blends with what is behind, so no ancestor between
11
+ * the text and the background may form a stacking context (no
12
+ * z-index, opacity, transform, filter or isolation on the way).
13
+ * - `solid`: the lit letters fill with the light itself, a hot white core
14
+ * fading through the text colour, and the outline catches it a little
15
+ * further out (for a plain dark or light background).
16
+ *
17
+ * With `fit`, the text is sized to span its parent's width (a footer
18
+ * wordmark). Any other attribute is passed to the element.
19
+ *
20
+ * @example
21
+ * <SpotlightText as="div" class="wordmark" aria-hidden="true">LumiThemes</SpotlightText>
22
+ */
23
+ import type { HTMLTag } from 'astro/types';
24
+ import type { SpotlightConfig } from '../runtime/spotlight.js';
25
+ import { withStyle } from './style.js';
26
+
27
+ interface Props extends SpotlightConfig {
28
+ /** The element to render. Default `span`. */
29
+ as?: HTMLTag;
30
+ /** The outline's width. Default `1.5px`. */
31
+ stroke?: string;
32
+ /** How the lit letters fill. Default `dodge`. */
33
+ fill?: 'dodge' | 'solid';
34
+ /** Size the text to span its parent's width. Default false. */
35
+ fit?: boolean;
36
+ class?: string;
37
+ [attribute: string]: unknown;
38
+ }
39
+
40
+ const { as: Tag = 'span', radius, reach, stroke = '1.5px', fill = 'dodge', fit = false, class: className, style: given, ...attributes } = Astro.props;
41
+ ---
42
+
43
+ <Tag
44
+ class:list={['effect-spotlight', className]}
45
+ data-effect-spotlight
46
+ data-effect-config={JSON.stringify({ radius, reach })}
47
+ data-fill={fill}
48
+ data-fit-text={fit ? '' : undefined}
49
+ style={withStyle(`--spot-stroke: ${stroke}`, given)}
50
+ {...attributes}
51
+ >
52
+ <slot />
53
+ </Tag>
54
+
55
+ <script>
56
+ import { mount } from '../runtime/mount.js';
57
+ import { spotlight } from '../runtime/spotlight.js';
58
+ import { fitText } from '../runtime/fit-text.js';
59
+
60
+ mount('[data-fit-text]', fitText);
61
+ mount('[data-effect-spotlight]', spotlight);
62
+ </script>
63
+
64
+ <style>
65
+ .effect-spotlight {
66
+ position: relative;
67
+ /* At rest, a faint outline, so the word is there before the light
68
+ finds it. The fill is hidden with the FILL colour, so `color` still
69
+ sets the ink. */
70
+ -webkit-text-fill-color: transparent;
71
+ -webkit-text-stroke: var(--spot-stroke) color-mix(in srgb, currentColor 32%, transparent);
72
+ }
73
+ /* The light, falling off as light does: bright for a short way, then a
74
+ long soft tail, never a hard edge. */
75
+ .effect-spotlight::before,
76
+ .effect-spotlight::after {
77
+ content: attr(data-text);
78
+ position: absolute;
79
+ inset: 0;
80
+ pointer-events: none;
81
+ --spot: radial-gradient(
82
+ circle var(--spot-r, 0px) at var(--spot-x, 50%) var(--spot-y, 50%),
83
+ #000,
84
+ rgb(0 0 0 / 0.82) 14%,
85
+ rgb(0 0 0 / 0.52) 32%,
86
+ rgb(0 0 0 / 0.26) 52%,
87
+ rgb(0 0 0 / 0.09) 74%,
88
+ transparent
89
+ );
90
+ -webkit-mask-image: var(--spot);
91
+ mask-image: var(--spot);
92
+ }
93
+ /* Solid: the letters lit, a hot white core fading through the ink. */
94
+ .effect-spotlight[data-fill='solid']::before {
95
+ -webkit-text-stroke: 0;
96
+ -webkit-text-fill-color: transparent;
97
+ background: radial-gradient(
98
+ circle var(--spot-r, 0px) at var(--spot-x, 50%) var(--spot-y, 50%),
99
+ #fff,
100
+ color-mix(in srgb, currentColor 92%, #fff) 18%,
101
+ currentColor 45%,
102
+ color-mix(in srgb, currentColor 55%, transparent) 75%,
103
+ transparent
104
+ );
105
+ -webkit-background-clip: text;
106
+ background-clip: text;
107
+ }
108
+ /* The rim: the outline catching the light a little further out than the fill. */
109
+ .effect-spotlight[data-fill='solid']::after {
110
+ -webkit-text-fill-color: transparent;
111
+ -webkit-text-stroke: var(--spot-stroke) currentColor;
112
+ --spot: radial-gradient(
113
+ circle calc(var(--spot-r, 0px) * 1.35) at var(--spot-x, 50%) var(--spot-y, 50%),
114
+ #000,
115
+ rgb(0 0 0 / 0.5) 40%,
116
+ transparent
117
+ );
118
+ }
119
+ /* Dodge: a dodge brightens the colour behind without washing it out, and
120
+ a faint white over it keeps the letters readable where it is dark. */
121
+ .effect-spotlight[data-fill='dodge']::before {
122
+ -webkit-text-stroke: 0;
123
+ -webkit-text-fill-color: rgb(150 150 150);
124
+ mix-blend-mode: color-dodge;
125
+ }
126
+ .effect-spotlight[data-fill='dodge']::after {
127
+ -webkit-text-stroke: 0;
128
+ -webkit-text-fill-color: rgb(255 255 255 / 0.16);
129
+ mix-blend-mode: plus-lighter;
130
+ }
131
+ </style>
@@ -0,0 +1,79 @@
1
+ ---
2
+ /**
3
+ * Tilt: a card, an image or an object that leans towards the pointer in
4
+ * perspective while it is over it, with a soft glare that follows, and
5
+ * settles back when it leaves. See src/runtime/tilt.js.
6
+ *
7
+ * A few degrees reads as depth; more reads as motion sickness. Off with
8
+ * prefers-reduced-motion and on touch screens (it simply sits still).
9
+ *
10
+ * @example
11
+ * <Tilt as="a" href="/release" class="card" max={6} glare>…</Tilt>
12
+ */
13
+ import type { HTMLTag } from 'astro/types';
14
+ import { withStyle } from './style.js';
15
+
16
+ interface Props {
17
+ /** The element to render. Default `div`. */
18
+ as?: HTMLTag;
19
+ /** The most it leans, degrees. Default 8. */
20
+ max?: number;
21
+ /** The perspective's distance, px; smaller is more dramatic. Default 900. */
22
+ perspective?: number;
23
+ /** A light glare that follows the pointer. Default false. */
24
+ glare?: boolean;
25
+ /** How far it lifts towards the viewer while tilted, px. Default 0. */
26
+ lift?: number;
27
+ /** A selector for a larger region to follow the pointer over. Default the element. */
28
+ within?: string;
29
+ class?: string;
30
+ [attribute: string]: unknown;
31
+ }
32
+
33
+ const { as: Tag = 'div', max, perspective = 900, glare = false, lift = 0, within, class: className, style: given, ...attributes } = Astro.props;
34
+ ---
35
+
36
+ <Tag
37
+ class:list={['effect-tilt', { 'has-glare': glare }, className]}
38
+ data-effect-tilt
39
+ data-effect-config={JSON.stringify({ max, within })}
40
+ style={withStyle(`--tilt-perspective: ${perspective}px; --tilt-lift: ${lift}px`, given)}
41
+ {...attributes}
42
+ >
43
+ <slot />
44
+ </Tag>
45
+
46
+ <script>
47
+ import { mount } from '../runtime/mount.js';
48
+ import { tilt } from '../runtime/tilt.js';
49
+
50
+ mount('[data-effect-tilt]', tilt);
51
+ </script>
52
+
53
+ <style>
54
+ .effect-tilt {
55
+ position: relative;
56
+ transform: perspective(var(--tilt-perspective)) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
57
+ transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
58
+ transform-style: preserve-3d;
59
+ will-change: transform;
60
+ }
61
+ /* While following the pointer it moves at once; only settling back eases. */
62
+ .effect-tilt:global(.is-tilting) {
63
+ transform: perspective(var(--tilt-perspective)) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) translateZ(var(--tilt-lift));
64
+ transition: transform 0.12s linear;
65
+ }
66
+ .effect-tilt.has-glare::after {
67
+ content: '';
68
+ position: absolute;
69
+ inset: 0;
70
+ border-radius: inherit;
71
+ pointer-events: none;
72
+ background: radial-gradient(circle at var(--glare-x, 50%) var(--glare-y, 50%), rgb(255 255 255 / 0.22), transparent 55%);
73
+ opacity: 0;
74
+ transition: opacity 0.3s ease;
75
+ }
76
+ .effect-tilt.has-glare:global(.is-tilting)::after {
77
+ opacity: 1;
78
+ }
79
+ </style>
@@ -0,0 +1,38 @@
1
+ ---
2
+ /**
3
+ * Topography: a survey map that never sits still. The contour lines of a
4
+ * slowly drifting landscape, every fifth an index line drawn heavier, at
5
+ * a constant pixel width. Under the pointer the ground swells and its
6
+ * lines glow; `labels` sets small elevation numbers on a few index lines.
7
+ * See src/runtime/topography.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
+ * <Topography colors={['#8a5a33']} background="#f3ead6" labels />
16
+ * <h1>Every trail, <em>walked first.</em></h1>
17
+ * </section>
18
+ */
19
+ import EffectCanvas from './EffectCanvas.astro';
20
+ import type { TopographyConfig } from '../runtime/topography.js';
21
+
22
+ interface Props extends TopographyConfig {
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="topography" config={config} fixed={fixed} class={className} behind background={config.background ?? '#0c1a2b'} />
32
+
33
+ <script>
34
+ import { mount } from '../runtime/mount.js';
35
+ import { topography } from '../runtime/topography.js';
36
+
37
+ mount('[data-effect-topography]', topography);
38
+ </script>
@@ -0,0 +1,66 @@
1
+ ---
2
+ /**
3
+ * Typewriter: types phrases one after another behind a blinking caret,
4
+ * deleting each before the next. "Sell beats / sample packs / presets."
5
+ * Screen readers get the phrases as a list once, not a stream of letters;
6
+ * with reduced motion the first phrase simply shows. See
7
+ * src/runtime/text-motion.js.
8
+ *
9
+ * @example
10
+ * <h1>Sell <Typewriter phrases={['beats', 'sample packs', 'presets']} /> online.</h1>
11
+ */
12
+ import type { TypewriterConfig } from '../runtime/text-motion.js';
13
+
14
+ interface Props extends TypewriterConfig {
15
+ /** The caret's colour. Default the text colour. */
16
+ caret?: string;
17
+ class?: string;
18
+ }
19
+
20
+ const { caret = 'currentColor', class: className, ...config } = Astro.props;
21
+ ---
22
+
23
+ <span class:list={['effect-typewriter', className]} data-effect-typewriter data-effect-config={JSON.stringify(config)} style={`--caret: ${caret}`}>
24
+ <span class="sr-only">{config.phrases.join(', ')}</span>
25
+ <span class="typed" data-typed aria-hidden="true">{config.phrases[0]}</span><span class="caret" aria-hidden="true"></span>
26
+ </span>
27
+
28
+ <script>
29
+ import { mount } from '../runtime/mount.js';
30
+ import { typewriter } from '../runtime/text-motion.js';
31
+
32
+ mount('[data-effect-typewriter]', typewriter);
33
+ </script>
34
+
35
+ <style>
36
+ .effect-typewriter {
37
+ white-space: nowrap;
38
+ }
39
+ .sr-only {
40
+ position: absolute;
41
+ width: 1px;
42
+ height: 1px;
43
+ overflow: hidden;
44
+ clip-path: inset(50%);
45
+ white-space: nowrap;
46
+ }
47
+ .caret {
48
+ display: inline-block;
49
+ width: 0.08em;
50
+ height: 1em;
51
+ margin-left: 0.06em;
52
+ vertical-align: -0.1em;
53
+ background: var(--caret);
54
+ animation: effect-caret 1s steps(1) infinite;
55
+ }
56
+ @keyframes effect-caret {
57
+ 50% {
58
+ opacity: 0;
59
+ }
60
+ }
61
+ @media (prefers-reduced-motion: reduce) {
62
+ .caret {
63
+ animation: none;
64
+ }
65
+ }
66
+ </style>