@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,206 @@
1
+ /**
2
+ * @module @arraypress/effects-astro/silk-ribbon
3
+ *
4
+ * A wide ribbon of satin twisting across a light ground, a soft
5
+ * out-of-focus glow of the same colours behind it. The ribbon is shaded
6
+ * analytically in one pass: it turns about its length, so it narrows to a
7
+ * pinch where it shows its edge and widens where it faces you; soft folds
8
+ * run along it, gathering at each pinch, and a satin sheen picks out
9
+ * every fold as it turns to the light. Its colour runs from the darkest
10
+ * colour in its shadows to the lightest on its highlights, mixed in Oklab.
11
+ *
12
+ * The folds undulate slowly and lean towards the pointer. Reduced motion
13
+ * gets a still frame.
14
+ *
15
+ * Opaque: the effect is the whole background of what it fills. Without
16
+ * WebGL it removes its canvas and the element's background shows.
17
+ */
18
+
19
+ import { createStage } from './stage.js';
20
+ import { GLSL_OKLAB, parseColor, toOklab } from './color.js';
21
+ import { canHover } from './device.js';
22
+ import { pointerIn } from './pointer.js';
23
+ import { watchColors } from './mount.js';
24
+ import { GLSL_NOISE, paletteUniform } from './glsl.js';
25
+ import { pickColors } from './palettes.js';
26
+
27
+ /**
28
+ * @typedef {object} SilkRibbonConfig
29
+ * @property {string[]} [colors] The satin's colours, shaded from the darkest to the lightest whatever their order (default hot pink, coral, peach).
30
+ * @property {string} [palette] A shared palette by name (PALETTES; any case), when there are no `colors`.
31
+ * @property {string} [background='#f6f4f1'] The ground around the ribbon.
32
+ * @property {'right' | 'left' | 'center'} [side='right'] Where the ribbon runs.
33
+ * @property {number} [twist=1] How tightly it turns along its length; 0 lies flat.
34
+ * @property {number} [folds=1] How deep the folds along it are; 0 for flat satin.
35
+ * @property {number} [glow=1] The soft out-of-focus glow behind it; 0 for none.
36
+ * @property {number} [speed=1] How fast the folds move.
37
+ */
38
+
39
+ const FRAG = `
40
+ precision highp float;
41
+ uniform vec2 uRes;
42
+ uniform float uTime;
43
+ uniform float uLean;
44
+ uniform float uLeanAt;
45
+ uniform float uSide;
46
+ uniform float uTwist;
47
+ uniform float uFolds;
48
+ uniform float uGlow;
49
+ uniform vec3 uGround;
50
+ uniform vec3 uPal[3];
51
+ ${GLSL_OKLAB}
52
+ ${GLSL_NOISE}
53
+
54
+ // The satin's colour for a shade 0 (in shadow) to 1 (lit), dark to light in Oklab.
55
+ vec3 satin(float k) {
56
+ k = clamp(k, 0.0, 1.0);
57
+ vec3 lab = k < 0.5 ? mix(uPal[0], uPal[1], smoothstep(0.0, 0.5, k)) : mix(uPal[1], uPal[2], smoothstep(0.5, 1.0, k));
58
+ return fromOklab(lab);
59
+ }
60
+
61
+ // The ribbon's centre line, across its axis, at a point along it.
62
+ float centre(float s, float t) {
63
+ return 0.1 * sin(s * 2.0 + t * 0.31) + 0.03 * sin(s * 3.3 - t * 0.23) + uLean * 0.03;
64
+ }
65
+
66
+ // How far the ribbon has turned about its length at a point along it.
67
+ float turn(float s, float t) {
68
+ float lean = uLean * 0.5 * exp(-(s - uLeanAt) * (s - uLeanAt) * 3.0);
69
+ return uTwist * (1.7 * s + 0.5 * sin(s * 1.3 + t * 0.21)) + 0.8 + 0.6 * sin(t * 0.11) + lean;
70
+ }
71
+
72
+ void main() {
73
+ float t = uTime;
74
+ // Centred, in units of the height; on a narrow screen, of a shorter
75
+ // height, so the ribbon keeps its shape and fits the width.
76
+ float zoom = min(uRes.x / uRes.y / 1.5, 1.0);
77
+ vec2 p = (gl_FragCoord.xy - 0.5 * uRes) / (uRes.y * zoom);
78
+ float aspect = uRes.x / (uRes.y * zoom);
79
+ p.x *= uSide < 0.0 ? -1.0 : 1.0;
80
+ // The ribbon's axis leans right as it rises; along it s, across it x.
81
+ vec2 origin = vec2(abs(uSide) * max(aspect * 0.5 - 0.42, 0.12), 0.0);
82
+ vec2 axis = normalize(vec2(0.42, 1.0));
83
+ vec2 side = vec2(axis.y, -axis.x);
84
+ vec2 q = p - origin;
85
+ float s = dot(q, axis);
86
+ float x = dot(q, side);
87
+ float eps = 1.5 / (uRes.y * zoom);
88
+
89
+ // The ground, and the glow: a wide blurred ribbon behind, warmer on its
90
+ // near side, as if a second length of the same silk were out of focus.
91
+ vec3 col = uGround;
92
+ float gx = x - 0.02 - 0.08 * sin(s * 1.4 - t * 0.17);
93
+ float gw = 0.44 + 0.06 * sin(s * 2.1 + t * 0.19);
94
+ float glow = smoothstep(gw + 0.3, gw - 0.1, abs(gx)) * uGlow;
95
+ col = mix(col, satin(0.62 - 0.55 * smoothstep(-0.45, 0.2, gx) + 0.06 * sin(s * 2.0 + t * 0.2)), glow);
96
+
97
+ // The ribbon: half its width shows as it turns, never quite none.
98
+ float c = centre(s, t);
99
+ float a = turn(s, t);
100
+ float facing = cos(a);
101
+ float hw = 0.36 * sqrt(facing * facing + 0.004);
102
+ float dx = x - c;
103
+ // A soft shadow on the glow beside the ribbon.
104
+ col *= 1.0 - 0.1 * glow * smoothstep(hw + 0.2, hw, abs(dx - 0.03));
105
+ float inside = smoothstep(hw + eps, hw - eps, abs(dx));
106
+ if (inside > 0.0) {
107
+ // Across the cloth, -1 to 1, the same thread wherever it turns.
108
+ float v = dx / hw * sign(facing);
109
+ // Folds along the length: their slope tilts the normal about the axis.
110
+ float fold = uFolds * (0.6 * cos(v * 6.5 + s * 1.2 + t * 0.4) + 0.35 * cos(v * 10.0 - s * 2.0 - t * 0.33));
111
+ float phi = a + atan(fold * 1.6);
112
+ // The normal, in screen terms; turned to face the viewer on the back.
113
+ vec3 n = vec3(-sin(phi) * side, cos(phi));
114
+ n.z = abs(n.z);
115
+ n.xy *= sign(facing);
116
+ n.xy += axis * 0.12 * sin(s * 2.6 + v * 1.5 - t * 0.3);
117
+ n = normalize(n);
118
+ // Light from the upper left, from the upper right on the back, so both faces show their folds.
119
+ vec3 light = normalize(vec3(-0.8 * sign(facing), 0.3, 0.3));
120
+ vec3 view = vec3(0.0, 0.0, 1.0);
121
+ // Wrapped light, so no fold goes flat in shadow.
122
+ float diffuse = dot(n, light) * 0.5 + 0.5;
123
+ float k = pow(diffuse, 3.4);
124
+ // Faint streaks woven along the length.
125
+ k += 0.12 * (noise(vec2(v * 4.0, s * 0.7 + t * 0.03)) - 0.5);
126
+ vec3 silk = satin(k);
127
+ // The satin sheen: a broad glow and a tighter highlight off each fold.
128
+ float nh = max(dot(n, normalize(light + view)), 0.0);
129
+ float sheen = pow(nh, 12.0) * 0.25 + pow(nh, 60.0) * 0.3;
130
+ silk = mix(silk, fromOklab(uPal[2]) + 0.05, clamp(sheen, 0.0, 1.0));
131
+ // A slightly lighter rolled hem.
132
+ silk = mix(silk, satin(k + 0.25), smoothstep(0.88, 1.0, abs(v)) * 0.5);
133
+ col = mix(col, silk, inside);
134
+ }
135
+ col += (hash(gl_FragCoord.xy + fract(t)) - 0.5) / 255.0 * 1.5;
136
+ gl_FragColor = vec4(col, 1.0);
137
+ }
138
+ `;
139
+
140
+ /** The default satin: hot pink, coral, peach. */
141
+ const COLORS = ['#e2357a', '#f0906a', '#f5d0a4'];
142
+
143
+ /** Where each `side` puts the ribbon, for `uSide`. */
144
+ const SIDES = { right: 1, left: -1, center: 0 };
145
+
146
+ /**
147
+ * Colours sorted dark to light, as the satin shades them.
148
+ *
149
+ * @param {string[]} colors CSS hex colours.
150
+ * @returns {string[]} The first three, darkest first.
151
+ */
152
+ const byLightness = (colors) =>
153
+ [0, 1, 2]
154
+ .map((i) => colors[i % colors.length])
155
+ .sort((a, b) => toOklab(parseColor(a))[0] - toOklab(parseColor(b))[0]);
156
+
157
+ /**
158
+ * Starts a silk ribbon on an element: an opaque canvas inside it, filling it.
159
+ *
160
+ * @param {HTMLElement} el The element (its first canvas is drawn into).
161
+ * @param {SilkRibbonConfig} config The settings.
162
+ * @returns {() => void} Stops it.
163
+ */
164
+ export function silkRibbon(el, config) {
165
+ let pal = paletteUniform(byLightness(pickColors(config, COLORS)));
166
+ const start = performance.now();
167
+ const speed = config.speed ?? 1;
168
+ const side = SIDES[config.side ?? 'right'] ?? 1;
169
+ const lean = { x: 0, at: 0 };
170
+
171
+ const { stage, stop } = createStage(el, {
172
+ fragment: FRAG,
173
+ alpha: false,
174
+ setup({ gl, uniform }) {
175
+ gl.uniform3fv(uniform('uGround'), parseColor(config.background ?? '#f6f4f1'));
176
+ gl.uniform1f(uniform('uSide'), side);
177
+ gl.uniform1f(uniform('uTwist'), config.twist ?? 1);
178
+ gl.uniform1f(uniform('uFolds'), config.folds ?? 1);
179
+ gl.uniform1f(uniform('uGlow'), config.glow ?? 1);
180
+ },
181
+ uniforms({ gl, uniform, still }, now) {
182
+ const t = ((now - start) / 1000) * speed;
183
+ const p = !still && canHover() ? pointerIn(el) : null;
184
+ // The folds lean towards the pointer, easing back when it leaves.
185
+ const goal = p?.inside ? { x: p.x - 0.5, at: p.y - 0.5 } : { x: 0, at: lean.at };
186
+ lean.x += (goal.x - lean.x) * 0.03;
187
+ lean.at += (goal.at - lean.at) * 0.03;
188
+ // Eight seconds in, where the first (and the still) frame shows a twist.
189
+ gl.uniform1f(uniform('uTime'), t + 8);
190
+ // The shader mirrors a left-hand ribbon, so the lean is mirrored with it.
191
+ gl.uniform1f(uniform('uLean'), side < 0 ? -lean.x : lean.x);
192
+ gl.uniform1f(uniform('uLeanAt'), lean.at);
193
+ gl.uniform3fv(uniform('uPal'), pal);
194
+ },
195
+ });
196
+ if (!stage) return stop;
197
+
198
+ const unwatch = watchColors(el, (next) => {
199
+ pal = paletteUniform(byLightness(next.colors));
200
+ if (stage.still) stage.redraw();
201
+ });
202
+ return () => {
203
+ stop();
204
+ unwatch();
205
+ };
206
+ }
@@ -0,0 +1,27 @@
1
+ /** A slide number brought into range, wrapping round at either end. */
2
+ export function wrap(i: number, count: number): number;
3
+
4
+ /** Which way a finished drag goes: 1 for the next slide (a swipe left), -1 for the previous, 0 for no swipe. */
5
+ export function swipeStep(dx: number, dy: number, ms: number): -1 | 0 | 1;
6
+
7
+ export interface SlideshowOptions {
8
+ /** How many slides there are. */
9
+ count: number;
10
+ /** Seconds each slide stays before the next, when playing. Default 5. */
11
+ interval?: number;
12
+ /** Move on by itself. Default true. */
13
+ autoplay?: boolean;
14
+ /** What to read out for a slide (its alt). */
15
+ describe?(index: number): string;
16
+ /** Draws the change; the slideshow waits for it, keeping the latest asked for meanwhile. */
17
+ show(to: number, from: number, dir: 1 | -1): Promise<void> | void;
18
+ }
19
+
20
+ /**
21
+ * Runs a slideshow on an element: moving on every `interval` (held while
22
+ * hovered, focused, pressed, off screen or in a hidden tab), the arrow keys
23
+ * and a swipe, `[data-slide-dot]` buttons (with `aria-current` and a
24
+ * `--slide-progress` while playing), and `[data-slide-live]` reading out the slide
25
+ * a person moved to.
26
+ */
27
+ export function slideshow(el: HTMLElement, options: SlideshowOptions): { go(to: number, dir?: 1 | -1, user?: boolean): void; stop(): void };
@@ -0,0 +1,234 @@
1
+ /**
2
+ * @module @arraypress/effects-astro/slideshow
3
+ *
4
+ * What a slideshow does besides drawing its pictures: moving on by itself
5
+ * every so often (paused while hovered, focused, pressed, off screen or in
6
+ * a hidden tab), the arrow keys and a swipe for the previous and next, dots
7
+ * that pick one, and the current picture's alt read out politely when a
8
+ * person changed it. The effect draws each change; this decides when.
9
+ */
10
+
11
+ import { animate } from './loop.js';
12
+ import { CLICK_IGNORE } from './pointer.js';
13
+
14
+ /** How far a swipe must travel across, CSS px, and the most it may take, ms. */
15
+ const SWIPE = { distance: 40, time: 800 };
16
+
17
+ /**
18
+ * A slide number brought into range, wrapping round at either end.
19
+ *
20
+ * @param {number} i The number, any integer.
21
+ * @param {number} count How many slides there are.
22
+ * @returns {number} It, 0 to count - 1.
23
+ */
24
+ export function wrap(i, count) {
25
+ return ((i % count) + count) % count;
26
+ }
27
+
28
+ /**
29
+ * Which way a finished drag goes: a quick, mostly sideways stroke far
30
+ * enough across is a swipe.
31
+ *
32
+ * @param {number} dx How far it went right, px.
33
+ * @param {number} dy How far it went down, px.
34
+ * @param {number} ms How long it took.
35
+ * @returns {-1 | 0 | 1} 1 for the next slide (a swipe left), -1 for the previous, 0 for no swipe.
36
+ */
37
+ export function swipeStep(dx, dy, ms) {
38
+ if (ms > SWIPE.time || Math.abs(dx) < SWIPE.distance || Math.abs(dx) < 1.5 * Math.abs(dy)) return 0;
39
+ return dx < 0 ? 1 : -1;
40
+ }
41
+
42
+ /**
43
+ * @typedef {object} SlideshowOptions
44
+ * @property {number} count How many slides there are.
45
+ * @property {number} [interval=5] Seconds each slide stays before the next, when playing.
46
+ * @property {boolean} [autoplay=true] Move on by itself.
47
+ * @property {(index: number) => string} [describe] What to read out for a slide (its alt).
48
+ * @property {(to: number, from: number, dir: 1 | -1) => Promise<void> | void} show Draws the change;
49
+ * the slideshow waits for it before the next one, keeping the latest asked for meanwhile.
50
+ */
51
+
52
+ /**
53
+ * Runs a slideshow on an element: its `[data-slide-dot]` buttons pick a slide
54
+ * (and carry `aria-current` and a `--slide-progress` 0–1 while playing),
55
+ * and its `[data-slide-live]` element announces the slide a person moved to.
56
+ *
57
+ * @param {HTMLElement} el The slideshow (focusable, so it takes the arrow keys).
58
+ * @param {SlideshowOptions} options The slides and how to show a change.
59
+ * @returns {{ go: (to: number, dir?: 1 | -1, user?: boolean) => void, stop: () => void }} Moves to a slide; stops it all.
60
+ */
61
+ export function slideshow(el, options) {
62
+ const { count, interval = 5, autoplay = true, describe, show } = options;
63
+ const dots = /** @type {HTMLElement[]} */ ([...el.querySelectorAll('[data-slide-dot]')]);
64
+ const live = el.querySelector('[data-slide-live]');
65
+ const held = { hover: false, focus: false, press: false };
66
+ const playing = autoplay && count > 1;
67
+ let index = 0;
68
+ let busy = false;
69
+ let stopped = false;
70
+ let elapsed = 0;
71
+ /** @type {{ to: number, dir: 1 | -1, user: boolean } | null} */
72
+ let queued = null;
73
+ /** @type {{ x: number, y: number, t: number } | null} */
74
+ let down = null;
75
+
76
+ /**
77
+ * Marks a slide current on the dots, and reads its alt out when a person chose it.
78
+ *
79
+ * @param {number} i The slide.
80
+ * @param {boolean} user Whether a person moved to it.
81
+ */
82
+ const mark = (i, user) => {
83
+ dots.forEach((dot, k) => {
84
+ if (k === i) dot.setAttribute('aria-current', 'true');
85
+ else dot.removeAttribute('aria-current');
86
+ if (playing) dot.style.setProperty('--slide-progress', '0');
87
+ });
88
+ if (user && live && describe) live.textContent = `${i + 1} of ${count}: ${describe(i)}`;
89
+ };
90
+
91
+ /**
92
+ * Moves to a slide: now, or once the change on screen has finished.
93
+ *
94
+ * @param {number} to The slide (wrapped into range).
95
+ * @param {1 | -1} [dir] Which way it goes; by default the shorter way forward or back.
96
+ * @param {boolean} [user=false] Whether a person asked for it (it is then read out).
97
+ */
98
+ const go = (to, dir, user = false) => {
99
+ const target = wrap(to, count);
100
+ const way = dir ?? (target >= index ? 1 : -1);
101
+ if (stopped) return;
102
+ if (busy) {
103
+ queued = { to: target, dir: way, user };
104
+ return;
105
+ }
106
+ if (target === index) return;
107
+ const from = index;
108
+ index = target;
109
+ elapsed = 0;
110
+ busy = true;
111
+ mark(target, user);
112
+ Promise.resolve(show(target, from, way))
113
+ .catch(() => {})
114
+ .then(() => {
115
+ busy = false;
116
+ const next = queued;
117
+ queued = null;
118
+ if (next) go(next.to, next.dir, next.user);
119
+ });
120
+ };
121
+
122
+ /**
123
+ * Steps the timer while it may run, and moves on when it is up.
124
+ *
125
+ * @param {number} _now The time, ms.
126
+ * @param {number} dt Seconds since the last frame.
127
+ */
128
+ const tick = (_now, dt) => {
129
+ if (busy || held.hover || held.focus || held.press) return;
130
+ elapsed += dt;
131
+ dots[index]?.style.setProperty('--slide-progress', String(Math.min(1, elapsed / interval)));
132
+ if (elapsed >= interval) go(index + 1, 1);
133
+ };
134
+
135
+ /**
136
+ * The arrow keys, while it has focus.
137
+ *
138
+ * @param {KeyboardEvent} e The key.
139
+ */
140
+ const onKey = (e) => {
141
+ if (e.altKey || e.ctrlKey || e.metaKey) return;
142
+ const by = { ArrowLeft: -1, ArrowRight: 1 }[e.key];
143
+ if (!by) return;
144
+ e.preventDefault();
145
+ go(index + by, /** @type {1 | -1} */ (by), true);
146
+ };
147
+
148
+ /**
149
+ * A dot pressed: its slide.
150
+ *
151
+ * @param {MouseEvent} e The click.
152
+ */
153
+ const onClick = (e) => {
154
+ const dot = /** @type {HTMLElement} */ (e.target).closest('[data-slide-dot]');
155
+ const i = dot ? dots.indexOf(/** @type {HTMLElement} */ (dot)) : -1;
156
+ if (i >= 0) go(i, i > index ? 1 : -1, true);
157
+ };
158
+
159
+ /**
160
+ * A press starts: a swipe, perhaps, unless it is on a control.
161
+ *
162
+ * @param {PointerEvent} e The press.
163
+ */
164
+ const onDown = (e) => {
165
+ if (!e.isPrimary || /** @type {HTMLElement} */ (e.target).closest(CLICK_IGNORE)) return;
166
+ down = { x: e.clientX, y: e.clientY, t: e.timeStamp };
167
+ held.press = true;
168
+ };
169
+
170
+ /**
171
+ * A press ends: a swipe moves on.
172
+ *
173
+ * @param {PointerEvent} e The release.
174
+ */
175
+ const onUp = (e) => {
176
+ held.press = false;
177
+ if (!down || !e.isPrimary) return;
178
+ const by = swipeStep(e.clientX - down.x, e.clientY - down.y, e.timeStamp - down.t);
179
+ down = null;
180
+ if (by) go(index + by, by, true);
181
+ };
182
+
183
+ /**
184
+ * A mouse over it holds the timer; a touch does not, as it never leaves.
185
+ *
186
+ * @param {PointerEvent} e The pointer.
187
+ */
188
+ const onEnter = (e) => {
189
+ if (e.pointerType === 'mouse') held.hover = true;
190
+ };
191
+
192
+ /** The mouse has left: the timer runs again. */
193
+ const onLeave = () => {
194
+ held.hover = false;
195
+ };
196
+
197
+ /** Focus inside it holds the timer, so a keyboard or screen reader user is not overtaken. */
198
+ const onFocus = () => {
199
+ held.focus = true;
200
+ };
201
+
202
+ /**
203
+ * Focus has left it altogether: the timer runs again.
204
+ *
205
+ * @param {FocusEvent} e The focus change.
206
+ */
207
+ const onBlur = (e) => {
208
+ if (!el.contains(/** @type {Node | null} */ (e.relatedTarget))) held.focus = false;
209
+ };
210
+
211
+ const listeners = /** @type {[string, (e: any) => void][]} */ ([
212
+ ['keydown', onKey],
213
+ ['click', onClick],
214
+ ['pointerdown', onDown],
215
+ ['pointerup', onUp],
216
+ ['pointercancel', onUp],
217
+ ['pointerenter', onEnter],
218
+ ['pointerleave', onLeave],
219
+ ['focusin', onFocus],
220
+ ['focusout', onBlur],
221
+ ]);
222
+ for (const [type, fn] of listeners) el.addEventListener(type, fn);
223
+ const stopTimer = playing ? animate(el, tick) : () => {};
224
+ mark(0, false);
225
+
226
+ return {
227
+ go,
228
+ stop: () => {
229
+ stopped = true;
230
+ stopTimer();
231
+ for (const [type, fn] of listeners) el.removeEventListener(type, fn);
232
+ },
233
+ };
234
+ }
@@ -0,0 +1,9 @@
1
+ export interface SpotlightConfig {
2
+ /** The light's radius, a share of the font size. Default 0.85. */
3
+ radius?: number;
4
+ /** How far outside the text (CSS px) the pointer still lights it. Default 40. */
5
+ reach?: number;
6
+ }
7
+
8
+ /** Starts the spotlight on `el` (styled by SpotlightText.astro). Returns a function that stops it. */
9
+ export function spotlight(el: HTMLElement, config: SpotlightConfig): () => void;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @module @arraypress/effects-astro/spotlight
3
+ *
4
+ * Text as a hollow outline that a soft light under the pointer fills in.
5
+ * The fill is the element's own `::before` and `::after`: the word again,
6
+ * solid, masked to a radial gradient at `--spot-x` / `--spot-y`,
7
+ * `--spot-r` wide. This only moves those; the look is CSS
8
+ * (SpotlightText.astro).
9
+ *
10
+ * The light trails the pointer a little, swells in as it arrives over the
11
+ * text and shrinks away when it leaves. The pointer is read from the
12
+ * document, so the text can keep `pointer-events: none` (a big wordmark's
13
+ * line box often overlaps links). Animates only while the light is moving.
14
+ * Without a hovering pointer the text stays an outline; with
15
+ * prefers-reduced-motion the light follows without easing.
16
+ */
17
+
18
+ import { canHover, prefersReducedMotion } from './device.js';
19
+
20
+ /**
21
+ * @typedef {object} SpotlightConfig
22
+ * @property {number} [radius=0.85] The light's radius, a share of the font size.
23
+ * @property {number} [reach=40] How far outside the text (CSS px) the pointer still lights it.
24
+ */
25
+
26
+ /**
27
+ * Starts the spotlight on an element.
28
+ *
29
+ * @param {HTMLElement} el The text.
30
+ * @param {SpotlightConfig} config The settings.
31
+ * @returns {() => void} Stops it.
32
+ */
33
+ export function spotlight(el, config) {
34
+ // The pseudo-elements copy the text from here.
35
+ el.dataset.text = el.textContent?.trim() ?? '';
36
+ if (!canHover()) return () => {};
37
+ const radius = config.radius ?? 0.85;
38
+ const reach = config.reach ?? 40;
39
+ const ease = prefersReducedMotion() ? 1 : 0.2;
40
+ const spot = { x: 0, y: 0, r: 0, tx: 0, ty: 0, tr: 0 };
41
+ let raf = 0;
42
+
43
+ /** Writes the light's position and size to the element. */
44
+ const apply = () => {
45
+ el.style.setProperty('--spot-x', `${spot.x.toFixed(1)}px`);
46
+ el.style.setProperty('--spot-y', `${spot.y.toFixed(1)}px`);
47
+ el.style.setProperty('--spot-r', `${spot.r.toFixed(1)}px`);
48
+ };
49
+
50
+ /** One frame: close part of the gap to the target; carry on until there. */
51
+ const tick = () => {
52
+ spot.x += (spot.tx - spot.x) * ease;
53
+ spot.y += (spot.ty - spot.y) * ease;
54
+ spot.r += (spot.tr - spot.r) * ease * 0.6;
55
+ const settled = Math.abs(spot.tx - spot.x) < 0.5 && Math.abs(spot.ty - spot.y) < 0.5 && Math.abs(spot.tr - spot.r) < 0.5;
56
+ if (settled) Object.assign(spot, { x: spot.tx, y: spot.ty, r: spot.tr });
57
+ apply();
58
+ raf = settled ? 0 : requestAnimationFrame(tick);
59
+ };
60
+
61
+ /**
62
+ * Heads the light for the pointer while it is over the text (or near),
63
+ * and shrinks it away where it is when it leaves.
64
+ *
65
+ * @param {number | null} cx Pointer x in the viewport, or null when it has left the window.
66
+ * @param {number} [cy] Pointer y in the viewport.
67
+ */
68
+ const follow = (cx, cy = 0) => {
69
+ const box = el.getBoundingClientRect();
70
+ const over = cx !== null && cx > box.left - reach && cx < box.right + reach && cy > box.top - reach && cy < box.bottom + reach;
71
+ if (over) {
72
+ const x = cx - box.left;
73
+ const y = cy - box.top;
74
+ // Arriving: start the light where the pointer is, not where it went out.
75
+ if (spot.r < 1) Object.assign(spot, { x, y });
76
+ Object.assign(spot, { tx: x, ty: y, tr: parseFloat(getComputedStyle(el).fontSize) * radius });
77
+ } else if (spot.tr) {
78
+ spot.tr = 0;
79
+ } else {
80
+ return;
81
+ }
82
+ raf ||= requestAnimationFrame(tick);
83
+ };
84
+
85
+ /** @param {PointerEvent} e The move. */
86
+ const move = (e) => follow(e.clientX, e.clientY);
87
+ /** The pointer has left the window. */
88
+ const leave = () => follow(null);
89
+ document.addEventListener('pointermove', move, { passive: true });
90
+ document.documentElement.addEventListener('pointerleave', leave);
91
+
92
+ return () => {
93
+ cancelAnimationFrame(raf);
94
+ document.removeEventListener('pointermove', move);
95
+ document.documentElement.removeEventListener('pointerleave', leave);
96
+ };
97
+ }
@@ -0,0 +1,53 @@
1
+ /** The layouts, the first the default. */
2
+ export const LAYOUTS: readonly ['fan', 'stack', 'arc'];
3
+
4
+ /** How the covers are laid out: a hand of cards, a deck seen at an angle, or a carousel arc. */
5
+ export type Layout = 'fan' | 'stack' | 'arc';
6
+
7
+ /** Where one cover sits. Lengths are in cover widths. */
8
+ export interface Pose {
9
+ /** Across; right is positive. */
10
+ x: number;
11
+ /** Down. */
12
+ y: number;
13
+ /** Towards the viewer. */
14
+ z: number;
15
+ /** Turn about the horizontal axis, degrees. */
16
+ rx: number;
17
+ /** Turn about the vertical axis, degrees. */
18
+ ry: number;
19
+ /** Turn in the plane, degrees. */
20
+ rz: number;
21
+ /** Scale. */
22
+ s: number;
23
+ /** How far out of focus, 0 sharp to 1 the furthest. */
24
+ blur: number;
25
+ }
26
+
27
+ /** The state a stack is in. */
28
+ export interface PoseState {
29
+ /** How far apart the covers sit, 0–2. Default 1. */
30
+ spread?: number;
31
+ /** Whether the covers are fanned apart. Default false. */
32
+ open?: boolean;
33
+ /** The cover lifted forward; -1 for none. Default -1. */
34
+ lifted?: number;
35
+ }
36
+
37
+ /** A known layout, or `fan`. */
38
+ export function layoutOf(layout: unknown): Layout;
39
+
40
+ /** The cover in front when none is lifted: the middle one in a fan (half way between two when the count is even) or an arc (the left of two), the first in a stack. */
41
+ export function frontOf(layout: Layout, n: number): number;
42
+
43
+ /** Every cover's pose: placed, centred, and given how far it is out of focus. */
44
+ export function stackPoses(layout: Layout, n: number, state?: PoseState): Pose[];
45
+
46
+ /** The room the stack needs at its widest (open, any cover lifted), in cover widths. */
47
+ export function stackBounds(layout: Layout, n: number, spread?: number, ratio?: number): { wide: number; tall: number };
48
+
49
+ /** A pose as a CSS transform, in `--ps-w` (the cover's width); the same functions every time, so it eases. */
50
+ export function poseTransform(pose: Pose): string;
51
+
52
+ /** A pose's depth of field as a CSS filter (brightness, saturation, a little blur on the furthest), at a strength of 0–1. */
53
+ export function poseFilter(pose: Pose, depth: number): string;