@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
package/LICENSE ADDED
@@ -0,0 +1,139 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ArrayPress Limited
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ src/runtime/fluid.js adapts the solver of WebGL-Fluid-Simulation
26
+ (https://github.com/PavelDoGreat/WebGL-Fluid-Simulation), under its licence:
27
+
28
+ MIT License
29
+
30
+ Copyright (c) 2017 Pavel Dobryakov
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining a copy
33
+ of this software and associated documentation files (the "Software"), to deal
34
+ in the Software without restriction, including without limitation the rights
35
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36
+ copies of the Software, and to permit persons to whom the Software is
37
+ furnished to do so, subject to the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be included in all
40
+ copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
48
+ SOFTWARE.
49
+
50
+ ---
51
+
52
+ src/runtime/fluted-glass.js adapts the flute geometry and highlight of the
53
+ FlutedGlass component, and src/runtime/glass-glyph.js the lens model of the
54
+ Glass component, in Shaders (https://github.com/shader-effects-inc/shaders),
55
+ under its licence:
56
+
57
+ MIT License
58
+
59
+ Copyright (c) 2026 Shader Effects Inc.
60
+
61
+ Permission is hereby granted, free of charge, to any person obtaining a copy
62
+ of this software and associated documentation files (the "Software"), to deal
63
+ in the Software without restriction, including without limitation the rights
64
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
65
+ copies of the Software, and to permit persons to whom the Software is
66
+ furnished to do so, subject to the following conditions:
67
+
68
+ The above copyright notice and this permission notice shall be included in all
69
+ copies or substantial portions of the Software.
70
+
71
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
72
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
73
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
74
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
75
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
76
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
77
+ SOFTWARE.
78
+
79
+ ---
80
+
81
+ The hash in src/runtime/shader-backgrounds/grain-gradient.js is Dave Hoskins'
82
+ "Hash without Sine" (https://www.shadertoy.com/view/4djSRW):
83
+
84
+ Copyright (c) 2014 David Hoskins
85
+
86
+ Permission is hereby granted, free of charge, to any person obtaining a copy
87
+ of this software and associated documentation files (the "Software"), to deal
88
+ in the Software without restriction, including without limitation the rights
89
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
90
+ copies of the Software, and to permit persons to whom the Software is
91
+ furnished to do so, subject to the following conditions:
92
+
93
+ The above copyright notice and this permission notice shall be included in all
94
+ copies or substantial portions of the Software.
95
+
96
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
97
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
98
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
99
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
100
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
101
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
102
+ SOFTWARE.
103
+
104
+ ---
105
+
106
+ src/runtime/lens-map.js and src/runtime/liquid-glass.js adapt the technique
107
+ of liquid-glass (https://github.com/samasante/liquid-glass): a rounded
108
+ rectangle's signed distance field rasterised to a displacement map with a
109
+ specular channel, fed to feDisplacementMap through backdrop-filter, with a
110
+ three-pass RGB split for dispersion. Under its licence:
111
+
112
+ MIT License
113
+
114
+ Copyright (c) 2026 Sam Asante
115
+
116
+ Permission is hereby granted, free of charge, to any person obtaining a copy
117
+ of this software and associated documentation files (the "Software"), to deal
118
+ in the Software without restriction, including without limitation the rights
119
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
120
+ copies of the Software, and to permit persons to whom the Software is
121
+ furnished to do so, subject to the following conditions:
122
+
123
+ The above copyright notice and this permission notice shall be included in all
124
+ copies or substantial portions of the Software.
125
+
126
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
127
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
128
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
129
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
130
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
131
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
132
+ SOFTWARE.
133
+
134
+ ---
135
+
136
+ src/vendor/paper/ contains Paper Shaders (https://github.com/paper-design/shaders),
137
+ Copyright 2026 Paper, licensed under the Apache License, Version 2.0; see
138
+ src/vendor/paper/LICENSE for the licence and src/vendor/paper/NOTICE for its
139
+ notice ("Powered by Paper Shaders: https://shaders.paper.design").
package/README.md CHANGED
@@ -1,3 +1,198 @@
1
- # Temporary Holding Version
1
+ # @arraypress/effects-astro
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Effects for Astro sites, as components: shader backgrounds, a real fluid, logos made of glass, particles or cubes, text that glitches, scrambles or types itself, glass panels and marquees: what makes a page look alive. Small UI pieces (countdowns, sliders, drop zones, tooltips) live in [`@arraypress/ui-astro`](https://github.com/LumiThemes/ui-astro); counters and drag-to-scroll in [`@arraypress/behaviors-astro`](https://github.com/arraypress/behaviors-astro). Plain WebGL, Canvas and CSS with no dependencies, and with the fallbacks a theme needs built in.
4
+
5
+ ```astro
6
+ ---
7
+ import LightField from '@arraypress/effects-astro/LightField.astro';
8
+ ---
9
+ <LightField fixed colors={['#7c3aed', '#db2777', '#06b6d4']} />
10
+ ```
11
+
12
+ Every prop of every component is in **[COMPONENTS.md](COMPONENTS.md)**, generated from the components' own types.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ npm install @arraypress/effects-astro
18
+ ```
19
+
20
+ Astro 6 or 7. The runtime underneath (`@arraypress/effects-astro`) works without Astro.
21
+
22
+ ## What every effect does for you
23
+
24
+ - **Runs only when it is seen.** One animation loop for the page; an effect draws only while it is within 128px of the viewport and the tab is showing.
25
+ - **Draws at what the device can afford.** The pixel ratio is capped at 2 on a desktop and 1.5 on a phone or tablet, and heavier passes (the light's prism split) are dropped on phones.
26
+ - **Respects reduced motion.** Every effect has a still state: one frame, a static date, the text simply there.
27
+ - **Has a fallback.** No WebGL: a still gradient, or the element's background. No hovering pointer: nothing waits for a hover.
28
+ - **Keeps content readable.** Effects are decoration (`aria-hidden`); real text stays in the page for screen readers and search; moving content has a pause button where it runs on.
29
+ - **Survives view transitions.** Effects start on `astro:page-load` and stop when their element leaves the page.
30
+ - **Mixes colour in Oklab**, so palettes blend without muddy midpoints.
31
+ - **Sends nothing anywhere.** No telemetry, no network.
32
+
33
+ ## The effects
34
+
35
+ **Backgrounds** (fill their section, or the page with `fixed`)
36
+
37
+ | Component | | Drawn with |
38
+ |---|---|---|
39
+ | `<LightField>` | Liquid light in three colours with caustic glints and a pointer lens, over a real fluid that the pointer stirs and a click drops ink into | WebGL |
40
+ | `<Ink>` | The fluid on its own: ink in water over whatever is behind | WebGL 2 |
41
+ | `<InkField>` | Ink in water, lit by a lamp that follows the pointer: slow emitters keep it moving, the pointer stirs it, twelve named palettes (`palette="Peacock"`) that a palette switcher recolours live; with `audio`, the beat stirs it | WebGL |
42
+ | `<AsciiRain>` | Streams of data in text characters, rows sliding at their own pace, a cool cyan-green cast, a lens fringe and the odd glitch (or, with `pattern="waves"`, streaks on a rippling 3D surface) | WebGL |
43
+ | `<FlutedGlass>` | Slanted fluted glass bending soft blooms of colour, one following the pointer | WebGL |
44
+ | `<DotGrid>` | A sea of dots with a drifting current; a click sends a ripple across | Canvas |
45
+ | `<SignalLines>` | Waveform lines drawn as light: sharp in front, out of focus and lens-fringed behind, a shimmer where they cross, pulses of light running along them, and the pointer a lens they part round; with `audio`, the waveform of the sound playing | WebGL |
46
+ | `<WaveBars>` | A glowing bar waveform over its reflection, retuning like a meter with peak caps that hold and fall, a playhead that lights the bars it plays, and the pointer scrubbing; with `audio`, the spectrum of the sound playing on the page | WebGL |
47
+ | `<DotSurface>` | A halftone sea: dots on a slowly rolling sheet in perspective, sized and lit by the light; the pointer raises a swell, a click sends a ring | WebGL |
48
+ | `<ShaderBackground>` | Six shader backgrounds by name (`mesh-gradient`, `grain-gradient`, `silk`, `band-lens`, `grid`, `waves`), tinted from the page's `--color-accent` unless given `colors`; `static` for wallpaper | WebGL |
49
+ | `<HaloRing>` | A ring of light around centred copy: a soft-cornered outline drifting between a hexagon and a rounded rectangle, colour travelling round it and burning white where it is hottest, glowing far outward; the pointer draws it close | WebGL |
50
+ | `<SilkRibbon>` | A wide ribbon of satin twisting across a light ground, folds gathering where it turns and a sheen along each, over a soft glow; the folds undulate and lean to the pointer | WebGL |
51
+ | `<Topography>` | A survey map that never sits still: crisp contour lines of a slowly drifting landscape, every fifth heavier; the pointer lifts the ground and lights its lines, `labels` adds elevation numbers | WebGL |
52
+ | `<Caustics>` | Sunlight rippling through water onto a pool floor: a shifting net of light with a faint rainbow at its edges, stirred by the pointer; optional tiles | WebGL |
53
+ | `<RainOnGlass>` | Rain on a window over a photo: beads, drops running down in clearing trails, each a lens holding the scene upside down, soft bokeh behind fog; the pointer wipes a patch | WebGL |
54
+ | `<Ocean>` | Photoreal open sea to the horizon: wind-driven waves, a glittering sun path, light through thin crests, whitecaps, high cloud and haze; `time` dawn, noon, sunset or a moonlit night; the camera drifts with the pointer | WebGL |
55
+ | `<IsoCity>` | A tiny isometric low-poly city with traffic keeping its lanes and the brand's taxis; click a street and the nearest one drives round to pick you up; `night` lights the windows and headlights | WebGL |
56
+ | `<ColorPanels>` | Translucent panels of colour swinging open out of the dark and sweeping past like turning pages: Paper's color-panels shader with plain props (`density`, `skewLeft`, `length`, `edges`, `blur`, `blend`…), its Opening preset by default (`preset` for the others) | WebGL 2 |
57
+ | `<WorldRoutes>` | A dotted world map with comets of light arcing between cities: a home hub, per-route colours and Oklab gradients, labels, regions, great-circle arcs, hover | Canvas |
58
+ | `<GlowField>` | A light to lay over a background: a bloom, a swaying stage spotlight, a horizon or a wash, breathing gently | CSS |
59
+ | `<Grain>` | Flickering film grain, to dither smooth gradients and make a picture read as film | CSS |
60
+
61
+ **Paper shaders**: `<PaperShader shader="mesh-gradient" preset="beach">`, any of the 30 shaders from [Paper](https://shaders.paper.design) with each of their 124 presets, run on the same loop and guarantees as the rest. Pass `params` to change any setting, `colors` for the palette, and `image` for the shaders that work on a picture (your logo in `liquid-metal`, `heatmap` or `gem-smoke`; a photo in `fluted-glass`, `halftone-dots`, `water` or `image-dithering`). The looks worth keeping become backgrounds of their own, with plain props: `<ColorPanels>` so far.
62
+
63
+ `color-panels`, `dithering`, `dot-grid`, `dot-orbit`, `fluted-glass`, `gem-smoke`, `god-rays`, `grain-gradient`, `halftone-cmyk`, `halftone-dots`, `heatmap`, `image-dithering`, `lens-distortion`, `liquid-metal`, `mesh-gradient`, `metaballs`, `neuro-noise`, `paper-texture`, `perlin-noise`, `pulsing-border`, `simplex-noise`, `smoke-ring`, `spiral`, `static-mesh-gradient`, `static-radial-gradient`, `swirl`, `voronoi`, `warp`, `water`, `waves`. The demo shows every preset.
64
+
65
+ **Logos and shapes** (`text` in any font, or `src`: your own SVG or PNG)
66
+
67
+ | Component | | Drawn with |
68
+ |---|---|---|
69
+ | `<GlassGlyph>` | The logo as a thick bevelled slab of glass, swaying slowly in front of fixed beams of coloured light that bend through its rims | WebGL |
70
+ | `<LiquidMetal>` | The logo as liquid chrome in a slowly turning studio: the pointer dents it and sends ripples across it, a stroke parts it, a click splashes it (a crater, a ring wave, droplets that crawl back), and it pulls itself back into shape; `tint` for gold, rose gold, copper or black chrome | WebGL |
71
+ | `<ParticleLogo>` | The logo in thousands of twinkling particles that scatter round the pointer | WebGL |
72
+ | `<NeonSwarm>` | The logo held by a swarm of neon particles that flows like a flock, trails light and scatters from the pointer | WebGL |
73
+ | `<NebulaLogo>` | The logo filled with drifting nebula gas, a glowing rim, a halo past its edge and twinkling stars; the pointer stirs it | WebGL |
74
+ | `<PointCloud>` | A word as a dot matrix among drifting point clouds, optional tracker boxes | WebGL |
75
+ | `<VoxelLogo>` | The logo built of cubes, rocking in 3D, dithered to two inks, optional markers | WebGL |
76
+
77
+ **Text**
78
+
79
+ | Component | | Drawn with |
80
+ |---|---|---|
81
+ | `<SpotlightText>` | An outline a soft light under the pointer fills in | CSS + JS |
82
+ | `<PixelGlitchText>` | Text that breaks into pixels under the pointer | Canvas |
83
+ | `<OutlineWordmark>` | A huge outlined name sinking out of the page, a beam passing through and a light under the pointer filling the letters | CSS + SVG |
84
+ | `<FitText>` | One line sized to span its parent exactly | JS |
85
+ | `<ScrambleText>` | Text resolving out of random characters | JS |
86
+ | `<Typewriter>` | Phrases typed one after another behind a caret | JS |
87
+ | `<Reveal>` | Content, or each word, rising into place on scroll | CSS + JS |
88
+ | `<ScrollReveal>` | Once in a layout: anything with a reveal.css class (`fade-in-up`, `zoom-in`, `flip-left`…) arrives on scroll | CSS + JS |
89
+ | `<HighlightSweep>` | A marker underline sweeping in under a word | CSS |
90
+ | `<Marquee>` | An endless strip of names or logos, with a pause button | CSS + JS |
91
+ | `<VariableType>` | A variable-font headline whose letters swell heavier and wider under the pointer in a springy wave, and drift gently on their own | JS |
92
+
93
+ **Surfaces and interaction**
94
+
95
+ | Component | | Drawn with |
96
+ |---|---|---|
97
+ | `<ImageRipple>` | A hero photo that ripples like water under the pointer: a wake as it moves, a ring where you click, a soft colour split at the wave fronts and light on the crests, then back to the still, sharp photo; a real `<img>` underneath | WebGL |
98
+ | `<ProductStack>` | A store's product covers floating in a 3D fan, stack or carousel arc with depth of field and a glossy sheen; leans to the pointer, fans apart on hover, lifts the cover under it; real, focusable links | CSS + JS |
99
+ | `<MosaicReveal>` | A slideshow whose pictures change through a GPU transition: tiles flipping in a diagonal wave, a pixel-sort melt, pixelation or a glowing dissolve | WebGL |
100
+ | `<RadiantGlass>` | A cluster of frosted glass tiles on a dark ground, glowing from inside with soft drifting light that shifts with the pointer; a two-tone rim and a halo on each | WebGL |
101
+ | `<Glass>` | A liquid glass panel with a lit rim and a pointer sheen; `refract` bends the live page behind it like a thick lens, with colour at the rim (Chromium; elsewhere it stays frosted) | CSS + JS |
102
+ | `<BorderSweep>` | A light travelling round an outline | CSS |
103
+ | `<Tilt>` | A card that leans towards the pointer, with a glare | CSS + JS |
104
+ | `<Parallax>` | Layers that drift with the pointer by depth | CSS + JS |
105
+ | `<Magnetic>` | A button the pointer pulls on | CSS + JS |
106
+ | `<Cursor>` | A dot and a trailing ring that swells over links | CSS + JS |
107
+ | `<PulseMark>` | A small animated mark: LED matrix, turning rings or sonar | SVG + CSS |
108
+
109
+ **Stylesheets**, for elements you render yourself:
110
+
111
+ | Import | Classes |
112
+ |---|---|
113
+ | `@arraypress/effects-astro/glass.css` | `.glass` (call `glassSheen()` once for the sheen) |
114
+ | `@arraypress/effects-astro/border-sweep.css` | `.sweep-ring`, `--always`, `--fast` |
115
+ | `@arraypress/effects-astro/motion.css` | `.fx-pulse-ring`, `.fx-heartbeat`, `.fx-bump` (replay with `bump(el)`), `.fx-shimmer`, `.fx-pulse`, `.fx-wiggle`, `.fx-shake`, `.fx-settle`, `.fx-live` (a status dot) |
116
+ | `@arraypress/effects-astro/reveal.css` | `.fade-in`, `.fade-in-up/down/left/right`, `.slide-in-*`, `.zoom-in`, `.zoom-out`, `.flip-up/down/left/right`, `.blur-in` (with `<ScrollReveal />`) |
117
+
118
+ ## Your own logo
119
+
120
+ The logo effects take `text` (any word, character or emoji, in the font you name with `font`, weight first: `font="900 Anton, sans-serif"`), or `src`: any image URL, an SVG logo or a transparent PNG. Only its shape is used: where it is opaque. `area` places it within the section (`{ x, y, width, height }`, 0–1 from the top left).
121
+
122
+ ```astro
123
+ <VoxelLogo src="/logo.svg" cells={36} colors={['#a7f3d0', '#08090a']} />
124
+ <ParticleLogo src="/logo.svg" area={{ x: 0.5, y: 0.1, width: 0.45, height: 0.8 }} />
125
+ <GlassGlyph text="7" font="900 Anton, sans-serif" />
126
+ ```
127
+
128
+ ## Palettes
129
+
130
+ Every effect that takes `colors` also takes `palette`, one of eighteen named sets: Lumetri, Forest, Cadmium, Peacock, Vermillion, Barbie, Uranium, Azure, Ruby, Ultramarine, Saffron, Crimson, Ember, Lagoon, Citrus, Glacier, Rosewater, Mono (the first twelve are Trirat's, from the LumiThemes ink). An effect's own `colors` win; a palette fills in when there are none, shaped to what the effect takes:
131
+
132
+ ```astro
133
+ <LightField palette="Lagoon" />
134
+ <NeonSwarm src="/logo.svg" palette="Citrus" />
135
+ <WorldRoutes home="london" palette="Ember" />
136
+ ```
137
+
138
+ `PALETTES` (from `@arraypress/effects-astro`) is the list, for a site's own palette switcher.
139
+
140
+ ## Changing colours
141
+
142
+ The WebGL effects (`<LightField>`, `<InkField>`, `<Ink>`, `<AsciiRain>`, `<FlutedGlass>`, `<GlassGlyph>`, `<LiquidMetal>`, `<ParticleLogo>`, `<NeonSwarm>`, `<NebulaLogo>`, `<PointCloud>`, `<VoxelLogo>`, `<SignalLines>`, `<WaveBars>`, `<DotSurface>`, `<HaloRing>`, `<SilkRibbon>`, `<RadiantGlass>`, `<Topography>`, `<Caustics>`, `<RainOnGlass>`, `<MosaicReveal>`, `<Ocean>`, `<IsoCity>`) read a `data-colors` attribute; `setColors` writes it. A light or an ink field eases to the new palette in about a second; ink, rain and the rest take it from their next frame. Set before an effect starts, it is its colours from the first frame.
143
+
144
+ ```js
145
+ import { setColors } from '@arraypress/effects-astro';
146
+
147
+ setColors(document.querySelector('[data-effect-light-field]'), ['#e11d48', '#f97316', '#7c3aed'], '#fde68a');
148
+ ```
149
+
150
+ ## Runtime
151
+
152
+ The package's main entry is the runtime the components are built on, for use without Astro or to build more: every effect as a function (`lightField(el, config)` and so on: start it on an element, get back a function that stops it), and the parts they share. Each module can also be imported on its own, which keeps a page's script small: `import { glassSheen } from '@arraypress/effects-astro/runtime/glass-sheen'`.
153
+
154
+ | Export | |
155
+ |---|---|
156
+ | `paperShader(el, config)`, `paperSettings`, `paperUniforms` | Paper's shaders, and the settings and uniforms for a shader and preset |
157
+ | `paperLook(el, config)`, `paperLookSettings`, `PAPER_LOOKS` | The Paper looks (`<ColorPanels>`…): a look's plain props as a Paper shader's settings, and the looks by name |
158
+ | `createStage(el, options)` | A full-canvas WebGL effect: context, program, sizing, the loop, reduced motion, clean-up |
159
+ | `createCanvas2D(el, options)`, `grainPattern`, `grainOnto` | The same for Canvas 2D effects, and grain laid onto strokes only |
160
+ | `createFluid(gl, options)`, `stir(fluid, el, options)` | A Stable Fluids solve, and its pointer hookup |
161
+ | `createPoints(gl, vertex)`, `projectPoint`, `GLSL_PROJECT` | Particles as soft points, with a 3D projection matched in JavaScript |
162
+ | `drawShape`, `samplePoints`, `gridPoints`, `distanceField`, `blurField`, `fontAt` | Shapes from text or images, and what effects take from them |
163
+ | `createGlyphs`, `GLYPH_SETS`, `GLSL_GLYPHS` | Text characters as a texture, for ASCII effects |
164
+ | `createTrackers(el, count)` | Machine-vision tracker boxes over an effect |
165
+ | `parseColor`, `toHex`, `toOklab`, `fromOklab`, `mixOklab`, `paletteAt`, `GLSL_OKLAB`, `GLSL_PALETTE`, `GLSL_NOISE`, `GLSL_QUIET` | Colour in Oklab and shared shader pieces |
166
+ | `isLand(lat, lon)`, `LAND`, `CITIES` | Where the land is (Natural Earth, 1.5°), and cities by name |
167
+ | `inView(el, show)` | A callback as an element scrolls into view |
168
+ | `scrollReveal(config)`, `REVEAL_CLASSES` | Class-based scroll reveal for a whole page |
169
+ | `animate(el, frame)` | A frame callback on the page's one loop, while `el` is near the screen |
170
+ | `pointerIn`, `trail`, `pressAt`, `CLICK_IGNORE` | The pointer over an element, its strokes, and presses |
171
+ | `pixelRatio`, `isMobileGpu`, `prefersReducedMotion`, `canHover` | The device checks every effect makes |
172
+ | `mount(selector, setup)`, `readConfig`, `watchColors` | Start an effect on every matching element, now and after each view transition |
173
+
174
+ ## Demo
175
+
176
+ `demo/` is an Astro site: one gallery of every effect as a working hero, each ShaderBackground and Paper shader on its own, shown one at a time with its own URL (`/#liquid-metal`), filters by type (backgrounds, logos, wordmarks, text, surfaces; `/?type=logos`), arrows and ← → keys to step through them, and a Customise panel to set each one up and copy the line:
177
+
178
+ ```bash
179
+ cd demo && npm install && npm run dev # http://127.0.0.1:4400
180
+ ```
181
+
182
+ ## Credits
183
+
184
+ - The fluid is Jos Stam's Stable Fluids, after Pavel Dobryakov's [WebGL-Fluid-Simulation](https://github.com/PavelDoGreat/WebGL-Fluid-Simulation) (MIT, © 2017 Pavel Dobryakov).
185
+ - `<FlutedGlass>`'s flute geometry and `<GlassGlyph>`'s lens model are adapted from the FlutedGlass and Glass components of [Shaders](https://github.com/shader-effects-inc/shaders) (MIT, © 2026 Shader Effects Inc.).
186
+ - `<ShaderBackground>` is the shader set from the earlier `@arraypress/effect-canvas-astro` package; `silk` follows Inigo Quilez's domain-warping technique; `grain-gradient` dithers along its colour ramp as Paper's grain gradient does, with Dave Hoskins' [Hash without Sine](https://www.shadertoy.com/view/4djSRW) (MIT, © 2014 David Hoskins).
187
+ - `<PaperShader>` and the Paper looks (`<ColorPanels>`) run [Paper Shaders](https://github.com/paper-design/shaders) (Apache-2.0, © 2026 Paper), vendored unchanged in `src/vendor/paper/` with their presets. Powered by Paper Shaders: https://shaders.paper.design
188
+ - `<InkField>` is adapted from Trirat's ink shader for LumiThemes (its sim, display shader, emitters, lamp and twelve palettes), on Jos Stam's Stable Fluids in the shape of Pavel Dobryakov's WebGL-Fluid-Simulation (MIT, © 2017 Pavel Dobryakov).
189
+ - `<WorldRoutes>`'s land is sampled from [Natural Earth](https://www.naturalearthdata.com)'s 1:110m land (public domain).
190
+ - `<Ocean>`'s and `<LiquidMetal>`'s tone curve is Krzysztof Narkowicz's ACES fit.
191
+ - `<Glass refract>`'s lens (an SDF displacement map with a specular channel, fed to `feDisplacementMap` through `backdrop-filter`, and a three-pass RGB split) is adapted from Sam Asante's [liquid-glass](https://github.com/samasante/liquid-glass) (MIT, © 2026 Sam Asante).
192
+ - Oklab is Björn Ottosson's.
193
+
194
+ The full notices are in [LICENSE](LICENSE).
195
+
196
+ ## Licence
197
+
198
+ MIT © ArrayPress Limited
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "@arraypress/effects-astro",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "GPU effects for Astro sites, as components: liquid light with a real fluid under it, ink in water, and outline text a spotlight fills. Plain WebGL, no dependencies, with the fallbacks a theme needs (reduced motion, no WebGL, touch screens, off-screen pausing).",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "types": "src/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./src/index.js",
11
+ "types": "./src/index.d.ts"
12
+ },
13
+ "./*.astro": "./src/components/*.astro",
14
+ "./*.css": "./src/styles/*.css",
15
+ "./runtime/*": {
16
+ "import": "./src/runtime/*.js",
17
+ "types": "./src/runtime/*.d.ts"
18
+ }
19
+ },
20
+ "files": [
21
+ "src",
22
+ "AGENTS.md",
23
+ "COMPONENTS.md"
24
+ ],
25
+ "scripts": {
26
+ "test": "node --test tests/*.test.js",
27
+ "docs": "node scripts/components-doc.mjs && node scripts/demo-props.mjs"
28
+ },
29
+ "keywords": [
30
+ "astro",
31
+ "astro-component",
32
+ "webgl",
33
+ "shader",
34
+ "fluid-simulation",
35
+ "stable-fluids",
36
+ "oklab",
37
+ "hero",
38
+ "background",
39
+ "effects"
40
+ ],
41
+ "author": "ArrayPress Limited",
42
+ "license": "MIT",
43
+ "engines": {
44
+ "node": ">=20"
45
+ },
46
+ "peerDependencies": {
47
+ "astro": "^6 || ^7"
48
+ },
49
+ "peerDependenciesMeta": {
50
+ "astro": {
51
+ "optional": true
52
+ }
53
+ },
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "git+https://github.com/arraypress/effects-astro.git"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public",
60
+ "registry": "https://registry.npmjs.org/"
61
+ }
62
+ }
@@ -0,0 +1,36 @@
1
+ ---
2
+ /**
3
+ * AsciiRain: data rain on a rippling surface, drawn in text characters,
4
+ * with red and blue fringes at the glyph edges. The pointer ripples the
5
+ * surface and a click sends a ring out. See src/runtime/ascii-rain.js.
6
+ *
7
+ * Fills its nearest positioned ancestor, or the viewport with `fixed`.
8
+ * Clear where there is no rain, so it lays over any background (it reads
9
+ * best on near-black). Without WebGL nothing is drawn.
10
+ *
11
+ * @example
12
+ * <section class="hero" style="position: relative; background: #000">
13
+ * <AsciiRain colors={['#6d28d9', '#2563eb', '#22d3ee']} quiet={{ x: 0.25, y: 0.4, radius: 0.6 }} />
14
+ * <h1>…</h1>
15
+ * </section>
16
+ */
17
+ import EffectCanvas from './EffectCanvas.astro';
18
+ import type { AsciiRainConfig } from '../runtime/ascii-rain.js';
19
+
20
+ interface Props extends AsciiRainConfig {
21
+ /** Fill the viewport (position: fixed). Default false. */
22
+ fixed?: boolean;
23
+ class?: string;
24
+ }
25
+
26
+ const { fixed = false, class: className, ...config } = Astro.props;
27
+ ---
28
+
29
+ <EffectCanvas name="ascii-rain" config={config} fixed={fixed} class={className} />
30
+
31
+ <script>
32
+ import { mount } from '../runtime/mount.js';
33
+ import { asciiRain } from '../runtime/ascii-rain.js';
34
+
35
+ mount('[data-effect-ascii-rain]', asciiRain);
36
+ </script>
@@ -0,0 +1,39 @@
1
+ ---
2
+ /**
3
+ * BorderSweep: a light travelling round an element's outline, on hover
4
+ * and focus or (`always`) all the time. A wrapper for `class="sweep-ring"`
5
+ * from border-sweep.css; for elements you render yourself, import
6
+ * `@arraypress/effects-astro/border-sweep.css` and add the class.
7
+ *
8
+ * Suits outlined things: cards, ghost buttons, a featured pricing tier. A
9
+ * filled button has no outline for the light to travel.
10
+ *
11
+ * @example
12
+ * <BorderSweep as="a" href="/pricing" class="card" color="#a5b4fc" always>…</BorderSweep>
13
+ */
14
+ import type { HTMLTag } from 'astro/types';
15
+ import '../styles/border-sweep.css';
16
+ import { withStyle } from './style.js';
17
+
18
+ interface Props {
19
+ /** The element to render. Default `div`. */
20
+ as?: HTMLTag;
21
+ /** The light's colour. Default the text colour. */
22
+ color?: string;
23
+ /** Seconds a lap takes. Default 2.6. */
24
+ speed?: number;
25
+ /** The ring's width, px. Default 1. */
26
+ width?: number;
27
+ /** Run all the time, not only on hover. Default false. */
28
+ always?: boolean;
29
+ class?: string;
30
+ [attribute: string]: unknown;
31
+ }
32
+
33
+ const { as: Tag = 'div', color, speed, width, always = false, class: className, style: given, ...attributes } = Astro.props;
34
+ const style = [color && `--sweep-color: ${color}`, speed !== undefined && `--sweep-speed: ${speed}s`, width !== undefined && `--sweep-width: ${width}px`]
35
+ .filter(Boolean)
36
+ .join('; ');
37
+ ---
38
+
39
+ <Tag class:list={['sweep-ring', { 'sweep-ring--always': always }, className]} style={withStyle(style, given)} {...attributes}><slot /></Tag>
@@ -0,0 +1,39 @@
1
+ ---
2
+ /**
3
+ * Caustics: sunlight through rippling water onto a pool floor, a bright,
4
+ * shifting net of light over an aqua ground, with a faint rainbow at the
5
+ * edges of its lines. The pointer stirs the water where it is; faint
6
+ * tiles can lie on the floor. See src/runtime/caustics.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
+ * floor shows, fading into `background`.
11
+ *
12
+ * @example
13
+ * <section class="hero" style="position: relative">
14
+ * <Caustics tiles quiet={{ radius: 0.5 }} />
15
+ * <h1>The pool is <em>open.</em></h1>
16
+ * </section>
17
+ */
18
+ import EffectCanvas from './EffectCanvas.astro';
19
+ import { causticTones } from '../runtime/caustics.js';
20
+ import type { CausticsConfig } from '../runtime/caustics.js';
21
+
22
+ interface Props extends CausticsConfig {
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
+ const tones = causticTones(config);
30
+ ---
31
+
32
+ <EffectCanvas name="caustics" config={config} fixed={fixed} class={className} behind background={`radial-gradient(ellipse at 50% 50%, ${tones.floor}, ${tones.deep} 70%, ${tones.background})`} />
33
+
34
+ <script>
35
+ import { mount } from '../runtime/mount.js';
36
+ import { caustics } from '../runtime/caustics.js';
37
+
38
+ mount('[data-effect-caustics]', caustics);
39
+ </script>
@@ -0,0 +1,62 @@
1
+ ---
2
+ /**
3
+ * ColorPanels: translucent panels of colour that swing open out of the
4
+ * dark and sweep past, like pages turning towards you. Paper's
5
+ * color-panels shader (Apache-2.0, vendored), with its settings as plain
6
+ * props; each prop's default is the Opening preset's, and with another
7
+ * `preset` the props left out are that preset's.
8
+ *
9
+ * Opaque: it is the whole background of what it fills (its nearest
10
+ * positioned ancestor, or the viewport with `fixed`). Needs WebGL 2;
11
+ * without it the `background` shows.
12
+ *
13
+ * @example
14
+ * <ColorPanels />
15
+ * <ColorPanels preset="Glass" background="#0b0b10" />
16
+ * <ColorPanels palette="Lagoon" density={3} edges quiet={{ radius: 0.5 }} />
17
+ */
18
+ import PaperBackground from './PaperBackground.astro';
19
+ import type { PaperLookOptions } from '../runtime/paper-look.js';
20
+
21
+ interface Props extends PaperLookOptions {
22
+ /** Paper's preset to start from: `Opening` (cyan panels opening out of the dark, on plum), `Default` (seven colours fanning out over black), `Glass` (four colours with lit, blurred edges, on clear) or `Gradient` (panels shading from one colour to the next, on aqua). Default `'Opening'`. */
23
+ preset?: 'Opening' | 'Default' | 'Glass' | 'Gradient';
24
+ /** The panels' colours, up to seven, taken in turn. Default `['#00ffff']`. */
25
+ colors?: string[];
26
+ /** The colour behind the panels. Default `'#570044'`. */
27
+ background?: string;
28
+ /** How closely the panels follow one another, 0.25–7. Default 2.21. */
29
+ density?: number;
30
+ /** Skews each panel's left edge as it nears, -1–1. Default -1. */
31
+ skewLeft?: number;
32
+ /** Skews each panel's right edge as it nears, -1–1. Default -1. */
33
+ skewRight?: number;
34
+ /** How long the panels are, 0–3. Default 0.52. */
35
+ length?: number;
36
+ /** Light along each panel's edges. Default false. */
37
+ edges?: boolean;
38
+ /** Softens the panels' sides, 0–0.5 (0 sharp). Default 0. */
39
+ blur?: number;
40
+ /** Fades the panels where they meet, at the centre, 0–1. Default 0. */
41
+ fadeInner?: number;
42
+ /** Fades the panels at their outer ends, nearest you, 0–1. Default 1. */
43
+ fadeOuter?: number;
44
+ /** Shades each panel into the next colour, 0–1 (0 one colour each). Default 0. */
45
+ blend?: number;
46
+ /** How large the panels are drawn, 0.1–4. Default 2.32. */
47
+ zoom?: number;
48
+ /** Turns the whole look, degrees, 0–360. Default 360. */
49
+ rotation?: number;
50
+ /** Where the panels' centre sits, `[x, y]`, -1–1, right and down. Default `[-0.3, 0.6]`. */
51
+ offset?: [number, number];
52
+ /** How fast the panels turn, 0–4 (0 holds). Default 2. */
53
+ speed?: number;
54
+ /** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
55
+ fixed?: boolean;
56
+ class?: string;
57
+ }
58
+
59
+ const { fixed = false, class: className, ...config } = Astro.props;
60
+ ---
61
+
62
+ <PaperBackground look="color-panels" config={config} fixed={fixed} class={className} />