@arraypress/effects-astro 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/AGENTS.md +85 -0
  2. package/COMPONENTS.md +1264 -0
  3. package/LICENSE +139 -0
  4. package/README.md +197 -2
  5. package/package.json +60 -4
  6. package/src/components/AsciiRain.astro +36 -0
  7. package/src/components/BorderSweep.astro +39 -0
  8. package/src/components/Caustics.astro +39 -0
  9. package/src/components/ColorPanels.astro +62 -0
  10. package/src/components/Cursor.astro +97 -0
  11. package/src/components/DotGrid.astro +34 -0
  12. package/src/components/DotSurface.astro +35 -0
  13. package/src/components/EffectCanvas.astro +152 -0
  14. package/src/components/FitText.astro +35 -0
  15. package/src/components/FlutedGlass.astro +36 -0
  16. package/src/components/Glass.astro +69 -0
  17. package/src/components/GlassGlyph.astro +38 -0
  18. package/src/components/GlowField.astro +177 -0
  19. package/src/components/Grain.astro +98 -0
  20. package/src/components/HaloRing.astro +38 -0
  21. package/src/components/HighlightSweep.astro +74 -0
  22. package/src/components/ImageRipple.astro +56 -0
  23. package/src/components/Ink.astro +37 -0
  24. package/src/components/InkField.astro +45 -0
  25. package/src/components/IsoCity.astro +54 -0
  26. package/src/components/LightField.astro +40 -0
  27. package/src/components/LiquidMetal.astro +41 -0
  28. package/src/components/Magnetic.astro +52 -0
  29. package/src/components/Marquee.astro +216 -0
  30. package/src/components/MosaicReveal.astro +196 -0
  31. package/src/components/NebulaLogo.astro +38 -0
  32. package/src/components/NeonSwarm.astro +38 -0
  33. package/src/components/Ocean.astro +40 -0
  34. package/src/components/OutlineWordmark.astro +222 -0
  35. package/src/components/PaperBackground.astro +40 -0
  36. package/src/components/PaperShader.astro +55 -0
  37. package/src/components/Parallax.astro +49 -0
  38. package/src/components/ParticleLogo.astro +37 -0
  39. package/src/components/PixelGlitchText.astro +70 -0
  40. package/src/components/PointCloud.astro +37 -0
  41. package/src/components/ProductStack.astro +298 -0
  42. package/src/components/PulseMark.astro +189 -0
  43. package/src/components/RadiantGlass.astro +38 -0
  44. package/src/components/RainOnGlass.astro +71 -0
  45. package/src/components/Reveal.astro +115 -0
  46. package/src/components/ScrambleText.astro +52 -0
  47. package/src/components/ScrollReveal.astro +38 -0
  48. package/src/components/ShaderBackground.astro +55 -0
  49. package/src/components/SignalLines.astro +41 -0
  50. package/src/components/SilkRibbon.astro +37 -0
  51. package/src/components/SpotlightText.astro +131 -0
  52. package/src/components/Tilt.astro +79 -0
  53. package/src/components/Topography.astro +38 -0
  54. package/src/components/Typewriter.astro +66 -0
  55. package/src/components/VariableType.astro +59 -0
  56. package/src/components/VoxelLogo.astro +46 -0
  57. package/src/components/WaveBars.astro +41 -0
  58. package/src/components/WorldRoutes.astro +41 -0
  59. package/src/components/style.js +19 -0
  60. package/src/index.d.ts +143 -0
  61. package/src/index.js +105 -0
  62. package/src/runtime/ascii-rain.d.ts +53 -0
  63. package/src/runtime/ascii-rain.js +355 -0
  64. package/src/runtime/audio-meter.d.ts +65 -0
  65. package/src/runtime/audio-meter.js +282 -0
  66. package/src/runtime/audio.d.ts +26 -0
  67. package/src/runtime/audio.js +453 -0
  68. package/src/runtime/blur.d.ts +2 -0
  69. package/src/runtime/blur.js +56 -0
  70. package/src/runtime/canvas2d.d.ts +23 -0
  71. package/src/runtime/canvas2d.js +105 -0
  72. package/src/runtime/caustics.d.ts +40 -0
  73. package/src/runtime/caustics.js +286 -0
  74. package/src/runtime/color.d.ts +33 -0
  75. package/src/runtime/color.js +213 -0
  76. package/src/runtime/curl.d.ts +5 -0
  77. package/src/runtime/curl.js +81 -0
  78. package/src/runtime/cursor.d.ts +9 -0
  79. package/src/runtime/cursor.js +80 -0
  80. package/src/runtime/device.d.ts +14 -0
  81. package/src/runtime/device.js +73 -0
  82. package/src/runtime/dot-grid.d.ts +27 -0
  83. package/src/runtime/dot-grid.js +245 -0
  84. package/src/runtime/dot-surface.d.ts +46 -0
  85. package/src/runtime/dot-surface.js +429 -0
  86. package/src/runtime/feedback.d.ts +18 -0
  87. package/src/runtime/feedback.js +131 -0
  88. package/src/runtime/fit-text.d.ts +5 -0
  89. package/src/runtime/fit-text.js +60 -0
  90. package/src/runtime/fluid.d.ts +55 -0
  91. package/src/runtime/fluid.js +504 -0
  92. package/src/runtime/fluted-glass.d.ts +27 -0
  93. package/src/runtime/fluted-glass.js +157 -0
  94. package/src/runtime/gl.d.ts +19 -0
  95. package/src/runtime/gl.js +104 -0
  96. package/src/runtime/glass-glyph.d.ts +49 -0
  97. package/src/runtime/glass-glyph.js +355 -0
  98. package/src/runtime/glass-sheen.d.ts +2 -0
  99. package/src/runtime/glass-sheen.js +30 -0
  100. package/src/runtime/glsl.d.ts +17 -0
  101. package/src/runtime/glsl.js +78 -0
  102. package/src/runtime/glyphs.d.ts +22 -0
  103. package/src/runtime/glyphs.js +107 -0
  104. package/src/runtime/halo-ring.d.ts +47 -0
  105. package/src/runtime/halo-ring.js +334 -0
  106. package/src/runtime/height-field.d.ts +50 -0
  107. package/src/runtime/height-field.js +176 -0
  108. package/src/runtime/image-ripple.d.ts +25 -0
  109. package/src/runtime/image-ripple.js +353 -0
  110. package/src/runtime/image.d.ts +11 -0
  111. package/src/runtime/image.js +81 -0
  112. package/src/runtime/in-view.d.ts +6 -0
  113. package/src/runtime/in-view.js +36 -0
  114. package/src/runtime/ink-field/shaders.js +258 -0
  115. package/src/runtime/ink-field/sim.js +582 -0
  116. package/src/runtime/ink-field.d.ts +39 -0
  117. package/src/runtime/ink-field.js +311 -0
  118. package/src/runtime/ink.d.ts +31 -0
  119. package/src/runtime/ink.js +109 -0
  120. package/src/runtime/instancing.d.ts +12 -0
  121. package/src/runtime/instancing.js +37 -0
  122. package/src/runtime/iso-camera.d.ts +35 -0
  123. package/src/runtime/iso-camera.js +85 -0
  124. package/src/runtime/iso-city/figures.d.ts +30 -0
  125. package/src/runtime/iso-city/figures.js +136 -0
  126. package/src/runtime/iso-city/look.d.ts +34 -0
  127. package/src/runtime/iso-city/look.js +105 -0
  128. package/src/runtime/iso-city/plan.d.ts +59 -0
  129. package/src/runtime/iso-city/plan.js +463 -0
  130. package/src/runtime/iso-city/roads.d.ts +64 -0
  131. package/src/runtime/iso-city/roads.js +320 -0
  132. package/src/runtime/iso-city/scene.d.ts +27 -0
  133. package/src/runtime/iso-city/scene.js +432 -0
  134. package/src/runtime/iso-city/shaders.d.ts +6 -0
  135. package/src/runtime/iso-city/shaders.js +233 -0
  136. package/src/runtime/iso-city/shadows.d.ts +13 -0
  137. package/src/runtime/iso-city/shadows.js +148 -0
  138. package/src/runtime/iso-city/traffic.d.ts +80 -0
  139. package/src/runtime/iso-city/traffic.js +457 -0
  140. package/src/runtime/iso-city.d.ts +37 -0
  141. package/src/runtime/iso-city.js +458 -0
  142. package/src/runtime/lens-map.d.ts +11 -0
  143. package/src/runtime/lens-map.js +146 -0
  144. package/src/runtime/light-field.d.ts +29 -0
  145. package/src/runtime/light-field.js +292 -0
  146. package/src/runtime/liquid-glass.d.ts +48 -0
  147. package/src/runtime/liquid-glass.js +423 -0
  148. package/src/runtime/liquid-metal/beads.js +217 -0
  149. package/src/runtime/liquid-metal/field.js +88 -0
  150. package/src/runtime/liquid-metal/look.js +64 -0
  151. package/src/runtime/liquid-metal/shaders.js +255 -0
  152. package/src/runtime/liquid-metal/wave.js +53 -0
  153. package/src/runtime/liquid-metal.d.ts +46 -0
  154. package/src/runtime/liquid-metal.js +366 -0
  155. package/src/runtime/loop.d.ts +7 -0
  156. package/src/runtime/loop.js +112 -0
  157. package/src/runtime/magnetic.d.ts +9 -0
  158. package/src/runtime/magnetic.js +46 -0
  159. package/src/runtime/marquee.d.ts +2 -0
  160. package/src/runtime/marquee.js +27 -0
  161. package/src/runtime/mesh.d.ts +30 -0
  162. package/src/runtime/mesh.js +217 -0
  163. package/src/runtime/mosaic-reveal.d.ts +34 -0
  164. package/src/runtime/mosaic-reveal.js +504 -0
  165. package/src/runtime/motion.d.ts +2 -0
  166. package/src/runtime/motion.js +21 -0
  167. package/src/runtime/mount.d.ts +13 -0
  168. package/src/runtime/mount.js +120 -0
  169. package/src/runtime/nebula-logo.d.ts +31 -0
  170. package/src/runtime/nebula-logo.js +282 -0
  171. package/src/runtime/neon-swarm.d.ts +31 -0
  172. package/src/runtime/neon-swarm.js +258 -0
  173. package/src/runtime/ocean/presets.d.ts +54 -0
  174. package/src/runtime/ocean/presets.js +184 -0
  175. package/src/runtime/ocean/shader.d.ts +14 -0
  176. package/src/runtime/ocean/shader.js +389 -0
  177. package/src/runtime/ocean/view.d.ts +24 -0
  178. package/src/runtime/ocean/view.js +98 -0
  179. package/src/runtime/ocean/waves.d.ts +29 -0
  180. package/src/runtime/ocean/waves.js +119 -0
  181. package/src/runtime/ocean.d.ts +31 -0
  182. package/src/runtime/ocean.js +173 -0
  183. package/src/runtime/palettes.d.ts +37 -0
  184. package/src/runtime/palettes.js +75 -0
  185. package/src/runtime/paper-look.d.ts +42 -0
  186. package/src/runtime/paper-look.js +91 -0
  187. package/src/runtime/paper-looks.d.ts +17 -0
  188. package/src/runtime/paper-looks.js +21 -0
  189. package/src/runtime/paper.d.ts +37 -0
  190. package/src/runtime/paper.js +285 -0
  191. package/src/runtime/particle-logo.d.ts +31 -0
  192. package/src/runtime/particle-logo.js +196 -0
  193. package/src/runtime/ping-pong.d.ts +43 -0
  194. package/src/runtime/ping-pong.js +175 -0
  195. package/src/runtime/pixel-glitch.d.ts +17 -0
  196. package/src/runtime/pixel-glitch.js +287 -0
  197. package/src/runtime/point-cloud.d.ts +33 -0
  198. package/src/runtime/point-cloud.js +287 -0
  199. package/src/runtime/pointer.d.ts +27 -0
  200. package/src/runtime/pointer.js +128 -0
  201. package/src/runtime/points.d.ts +25 -0
  202. package/src/runtime/points.js +130 -0
  203. package/src/runtime/pools.d.ts +2 -0
  204. package/src/runtime/pools.js +25 -0
  205. package/src/runtime/product-stack.d.ts +24 -0
  206. package/src/runtime/product-stack.js +210 -0
  207. package/src/runtime/radiant-glass.d.ts +29 -0
  208. package/src/runtime/radiant-glass.js +282 -0
  209. package/src/runtime/rain-on-glass/backdrop.d.ts +22 -0
  210. package/src/runtime/rain-on-glass/backdrop.js +185 -0
  211. package/src/runtime/rain-on-glass/shader.d.ts +2 -0
  212. package/src/runtime/rain-on-glass/shader.js +168 -0
  213. package/src/runtime/rain-on-glass/wipe.d.ts +16 -0
  214. package/src/runtime/rain-on-glass/wipe.js +65 -0
  215. package/src/runtime/rain-on-glass.d.ts +27 -0
  216. package/src/runtime/rain-on-glass.js +210 -0
  217. package/src/runtime/ramp.d.ts +2 -0
  218. package/src/runtime/ramp.js +30 -0
  219. package/src/runtime/random.d.ts +2 -0
  220. package/src/runtime/random.js +22 -0
  221. package/src/runtime/scroll-reveal.d.ts +22 -0
  222. package/src/runtime/scroll-reveal.js +73 -0
  223. package/src/runtime/shader-background.d.ts +42 -0
  224. package/src/runtime/shader-background.js +261 -0
  225. package/src/runtime/shader-backgrounds/band-lens.js +72 -0
  226. package/src/runtime/shader-backgrounds/common.js +53 -0
  227. package/src/runtime/shader-backgrounds/grain-gradient.js +87 -0
  228. package/src/runtime/shader-backgrounds/grid.js +33 -0
  229. package/src/runtime/shader-backgrounds/mesh-gradient.js +74 -0
  230. package/src/runtime/shader-backgrounds/silk.js +57 -0
  231. package/src/runtime/shader-backgrounds/waves.js +31 -0
  232. package/src/runtime/shape.d.ts +42 -0
  233. package/src/runtime/shape.js +313 -0
  234. package/src/runtime/silk-ribbon.d.ts +23 -0
  235. package/src/runtime/silk-ribbon.js +206 -0
  236. package/src/runtime/slideshow.d.ts +27 -0
  237. package/src/runtime/slideshow.js +234 -0
  238. package/src/runtime/spotlight.d.ts +9 -0
  239. package/src/runtime/spotlight.js +97 -0
  240. package/src/runtime/stack-poses.d.ts +53 -0
  241. package/src/runtime/stack-poses.js +273 -0
  242. package/src/runtime/stage.d.ts +47 -0
  243. package/src/runtime/stage.js +187 -0
  244. package/src/runtime/swarm.d.ts +49 -0
  245. package/src/runtime/swarm.js +199 -0
  246. package/src/runtime/text-motion.d.ts +41 -0
  247. package/src/runtime/text-motion.js +165 -0
  248. package/src/runtime/text.d.ts +11 -0
  249. package/src/runtime/text.js +90 -0
  250. package/src/runtime/tilt.d.ts +19 -0
  251. package/src/runtime/tilt.js +116 -0
  252. package/src/runtime/topography.d.ts +71 -0
  253. package/src/runtime/topography.js +650 -0
  254. package/src/runtime/trackers.d.ts +21 -0
  255. package/src/runtime/trackers.js +76 -0
  256. package/src/runtime/variable-type.d.ts +43 -0
  257. package/src/runtime/variable-type.js +358 -0
  258. package/src/runtime/voxel-logo.d.ts +31 -0
  259. package/src/runtime/voxel-logo.js +237 -0
  260. package/src/runtime/waves.d.ts +70 -0
  261. package/src/runtime/waves.js +799 -0
  262. package/src/runtime/world-labels.d.ts +29 -0
  263. package/src/runtime/world-labels.js +59 -0
  264. package/src/runtime/world-land.d.ts +8 -0
  265. package/src/runtime/world-land.js +105 -0
  266. package/src/runtime/world-map.d.ts +69 -0
  267. package/src/runtime/world-map.js +308 -0
  268. package/src/runtime/world-plan.d.ts +101 -0
  269. package/src/runtime/world-plan.js +333 -0
  270. package/src/runtime/world-routes.d.ts +75 -0
  271. package/src/runtime/world-routes.js +673 -0
  272. package/src/styles/border-sweep.css +82 -0
  273. package/src/styles/glass.css +104 -0
  274. package/src/styles/motion.css +218 -0
  275. package/src/styles/reveal.css +51 -0
  276. package/src/vendor/paper/LICENSE +201 -0
  277. package/src/vendor/paper/NOTICE +5 -0
  278. package/src/vendor/paper/README.md +8 -0
  279. package/src/vendor/paper/get-shader-color-from-string.js +100 -0
  280. package/src/vendor/paper/get-shader-noise-texture.js +17 -0
  281. package/src/vendor/paper/presets.js +3678 -0
  282. package/src/vendor/paper/shader-sizing.js +37 -0
  283. package/src/vendor/paper/shader-utils.js +130 -0
  284. package/src/vendor/paper/shaders/color-panels.js +223 -0
  285. package/src/vendor/paper/shaders/dithering.js +270 -0
  286. package/src/vendor/paper/shaders/dot-grid.js +109 -0
  287. package/src/vendor/paper/shaders/dot-orbit.js +122 -0
  288. package/src/vendor/paper/shaders/fluted-glass.js +360 -0
  289. package/src/vendor/paper/shaders/gem-smoke.js +572 -0
  290. package/src/vendor/paper/shaders/god-rays.js +132 -0
  291. package/src/vendor/paper/shaders/grain-gradient.js +300 -0
  292. package/src/vendor/paper/shaders/halftone-cmyk.js +294 -0
  293. package/src/vendor/paper/shaders/halftone-dots.js +320 -0
  294. package/src/vendor/paper/shaders/heatmap.js +383 -0
  295. package/src/vendor/paper/shaders/image-dithering.js +198 -0
  296. package/src/vendor/paper/shaders/lens-distortion.js +275 -0
  297. package/src/vendor/paper/shaders/liquid-metal.js +632 -0
  298. package/src/vendor/paper/shaders/mesh-gradient.js +130 -0
  299. package/src/vendor/paper/shaders/metaballs.js +110 -0
  300. package/src/vendor/paper/shaders/neuro-noise.js +76 -0
  301. package/src/vendor/paper/shaders/paper-texture.js +526 -0
  302. package/src/vendor/paper/shaders/perlin-noise.js +166 -0
  303. package/src/vendor/paper/shaders/pulsing-border.js +238 -0
  304. package/src/vendor/paper/shaders/simplex-noise.js +91 -0
  305. package/src/vendor/paper/shaders/smoke-ring.js +132 -0
  306. package/src/vendor/paper/shaders/spiral.js +82 -0
  307. package/src/vendor/paper/shaders/static-mesh-gradient.js +130 -0
  308. package/src/vendor/paper/shaders/static-radial-gradient.js +187 -0
  309. package/src/vendor/paper/shaders/swirl.js +103 -0
  310. package/src/vendor/paper/shaders/voronoi.js +138 -0
  311. package/src/vendor/paper/shaders/warp.js +129 -0
  312. package/src/vendor/paper/shaders/water.js +121 -0
  313. package/src/vendor/paper/shaders/waves.js +65 -0
  314. package/src/vendor/paper/vertex-shader.js +159 -0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @module @arraypress/effects-astro/shader-backgrounds/grid
3
+ *
4
+ * Grid: a perspective floor grid scrolling towards a glowing horizon: retro,
5
+ * synthwave.
6
+ */
7
+
8
+ import { SHADER_BACKGROUND_GLSL } from './common.js';
9
+
10
+ /** The grid shader background's fragment shader. */
11
+ export const GRID = `${SHADER_BACKGROUND_GLSL}
12
+ void main(){
13
+ vec2 uv=gl_FragCoord.xy/uRes;
14
+ float ar=uRes.x/uRes.y;
15
+ float horizon=.62;
16
+ vec3 col=vec3(0.);
17
+ if(uv.y<horizon){
18
+ float z=(horizon-uv.y)+.015;
19
+ float pz=1./z;
20
+ vec2 g=vec2((uv.x-.5)*ar*pz*.9,pz*.5+uTime*1.1);
21
+ float dx=abs(fract(g.x+.5)-.5);
22
+ float dy=abs(fract(g.y+.5)-.5);
23
+ float fog=smoothstep(.0,.45,z);
24
+ float line=(.022/(dx+.018)+.022/(dy+.018))*.5;
25
+ col+=uColor1*line*fog*.85;
26
+ }
27
+ col+=uColor2*exp(-abs(uv.y-horizon)*22.)*.55;
28
+ col+=uColor3*exp(-abs(uv.y-horizon)*5.)*.10;
29
+ col*=uIntensity;
30
+ float a=clamp(max(max(col.r,col.g),col.b)*1.35,0.,1.);
31
+ gl_FragColor = premultiply(vec4(col,a));
32
+ }
33
+ `;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @module @arraypress/effects-astro/shader-backgrounds/mesh-gradient
3
+ *
4
+ * Mesh gradient: four colour spots on their own orbits, warped by noise and pulled
5
+ * through a slow vortex, blended by inverse distance so no spot has an
6
+ * edge, and finished with fine grain (which also stops the big ramps
7
+ * banding). Coverage rides in the alpha and the colour keeps its chroma,
8
+ * so it is a pastel tint on a light page and a deep pool on a dark one.
9
+ */
10
+
11
+ import { SHADER_BACKGROUND_GLSL } from './common.js';
12
+
13
+ /** The mesh gradient shader background's fragment shader. */
14
+ export const MESH_GRADIENT = `${SHADER_BACKGROUND_GLSL}
15
+ void main(){
16
+ vec2 uv=gl_FragCoord.xy/uRes;
17
+ float ar=uRes.x/uRes.y;
18
+ vec2 p=(uv-.5)*vec2(ar,1.);
19
+ float t=uTime*.12;
20
+
21
+ /* Organic distortion — warp the sampling point by two decorrelated
22
+ fbm fields so the spots deform instead of sliding rigidly. */
23
+ vec2 w=vec2(fbm(p*1.3+vec2(t,-t*.7)),fbm(p*1.3+vec2(-t*.6,t*.9)+4.2));
24
+ p+=(w-.5)*.6;
25
+
26
+ /* Slow vortex, oscillating so it never settles. */
27
+ p=swirl(p,.85*sin(t*.35));
28
+ p+=(uMouse-.5)*vec2(ar,1.)*.10;
29
+
30
+ /* Four spots, each on its own orbit. */
31
+ vec2 s1=vec2(sin(t*.90)*.44,cos(t*.70)*.32);
32
+ vec2 s2=vec2(cos(t*.60+2.)*.48,sin(t*.80+1.)*.36);
33
+ vec2 s3=vec2(sin(t*.50+4.)*.42,cos(t*.90+3.)*.40);
34
+ vec2 s4=vec2(cos(t*.75+5.)*.38,sin(t*.55+2.5)*.30);
35
+
36
+ /* Inverse-distance weighting: every pixel is a blend of ALL four,
37
+ weighted by proximity. The +.05 floor stops the weight blowing up
38
+ at a spot centre (which would punch a hard dot). */
39
+ float w1=1./(dot(p-s1,p-s1)+.05);
40
+ float w2=1./(dot(p-s2,p-s2)+.05);
41
+ float w3=1./(dot(p-s3,p-s3)+.05);
42
+ float w4=1./(dot(p-s4,p-s4)+.05);
43
+ float sum=w1+w2+w3+w4;
44
+ vec3 col=(uColor1*w1+uColor2*w2+uColor3*w3+uColor4*w4)/sum;
45
+
46
+ /* COVERAGE — the load-bearing term. The weights above are normalised,
47
+ so the hue blend alone returns a fully-saturated colour at EVERY
48
+ pixel; left there it floods the page and swallows any text on top.
49
+ This density field breaks it into soft pools with the page showing
50
+ through between them, which is what a gradient mesh on a real site
51
+ actually looks like. */
52
+ float cover=smoothstep(.30,.78,fbm(p*1.15+vec2(t*.5,-t*.35)+2.7));
53
+
54
+ /* Radial falloff so the wash melts out rather than ending flat. */
55
+ float vig=1.-smoothstep(.15,.95,length((uv-.5)*vec2(ar,1.)));
56
+
57
+ /* Fine grain — dithers the gradient (big smooth ramps band badly on
58
+ 8-bit displays) and adds the paper texture. */
59
+ float g=hash(uv*uRes*.65+fract(uTime*.35)*vec2(19.,37.));
60
+
61
+ /* The mask drives ALPHA ONLY; the colour keeps full chroma.
62
+ This is the whole trick, and getting it wrong is why washes look
63
+ dirty: the browser composites this canvas over the page as
64
+ col*a + page*(1-a). Multiplying the COLOUR by the mask (the
65
+ obvious move) darkens it toward black while alpha drops too, so
66
+ over a light page you composite a dark colour at partial alpha —
67
+ i.e. grey mud. Keep the colour saturated, mask the alpha, and the
68
+ same shader gives a pastel tint on white and a deep pool on black
69
+ with no per-mode branching. */
70
+ float mask=cover*vig*(1.+(g-.5)*.4);
71
+ float a=clamp(mask*uIntensity,0.,1.);
72
+ gl_FragColor = premultiply(vec4(clamp(col,0.,1.),a));
73
+ }
74
+ `;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @module @arraypress/effects-astro/shader-backgrounds/silk
3
+ *
4
+ * Silk: flowing folds like a sheet of silk: fbm warped by fbm warped by fbm
5
+ * (after Inigo Quilez's domain warping), where the warp fields themselves
6
+ * flow, so the folds travel across the frame rather than churning in
7
+ * place, with a sheen on the crests and a calmer middle for a headline.
8
+ */
9
+
10
+ import { SHADER_BACKGROUND_GLSL } from './common.js';
11
+
12
+ /** The silk shader background's fragment shader. */
13
+ export const SILK = `${SHADER_BACKGROUND_GLSL}
14
+ /* Three octaves, not fbm's five: silk is BROAD soft folds. The extra
15
+ octaves are what turned the first draft into marbled smoke. */
16
+ float fbm3(vec2 p){float v=0.;float a=.5;for(int i=0;i<3;i++){v+=a*vnoise(p);p*=2.03;a*=.5;}return v;}
17
+ void main(){
18
+ vec2 uv=gl_FragCoord.xy/uRes;
19
+ float ar=uRes.x/uRes.y;
20
+ vec2 p=(uv-.5)*vec2(ar,1.)*.95;
21
+ float t=uTime*.05;
22
+
23
+ /* Slow drift of the whole sheet, plus a gentle cursor pull. */
24
+ p=rot(p,t*.30);
25
+ p+=(uMouse-.5)*vec2(ar,1.)*.20;
26
+
27
+ /* Two warp fields that flow at different rates and in different
28
+ directions — the folds move because THESE move. */
29
+ vec2 q=vec2(fbm3(p+vec2(t*.90,t*.30)),
30
+ fbm3(p+vec2(5.2,1.3)-vec2(t*.60,t*.80)));
31
+ vec2 r=vec2(fbm3(p+2.1*q+vec2(1.7,9.2)+vec2(t*.45,-t*.25)),
32
+ fbm3(p+2.1*q+vec2(8.3,2.8)-vec2(t*.30,t*.50)));
33
+ float f=fbm3(p+2.3*r);
34
+
35
+ /* Colour: depth (c4 -> c2) by the folded field, cooler body (c3) where
36
+ the first warp is strong, accent (c1) on the high ridges. */
37
+ /* fbm3 lives in ~.25-.65, so every threshold is centred there. */
38
+ vec3 col=mix(uColor4,uColor2,smoothstep(.25,.55,f));
39
+ col=mix(col,uColor3,smoothstep(.20,.55,dot(q,q)));
40
+ col=mix(col,uColor1,smoothstep(.40,.64,r.y));
41
+
42
+ /* Sheen: a soft, wide highlight along the fold crests. */
43
+ float sheen=pow(clamp(1.-abs(f-.52)*3.,0.,1.),2.);
44
+ col+=uColor1*sheen*.25;
45
+
46
+ /* Coverage: a sheet, not pools — the troughs keep a FLOOR of the deep
47
+ colour (c4) rather than going see-through, which is what made the
48
+ first drafts read as faint smudges on the page. Radial falloff melts
49
+ the outer edge; a copy-safe dip keeps the centre (where hero text
50
+ sits) calmer; grain dithers the ramps. */
51
+ float vig=1.-smoothstep(.45,1.35,length((uv-.5)*vec2(ar,1.)));
52
+ float copy=mix(.7,1.,smoothstep(.05,.5,length((uv-vec2(.5,.52))*vec2(ar*.55,1.))));
53
+ float g=hash(uv*uRes*.65+fract(uTime*.35)*vec2(19.,37.));
54
+ float mask=clamp(.42+smoothstep(.28,.6,f)*.58+sheen*.3,0.,1.)*vig*copy*(1.+(g-.5)*.3);
55
+ gl_FragColor = premultiply(vec4(clamp(col,0.,1.),clamp(mask*uIntensity,0.,1.)));
56
+ }
57
+ `;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module @arraypress/effects-astro/shader-backgrounds/waves
3
+ *
4
+ * Waves: three glowing waveform lines across the middle: a signal, on brand for
5
+ * audio shops.
6
+ */
7
+
8
+ import { SHADER_BACKGROUND_GLSL } from './common.js';
9
+
10
+ /** The waves shader background's fragment shader. */
11
+ export const WAVES = `${SHADER_BACKGROUND_GLSL}
12
+ void main(){
13
+ vec2 uv=gl_FragCoord.xy/uRes;
14
+ float ar=uRes.x/uRes.y;
15
+ float t=uTime;
16
+ vec3 col=vec3(0.);
17
+ for(int i=0;i<3;i++){
18
+ float fi=float(i);
19
+ float yy=.5+(fi-1.)*.15+(uMouse.y-.5)*.05;
20
+ float w=sin(uv.x*(4.5+fi*1.4)*ar*.6+t*(.45+fi*.2)+fi*2.1)
21
+ *sin(uv.x*1.6*ar-t*.3+fi*.7);
22
+ float amp=.09+.045*fi;
23
+ float d=abs(uv.y-yy-w*amp);
24
+ vec3 c=i==0?uColor1:(i==1?uColor2:uColor3);
25
+ col+=c*(.005/(d+.004))*.55;
26
+ }
27
+ col*=uIntensity;
28
+ float a=clamp(max(max(col.r,col.g),col.b)*1.2,0.,1.);
29
+ gl_FragColor = premultiply(vec4(col,a));
30
+ }
31
+ `;
@@ -0,0 +1,42 @@
1
+ /** What a shape is drawn from: a word in a font, or an image. */
2
+ export interface ShapeSource {
3
+ /** A word or short line to draw. */
4
+ text?: string;
5
+ /** The CSS font for `text`, without the size. Default: the page's body font, bold. */
6
+ font?: string;
7
+ /** An image URL (an SVG logo, a PNG) to draw instead of text. */
8
+ src?: string;
9
+ /** Space around the shape, a share of its area. Default 0.08. */
10
+ padding?: number;
11
+ /** Where in the canvas the shape goes, each 0–1 from the top left. Default all of it. */
12
+ area?: { x: number; y: number; width: number; height: number };
13
+ }
14
+
15
+ /** A shape drawn white on transparent, and its coverage a byte a pixel. */
16
+ export interface Mask {
17
+ canvas: HTMLCanvasElement;
18
+ alpha: Uint8ClampedArray;
19
+ width: number;
20
+ height: number;
21
+ }
22
+
23
+ /** A CSS font at a size, style and weight words first: `fontAt('900 Anton, sans-serif', 120)` is `900 120px Anton, sans-serif`. */
24
+ export function fontAt(font: string, size: number): string;
25
+
26
+ /** Draws a shape into a mask, fitted with its aspect kept. Rejects when an image cannot be loaded. */
27
+ export function drawShape(source: ShapeSource, width: number, height: number): Promise<Mask>;
28
+
29
+ /** `count` points scattered evenly over a shape: x, y pairs, 0–1, y up. */
30
+ export function samplePoints(mask: Mask, count: number, random?: () => number): Float32Array;
31
+
32
+ /** `count` points scattered along a shape's edge (covered pixels beside uncovered ones): x, y pairs, 0–1, y up. */
33
+ export function edgePoints(mask: Mask, count: number, random?: () => number): Float32Array;
34
+
35
+ /** Points on a grid `columns` across, wherever a cell's centre is inside the shape: x, y pairs, 0–1, y up. */
36
+ export function gridPoints(mask: Mask, columns: number): Float32Array;
37
+
38
+ /** A signed distance field, a byte a pixel: 0.5 at the edge, 1 `spread` px inside, 0 `spread` px outside. */
39
+ export function distanceField(mask: Mask, spread?: number): Uint8Array;
40
+
41
+ /** Softens a one-byte field (rows from the top) with a near-gaussian blur of `radius` px; the input is left unchanged. */
42
+ export function blurField(field: Uint8Array, width: number, height: number, radius: number): Uint8Array;
@@ -0,0 +1,313 @@
1
+ /**
2
+ * @module @arraypress/effects-astro/shape
3
+ *
4
+ * A shape for an effect to be made of: a word in a font, or an image (an
5
+ * SVG logo, a PNG), drawn white into a canvas as a mask. From the mask,
6
+ * effects take points (particles that form the shape), a distance field
7
+ * (glass that bevels from its edges), or the mask itself (voxels).
8
+ *
9
+ * Shapes are drawn once the page's fonts have loaded, so a word is in the
10
+ * font the page uses, not a fallback.
11
+ */
12
+
13
+ import { loadImage } from './image.js';
14
+
15
+ /**
16
+ * @typedef {object} ShapeSource
17
+ * @property {string} [text] A word or short line to draw.
18
+ * @property {string} [font] The CSS font for `text`, without the size
19
+ * (default: the page's body font, bold).
20
+ * @property {string} [src] An image URL (an SVG logo, a PNG) to draw instead of text.
21
+ * @property {number} [padding=0.08] Space around the shape, a share of its area.
22
+ * @property {{ x: number, y: number, width: number, height: number }} [area]
23
+ * Where in the canvas the shape goes, each 0–1 from the top left (default: all of it).
24
+ */
25
+
26
+ /**
27
+ * @typedef {object} Mask
28
+ * @property {HTMLCanvasElement} canvas The shape, white on transparent.
29
+ * @property {Uint8ClampedArray} alpha One byte a pixel: the shape's coverage, 0–255.
30
+ * @property {number} width The canvas width.
31
+ * @property {number} height The canvas height.
32
+ */
33
+
34
+ /**
35
+ * A CSS font at a size: the style and weight words of `font` go before the
36
+ * size, as the canvas needs them, and the family after.
37
+ *
38
+ * @param {string} font A CSS font without a size, e.g. `900 Anton, sans-serif`.
39
+ * @param {number} size The size in pixels.
40
+ * @returns {string} e.g. `900 120px Anton, sans-serif`.
41
+ */
42
+ export function fontAt(font, size) {
43
+ const lead = font.match(/^((?:normal|italic|oblique|small-caps|bold|bolder|lighter|\d{3})\s+)*/)?.[0] ?? '';
44
+ return `${lead}${size}px ${font.slice(lead.length)}`;
45
+ }
46
+
47
+ /**
48
+ * Draws a shape into a mask, fitted inside the canvas with its aspect kept.
49
+ *
50
+ * @param {ShapeSource} source What to draw.
51
+ * @param {number} width The mask's width in pixels.
52
+ * @param {number} height The mask's height in pixels.
53
+ * @returns {Promise<Mask>} The mask.
54
+ * @throws {Error} When an image source cannot be loaded.
55
+ */
56
+ export async function drawShape(source, width, height) {
57
+ const canvas = document.createElement('canvas');
58
+ canvas.width = width;
59
+ canvas.height = height;
60
+ const ctx = /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d', { willReadFrequently: true }));
61
+ const pad = source.padding ?? 0.08;
62
+ const area = source.area ?? { x: 0, y: 0, width: 1, height: 1 };
63
+ const room = { w: width * area.width * (1 - pad * 2), h: height * area.height * (1 - pad * 2) };
64
+ // The middle of the area: shapes are centred on it.
65
+ const cx = width * (area.x + area.width / 2);
66
+ const cy = height * (area.y + area.height / 2);
67
+ ctx.fillStyle = '#fff';
68
+
69
+ if (source.src) {
70
+ const img = await loadImage(source.src);
71
+ const scale = Math.min(room.w / (img.naturalWidth || room.w), room.h / (img.naturalHeight || room.h));
72
+ const w = (img.naturalWidth || room.w) * scale;
73
+ const h = (img.naturalHeight || room.h) * scale;
74
+ ctx.drawImage(img, cx - w / 2, cy - h / 2, w, h);
75
+ // Whatever its colours, the shape is where it is opaque.
76
+ ctx.globalCompositeOperation = 'source-in';
77
+ ctx.fillRect(0, 0, width, height);
78
+ ctx.globalCompositeOperation = 'source-over';
79
+ } else {
80
+ await document.fonts?.ready;
81
+ const family = source.font ?? `700 ${getComputedStyle(document.body).fontFamily}`;
82
+ const text = source.text ?? '';
83
+ ctx.font = fontAt(family, 100);
84
+ const m = ctx.measureText(text);
85
+ const textHeight = (m.actualBoundingBoxAscent + m.actualBoundingBoxDescent) || 100;
86
+ const size = 100 * Math.min(room.w / (m.width || 1), room.h / textHeight);
87
+ ctx.font = fontAt(family, size);
88
+ const fitted = ctx.measureText(text);
89
+ ctx.textBaseline = 'alphabetic';
90
+ const top = cy - (fitted.actualBoundingBoxAscent + fitted.actualBoundingBoxDescent) / 2;
91
+ ctx.fillText(text, cx - fitted.width / 2, top + fitted.actualBoundingBoxAscent);
92
+ }
93
+
94
+ const data = ctx.getImageData(0, 0, width, height).data;
95
+ const alpha = new Uint8ClampedArray(width * height);
96
+ for (let i = 0; i < alpha.length; i++) alpha[i] = data[i * 4 + 3];
97
+ return { canvas, alpha, width, height };
98
+ }
99
+
100
+ /**
101
+ * Scatters points over a shape, evenly: each lands on a pixel the shape
102
+ * covers, with a little jitter so they do not sit on a grid.
103
+ *
104
+ * @param {Mask} mask The shape.
105
+ * @param {number} count How many points.
106
+ * @param {() => number} [random=Math.random] The random source (seed it for repeatable layouts).
107
+ * @returns {Float32Array} x, y pairs, each 0–1 (y up).
108
+ */
109
+ export function samplePoints(mask, count, random = Math.random) {
110
+ const inside = [];
111
+ for (let i = 0; i < mask.alpha.length; i++) if (mask.alpha[i] > 127) inside.push(i);
112
+ const points = new Float32Array(count * 2);
113
+ if (!inside.length) return points;
114
+ for (let k = 0; k < count; k++) {
115
+ const i = inside[Math.floor(random() * inside.length)];
116
+ const x = (i % mask.width) + random();
117
+ const y = Math.floor(i / mask.width) + random();
118
+ points[k * 2] = x / mask.width;
119
+ points[k * 2 + 1] = 1 - y / mask.height;
120
+ }
121
+ return points;
122
+ }
123
+
124
+ /**
125
+ * Scatters points along a shape's edge: each lands on a covered pixel with
126
+ * an uncovered one beside it, with a little jitter, for effects that trace
127
+ * the outline more brightly than the fill.
128
+ *
129
+ * @param {Mask} mask The shape.
130
+ * @param {number} count How many points.
131
+ * @param {() => number} [random=Math.random] The random source.
132
+ * @returns {Float32Array} x, y pairs, each 0–1 (y up); zeros when the shape has no edge.
133
+ */
134
+ export function edgePoints(mask, count, random = Math.random) {
135
+ const { width, height, alpha } = mask;
136
+ /**
137
+ * Is the pixel at (x, y) covered? Outside the mask counts as not.
138
+ *
139
+ * @param {number} x Across.
140
+ * @param {number} y Down.
141
+ * @returns {boolean} Whether the shape covers it.
142
+ */
143
+ const covered = (x, y) => x >= 0 && y >= 0 && x < width && y < height && alpha[y * width + x] > 127;
144
+ const edge = [];
145
+ for (let y = 0; y < height; y++) {
146
+ for (let x = 0; x < width; x++) {
147
+ if (covered(x, y) && !(covered(x - 1, y) && covered(x + 1, y) && covered(x, y - 1) && covered(x, y + 1))) edge.push(y * width + x);
148
+ }
149
+ }
150
+ const points = new Float32Array(count * 2);
151
+ if (!edge.length) return points;
152
+ for (let k = 0; k < count; k++) {
153
+ const i = edge[Math.floor(random() * edge.length)];
154
+ points[k * 2] = ((i % width) + random()) / width;
155
+ points[k * 2 + 1] = 1 - (Math.floor(i / width) + random()) / height;
156
+ }
157
+ return points;
158
+ }
159
+
160
+ /**
161
+ * Points on a grid over a shape: one wherever a grid cell's centre is
162
+ * inside, for shapes drawn as a dot matrix.
163
+ *
164
+ * @param {Mask} mask The shape.
165
+ * @param {number} columns Grid cells across; rows follow from the aspect.
166
+ * @returns {Float32Array} x, y pairs, each 0–1 (y up).
167
+ */
168
+ export function gridPoints(mask, columns) {
169
+ const step = mask.width / columns;
170
+ const rows = Math.floor(mask.height / step);
171
+ const out = [];
172
+ for (let r = 0; r < rows; r++) {
173
+ for (let c = 0; c < columns; c++) {
174
+ const x = Math.floor((c + 0.5) * step);
175
+ const y = Math.floor((r + 0.5) * step);
176
+ if (mask.alpha[y * mask.width + x] > 127) out.push(x / mask.width, 1 - y / mask.height);
177
+ }
178
+ }
179
+ return new Float32Array(out);
180
+ }
181
+
182
+ /**
183
+ * One row of a squared Euclidean distance transform (Felzenszwalb and
184
+ * Huttenlocher): for each cell, the squared distance to the nearest cell
185
+ * whose value is 0.
186
+ *
187
+ * @param {Float64Array} f The row, in place: 0 at sources, a large number elsewhere.
188
+ * @param {number} n Its length.
189
+ * @param {Float64Array} d Scratch for the output.
190
+ * @param {Int32Array} v Scratch: parabola positions.
191
+ * @param {Float64Array} z Scratch: parabola boundaries.
192
+ */
193
+ function edt1d(f, n, d, v, z) {
194
+ let k = 0;
195
+ v[0] = 0;
196
+ z[0] = -Infinity;
197
+ z[1] = Infinity;
198
+ for (let q = 1; q < n; q++) {
199
+ let s = (f[q] + q * q - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);
200
+ while (s <= z[k]) {
201
+ k--;
202
+ s = (f[q] + q * q - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);
203
+ }
204
+ k++;
205
+ v[k] = q;
206
+ z[k] = s;
207
+ z[k + 1] = Infinity;
208
+ }
209
+ k = 0;
210
+ for (let q = 0; q < n; q++) {
211
+ while (z[k + 1] < q) k++;
212
+ d[q] = (q - v[k]) * (q - v[k]) + f[v[k]];
213
+ }
214
+ for (let q = 0; q < n; q++) f[q] = d[q];
215
+ }
216
+
217
+ /**
218
+ * The distance from every pixel to the nearest pixel where `set(i)` is true.
219
+ *
220
+ * @param {number} width The grid's width.
221
+ * @param {number} height The grid's height.
222
+ * @param {(i: number) => boolean} set Whether pixel i is a source.
223
+ * @returns {Float64Array} Distances in pixels.
224
+ */
225
+ function distanceTo(width, height, set) {
226
+ const grid = new Float64Array(width * height);
227
+ for (let i = 0; i < grid.length; i++) grid[i] = set(i) ? 0 : 1e20;
228
+ const n = Math.max(width, height);
229
+ const f = new Float64Array(n);
230
+ const d = new Float64Array(n);
231
+ const v = new Int32Array(n);
232
+ const z = new Float64Array(n + 1);
233
+ for (let x = 0; x < width; x++) {
234
+ for (let y = 0; y < height; y++) f[y] = grid[y * width + x];
235
+ edt1d(f, height, d, v, z);
236
+ for (let y = 0; y < height; y++) grid[y * width + x] = f[y];
237
+ }
238
+ for (let y = 0; y < height; y++) {
239
+ for (let x = 0; x < width; x++) f[x] = grid[y * width + x];
240
+ edt1d(f, width, d, v, z);
241
+ for (let x = 0; x < width; x++) grid[y * width + x] = Math.sqrt(f[x]);
242
+ }
243
+ return grid;
244
+ }
245
+
246
+ /**
247
+ * A signed distance field of a shape, packed for a texture: 0.5 at the
248
+ * edge, rising inside, falling outside, `spread` pixels from the edge to
249
+ * either end.
250
+ *
251
+ * @param {Mask} mask The shape.
252
+ * @param {number} [spread=24] How far from the edge, in mask pixels, the field reaches 0 or 1.
253
+ * @returns {Uint8Array} One byte a pixel, rows from the top.
254
+ */
255
+ export function distanceField(mask, spread = 24) {
256
+ const { width, height, alpha } = mask;
257
+ const outside = distanceTo(width, height, (i) => alpha[i] > 127);
258
+ const inside = distanceTo(width, height, (i) => alpha[i] <= 127);
259
+ const out = new Uint8Array(width * height);
260
+ for (let i = 0; i < out.length; i++) {
261
+ const signed = inside[i] - outside[i];
262
+ out[i] = Math.max(0, Math.min(255, Math.round((0.5 + signed / (2 * spread)) * 255)));
263
+ }
264
+ return out;
265
+ }
266
+
267
+ /**
268
+ * Softens a one-byte field with two passes of a box blur, across then down,
269
+ * twice: near enough a gaussian. Rounds the ridge a distance field has down
270
+ * the middle of every stroke.
271
+ *
272
+ * @param {Uint8Array} field The field, rows from the top; left unchanged.
273
+ * @param {number} width Its width.
274
+ * @param {number} height Its height.
275
+ * @param {number} radius The blur's reach, in pixels.
276
+ * @returns {Uint8Array} The softened field.
277
+ */
278
+ export function blurField(field, width, height, radius) {
279
+ const r = Math.max(1, Math.round(radius));
280
+ let src = Float32Array.from(field);
281
+ let dst = new Float32Array(src.length);
282
+ /**
283
+ * One box pass along rows or columns.
284
+ *
285
+ * @param {boolean} across Along rows (true) or down columns (false).
286
+ */
287
+ const pass = (across) => {
288
+ const lines = across ? height : width;
289
+ const length = across ? width : height;
290
+ /**
291
+ * A pixel's index, by line and position along it.
292
+ *
293
+ * @param {number} line The row (across) or column (down).
294
+ * @param {number} i The position along it.
295
+ * @returns {number} The index into the field.
296
+ */
297
+ const at = (line, i) => (across ? line * width + i : i * width + line);
298
+ for (let line = 0; line < lines; line++) {
299
+ let sum = 0;
300
+ for (let i = -r; i <= r; i++) sum += src[at(line, Math.min(length - 1, Math.max(0, i)))];
301
+ for (let i = 0; i < length; i++) {
302
+ dst[at(line, i)] = sum / (2 * r + 1);
303
+ sum += src[at(line, Math.min(length - 1, i + r + 1))] - src[at(line, Math.max(0, i - r))];
304
+ }
305
+ }
306
+ [src, dst] = [dst, src];
307
+ };
308
+ pass(true);
309
+ pass(false);
310
+ pass(true);
311
+ pass(false);
312
+ return Uint8Array.from(src, (v) => Math.round(v));
313
+ }
@@ -0,0 +1,23 @@
1
+ import type { PaletteName } from './palettes.js';
2
+
3
+ export interface SilkRibbonConfig {
4
+ /** The satin's colours, shaded from the darkest to the lightest whatever their order. Default hot pink, coral, peach. */
5
+ colors?: string[];
6
+ /** A shared palette by name (`PALETTES`, any case), when there are no `colors`. */
7
+ palette?: PaletteName | (string & {});
8
+ /** The ground around the ribbon. Default `#f6f4f1`. */
9
+ background?: string;
10
+ /** Where the ribbon runs. Default `right`. */
11
+ side?: 'right' | 'left' | 'center';
12
+ /** How tightly it turns along its length; 0 lies flat. Default 1. */
13
+ twist?: number;
14
+ /** How deep the folds along it are; 0 for flat satin. Default 1. */
15
+ folds?: number;
16
+ /** The soft out-of-focus glow behind it; 0 for none. Default 1. */
17
+ glow?: number;
18
+ /** How fast the folds move. Default 1. */
19
+ speed?: number;
20
+ }
21
+
22
+ /** Starts a silk ribbon in `el`'s canvas. Returns a function that stops it. */
23
+ export function silkRibbon(el: HTMLElement, config: SilkRibbonConfig): () => void;