@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,222 @@
1
+ ---
2
+ /**
3
+ * OutlineWordmark: a name at enormous scale, drawn as one outline, cropped
4
+ * so it sinks out of the bottom of the page, with a bright beam travelling
5
+ * through the letters. A page's closing mark: it ends on the brand rather
6
+ * than trailing off after the last link column, and as an outline it reads
7
+ * as texture rather than a second logo.
8
+ *
9
+ * The outline comes from an SVG filter, not `-webkit-text-stroke`: text-stroke
10
+ * outlines every glyph separately, so tightly tracked letters show both
11
+ * outlines crossing. Filling the text, eroding a copy and subtracting it
12
+ * leaves the edge of the merged shape, one silhouette for the whole word
13
+ * (counters still outline). The beam is a second copy, masked to a moving
14
+ * band, since a gradient fill would not survive the filter.
15
+ *
16
+ * Sized in container units, so it spans its own box whatever the name's
17
+ * length. Decoration: hidden from assistive technology (the name should be
18
+ * real text elsewhere on the page). The beam stops for reduced motion;
19
+ * without SVG filters a faint solid fill shows.
20
+ *
21
+ * With `spotlight` (on by default), a soft light under the pointer brings
22
+ * the outline up to full strength and fills the letters around it: the
23
+ * spotlight runtime (src/runtime/spotlight.js) moves the light, as it does
24
+ * for `<SpotlightText>`. Nothing on a touch screen.
25
+ *
26
+ * From the ArrayPress theme's footer.
27
+ *
28
+ * @example
29
+ * <OutlineWordmark text="ArrayPress" color="var(--accent)" />
30
+ */
31
+
32
+ interface Props {
33
+ /** The name. */
34
+ text: string;
35
+ /** The colour of the outline and the beam. Default `currentColor`. */
36
+ color?: string;
37
+ /** Share of the glyph height left showing, 0–1. Default 0.68. */
38
+ crop?: number;
39
+ /** Type size, as a share of the box's width (18 is 18% of it). Default 18. */
40
+ size?: number;
41
+ /** The outline's width, px. Default 2. */
42
+ stroke?: number;
43
+ /** How strong the resting outline is, 0–1. Default 0.42. */
44
+ opacity?: number;
45
+ /** The travelling beam. Default true. */
46
+ beam?: boolean;
47
+ /** Seconds the beam takes to cross. Default 5.5. */
48
+ speed?: number;
49
+ /** A light under the pointer that fills the letters. Default true. */
50
+ spotlight?: boolean;
51
+ /** The light's radius, a share of the type size. Default 0.6. */
52
+ radius?: number;
53
+ /** Letter spacing, em. Default -0.02. */
54
+ tracking?: number;
55
+ /** CSS font-family. Default inherited. */
56
+ font?: string;
57
+ /** CSS font-weight. Default 700. */
58
+ weight?: number | string;
59
+ class?: string;
60
+ }
61
+
62
+ const {
63
+ text,
64
+ color = 'currentColor',
65
+ crop = 0.68,
66
+ size = 18,
67
+ stroke = 2,
68
+ opacity = 0.42,
69
+ beam = true,
70
+ speed = 5.5,
71
+ spotlight = true,
72
+ radius = 0.6,
73
+ tracking = -0.02,
74
+ font = 'inherit',
75
+ weight = 700,
76
+ class: className,
77
+ } = Astro.props;
78
+
79
+ // One filter a wordmark, so two on a page do not share a stroke width.
80
+ const id = `effect-outline-${Math.random().toString(36).slice(2, 9)}`;
81
+ const vars = [
82
+ `--ow-color: ${color}`,
83
+ `--ow-crop: ${crop}`,
84
+ `--ow-size: ${size}cqw`,
85
+ `--ow-opacity: ${opacity}`,
86
+ `--ow-speed: ${speed}s`,
87
+ `--ow-tracking: ${tracking}em`,
88
+ `--ow-font: ${font}`,
89
+ `--ow-weight: ${weight}`,
90
+ `--ow-filter: url(#${id})`,
91
+ ].join('; ');
92
+ ---
93
+
94
+ <div class:list={['effect-outline-wordmark', className]} aria-hidden="true" style={vars}>
95
+ <svg class="defs" aria-hidden="true" focusable="false">
96
+ <filter id={id} x="-2%" y="-2%" width="104%" height="104%" color-interpolation-filters="sRGB">
97
+ <feMorphology operator="erode" radius={stroke} result="inner" />
98
+ <feComposite in="SourceGraphic" in2="inner" operator="out" />
99
+ </filter>
100
+ </svg>
101
+ <div class="crop">
102
+ <span class="word">{text}</span>
103
+ {
104
+ beam && (
105
+ <span class="beam">
106
+ <span class="word">{text}</span>
107
+ </span>
108
+ )
109
+ }
110
+ {
111
+ spotlight && (
112
+ <span class="spot" data-effect-outline-spot data-effect-config={JSON.stringify({ radius, reach: 0 })}>
113
+ <span class="word fill">{text}</span>
114
+ <span class="word">{text}</span>
115
+ </span>
116
+ )
117
+ }
118
+ </div>
119
+ </div>
120
+
121
+ <script>
122
+ import { mount } from '../runtime/mount.js';
123
+ import { spotlight } from '../runtime/spotlight.js';
124
+
125
+ mount('[data-effect-outline-spot]', spotlight);
126
+ </script>
127
+
128
+ <style>
129
+ .effect-outline-wordmark {
130
+ width: 100%;
131
+ pointer-events: none;
132
+ user-select: none;
133
+ /* `cqw` below resolves against this box; the crop lives on a child,
134
+ since an element cannot use its own container units. */
135
+ container-type: inline-size;
136
+ }
137
+ .defs {
138
+ position: absolute;
139
+ width: 0;
140
+ height: 0;
141
+ }
142
+ .crop {
143
+ position: relative;
144
+ overflow: hidden;
145
+ line-height: 0.78;
146
+ max-height: calc(var(--ow-size) * var(--ow-crop));
147
+ /* Fading out rather than stopping on a hard cut, so the crop reads
148
+ as the mark sinking out of the page, not a clipping bug. */
149
+ -webkit-mask-image: linear-gradient(to bottom, #000 42%, rgb(0 0 0 / 0.35) 78%, transparent 100%);
150
+ mask-image: linear-gradient(to bottom, #000 42%, rgb(0 0 0 / 0.35) 78%, transparent 100%);
151
+ }
152
+ .word {
153
+ display: block;
154
+ font-family: var(--ow-font);
155
+ font-size: var(--ow-size);
156
+ font-weight: var(--ow-weight);
157
+ letter-spacing: var(--ow-tracking);
158
+ text-align: center;
159
+ white-space: nowrap;
160
+ /* Without the filter this is what paints: faint, not a solid block. */
161
+ color: color-mix(in srgb, var(--ow-color) 10%, transparent);
162
+ }
163
+ @supports (filter: url(#x)) {
164
+ .word {
165
+ /* Fully opaque, faded with opacity after: the filter subtracts the
166
+ eroded copy, and only an opaque source subtracts to nothing. */
167
+ color: var(--ow-color);
168
+ filter: var(--ow-filter);
169
+ opacity: var(--ow-opacity);
170
+ }
171
+ }
172
+ .beam {
173
+ position: absolute;
174
+ inset: 0;
175
+ }
176
+ .beam .word {
177
+ opacity: 1;
178
+ -webkit-mask-image: linear-gradient(100deg, transparent 42%, #000 48%, #000 52%, transparent 58%);
179
+ mask-image: linear-gradient(100deg, transparent 42%, #000 48%, #000 52%, transparent 58%);
180
+ -webkit-mask-size: 320% 100%;
181
+ mask-size: 320% 100%;
182
+ -webkit-mask-repeat: no-repeat;
183
+ mask-repeat: no-repeat;
184
+ animation: effect-outline-beam var(--ow-speed) linear infinite;
185
+ }
186
+ /* The light: the type size lives here too, so the runtime sizes the
187
+ light from it, and both copies below are masked to it. */
188
+ .spot {
189
+ position: absolute;
190
+ inset: 0;
191
+ font-size: var(--ow-size);
192
+ }
193
+ .spot .word {
194
+ position: absolute;
195
+ inset: 0;
196
+ opacity: 1;
197
+ -webkit-mask-image: radial-gradient(circle var(--spot-r, 0px) at var(--spot-x, 50%) var(--spot-y, 50%), #000 0%, rgb(0 0 0 / 0.6) 45%, transparent 100%);
198
+ mask-image: radial-gradient(circle var(--spot-r, 0px) at var(--spot-x, 50%) var(--spot-y, 50%), #000 0%, rgb(0 0 0 / 0.6) 45%, transparent 100%);
199
+ }
200
+ /* Inside the outline, a softer, tighter fill. */
201
+ .spot .fill {
202
+ filter: none;
203
+ color: var(--ow-color);
204
+ -webkit-mask-image: radial-gradient(circle calc(var(--spot-r, 0px) * 0.7) at var(--spot-x, 50%) var(--spot-y, 50%), #000 0%, rgb(0 0 0 / 0.55) 50%, transparent 100%);
205
+ mask-image: radial-gradient(circle calc(var(--spot-r, 0px) * 0.7) at var(--spot-x, 50%) var(--spot-y, 50%), #000 0%, rgb(0 0 0 / 0.55) 50%, transparent 100%);
206
+ }
207
+ @keyframes effect-outline-beam {
208
+ from {
209
+ -webkit-mask-position: -110% 0;
210
+ mask-position: -110% 0;
211
+ }
212
+ to {
213
+ -webkit-mask-position: 210% 0;
214
+ mask-position: 210% 0;
215
+ }
216
+ }
217
+ @media (prefers-reduced-motion: reduce) {
218
+ .beam {
219
+ display: none;
220
+ }
221
+ }
222
+ </style>
@@ -0,0 +1,40 @@
1
+ ---
2
+ /**
3
+ * PaperBackground: what every Paper look's component renders (internal;
4
+ * `<ColorPanels>` and the rest are the components to use). The look's
5
+ * props reach the page as they are, and src/runtime/paper-look.js turns
6
+ * them into Paper's settings there, so a look's component is only its
7
+ * documented props. Fills its nearest positioned ancestor, or the
8
+ * viewport with `fixed`; without WebGL 2 its background colour shows.
9
+ *
10
+ * @example
11
+ * <PaperBackground look="color-panels" config={config} fixed={fixed} class={className} />
12
+ */
13
+ import EffectCanvas from './EffectCanvas.astro';
14
+ import { paperSettings } from '../runtime/paper.js';
15
+ import { paperLookSettings } from '../runtime/paper-look.js';
16
+ import type { PaperLookName } from '../runtime/paper-looks.js';
17
+
18
+ interface Props {
19
+ /** The look. */
20
+ look: PaperLookName;
21
+ /** Its props, as its component was given them. */
22
+ config: Record<string, unknown>;
23
+ /** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
24
+ fixed?: boolean;
25
+ class?: string;
26
+ }
27
+
28
+ const { look, config, fixed = false, class: className } = Astro.props;
29
+ const settings = { look, ...config };
30
+ const back = paperSettings(paperLookSettings(settings)).colorBack;
31
+ ---
32
+
33
+ <EffectCanvas name="paper-look" config={settings} fixed={fixed} behind background={typeof back === 'string' ? back : undefined} class={className} />
34
+
35
+ <script>
36
+ import { mount } from '../runtime/mount.js';
37
+ import { paperLook } from '../runtime/paper-look.js';
38
+
39
+ mount('[data-effect-paper-look]', paperLook);
40
+ </script>
@@ -0,0 +1,55 @@
1
+ ---
2
+ /**
3
+ * PaperShader: any of the thirty Paper Shaders (mesh and grain gradients,
4
+ * god rays, liquid metal, water, warp, dithering, halftones, metaballs,
5
+ * voronoi, smoke rings and more), with Paper's own presets, and no React.
6
+ * See src/runtime/paper.js; the shaders are vendored from Paper
7
+ * (Apache-2.0).
8
+ *
9
+ * Start from a `preset` and change any of Paper's settings with `params`.
10
+ * The shaders that bend or trace a picture (fluted glass, water, lens
11
+ * distortion, liquid metal, halftones, dithering, heatmap) take `image`, or
12
+ * `gradient` to make one from colours. Fills its nearest positioned
13
+ * ancestor, or the viewport with `fixed`. Needs WebGL 2; without it the
14
+ * `background` shows.
15
+ *
16
+ * Paper's shaders paint every pixel: as a backdrop under copy, lower
17
+ * `opacity` so the text keeps its contrast.
18
+ *
19
+ * @example
20
+ * <PaperShader shader="mesh-gradient" preset="beach" />
21
+ * <PaperShader shader="god-rays" colors={['#a78bfa', '#f0abfc']} params={{ density: 0.4 }} opacity={0.6} />
22
+ * <PaperShader shader="liquid-metal" image="/logo.svg" />
23
+ */
24
+ import EffectCanvas from './EffectCanvas.astro';
25
+ import type { PaperConfig } from '../runtime/paper.js';
26
+
27
+ interface Props extends PaperConfig {
28
+ /** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
29
+ fixed?: boolean;
30
+ /** The colour shown before it draws, and without WebGL 2. Default transparent. */
31
+ background?: string;
32
+ /** Its opacity, 0–1, for backdrops under copy. Default 1. */
33
+ opacity?: number;
34
+ class?: string;
35
+ }
36
+
37
+ const { fixed = false, background, opacity = 1, class: className, ...config } = Astro.props;
38
+ ---
39
+
40
+ <EffectCanvas
41
+ name="paper"
42
+ config={config}
43
+ fixed={fixed}
44
+ behind
45
+ background={background}
46
+ opacity={opacity}
47
+ class={className}
48
+ />
49
+
50
+ <script>
51
+ import { mount } from '../runtime/mount.js';
52
+ import { paperShader } from '../runtime/paper.js';
53
+
54
+ mount('[data-effect-paper]', paperShader);
55
+ </script>
@@ -0,0 +1,49 @@
1
+ ---
2
+ /**
3
+ * Parallax: a layer that drifts with the pointer over its region, by its
4
+ * depth; give layers different depths (negative ones move against the
5
+ * pointer) and they separate into depth. Decorative blobs behind a hero,
6
+ * a floating product shot. See src/runtime/tilt.js.
7
+ *
8
+ * The region is the nearest ancestor with `data-parallax-root` (or the
9
+ * parent). Off with prefers-reduced-motion and on touch screens.
10
+ *
11
+ * @example
12
+ * <section class="hero" data-parallax-root style="position: relative">
13
+ * <Parallax depth={18} class="blob one" />
14
+ * <Parallax depth={-12} class="blob two" />
15
+ * </section>
16
+ */
17
+ import type { HTMLTag } from 'astro/types';
18
+
19
+ interface Props {
20
+ /** The element to render. Default `div`. */
21
+ as?: HTMLTag;
22
+ /** How far it drifts at the region's edge, px; negative moves against the pointer. Default 18. */
23
+ depth?: number;
24
+ /** A selector for the region. Default the nearest `[data-parallax-root]`, or the parent. */
25
+ within?: string;
26
+ class?: string;
27
+ [attribute: string]: unknown;
28
+ }
29
+
30
+ const { as: Tag = 'div', depth, within, class: className, ...attributes } = Astro.props;
31
+ ---
32
+
33
+ <Tag class:list={['effect-parallax', className]} data-effect-parallax data-effect-config={JSON.stringify({ depth, within })} {...attributes}>
34
+ <slot />
35
+ </Tag>
36
+
37
+ <script>
38
+ import { mount } from '../runtime/mount.js';
39
+ import { parallax } from '../runtime/tilt.js';
40
+
41
+ mount('[data-effect-parallax]', parallax);
42
+ </script>
43
+
44
+ <style>
45
+ .effect-parallax {
46
+ translate: var(--parallax-x, 0px) var(--parallax-y, 0px);
47
+ transition: translate 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
48
+ }
49
+ </style>
@@ -0,0 +1,37 @@
1
+ ---
2
+ /**
3
+ * ParticleLogo: a logo or a word in thousands of twinkling particles that
4
+ * scatter and swirl round the pointer and tilt towards it, each dot
5
+ * fringed red and blue, over two slow blooms of colour.
6
+ * See src/runtime/particle-logo.js.
7
+ *
8
+ * Opaque: it is the whole background of what it fills (its nearest
9
+ * positioned ancestor, or the viewport with `fixed`). Without WebGL the
10
+ * `background` colour shows.
11
+ *
12
+ * @example
13
+ * <section class="hero" style="position: relative">
14
+ * <ParticleLogo src="/logo.svg" />
15
+ * <h1>Rewind <em>wild.</em></h1>
16
+ * </section>
17
+ */
18
+ import EffectCanvas from './EffectCanvas.astro';
19
+ import type { ParticleLogoConfig } from '../runtime/particle-logo.js';
20
+
21
+ interface Props extends ParticleLogoConfig {
22
+ /** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
23
+ fixed?: boolean;
24
+ class?: string;
25
+ }
26
+
27
+ const { fixed = false, class: className, ...config } = Astro.props;
28
+ ---
29
+
30
+ <EffectCanvas name="particle-logo" config={config} fixed={fixed} class={className} behind background={config.background ?? '#030305'} />
31
+
32
+ <script>
33
+ import { mount } from '../runtime/mount.js';
34
+ import { particleLogo } from '../runtime/particle-logo.js';
35
+
36
+ mount('[data-effect-particle-logo]', particleLogo);
37
+ </script>
@@ -0,0 +1,70 @@
1
+ ---
2
+ /**
3
+ * PixelGlitchText: one line of text that breaks into pixels under the
4
+ * pointer and knits back together behind it. With `stroke`, a hollow
5
+ * outline at rest that the pixels fill in. See src/runtime/pixel-glitch.js.
6
+ *
7
+ * With `fit`, the text is sized to span its parent's width (a footer
8
+ * wordmark). Any other attribute is passed to the element.
9
+ *
10
+ * @example
11
+ * <footer>
12
+ * <PixelGlitchText as="div" class="wordmark" fit stroke={1.5} aria-hidden="true">Northwave</PixelGlitchText>
13
+ * </footer>
14
+ */
15
+ import type { HTMLTag } from 'astro/types';
16
+ import type { PixelGlitchConfig } from '../runtime/pixel-glitch.js';
17
+ import { withStyle } from './style.js';
18
+
19
+ interface Props extends PixelGlitchConfig {
20
+ /** The element to render. Default `span`. */
21
+ as?: HTMLTag;
22
+ /** Size the text to span its parent's width. Default false. */
23
+ fit?: boolean;
24
+ class?: string;
25
+ [attribute: string]: unknown;
26
+ }
27
+
28
+ const { as: Tag = 'span', fit = false, cell, reach, decay, block, shift, stroke, class: className, style: given, ...attributes } = Astro.props;
29
+ ---
30
+
31
+ <Tag
32
+ class:list={['effect-pixel-glitch', { 'is-outline': (stroke ?? 0) > 0 }, className]}
33
+ data-effect-pixel-glitch
34
+ data-effect-config={JSON.stringify({ cell, reach, decay, block, shift, stroke })}
35
+ data-fit-text={fit ? '' : undefined}
36
+ style={withStyle(stroke ? `--glitch-stroke: ${stroke}px` : undefined, given)}
37
+ {...attributes}
38
+ >
39
+ <slot />
40
+ </Tag>
41
+
42
+ <script>
43
+ import { mount } from '../runtime/mount.js';
44
+ import { pixelGlitch } from '../runtime/pixel-glitch.js';
45
+ import { fitText } from '../runtime/fit-text.js';
46
+
47
+ mount('[data-fit-text]', fitText);
48
+ mount('[data-effect-pixel-glitch]', pixelGlitch);
49
+ </script>
50
+
51
+ <style>
52
+ .effect-pixel-glitch {
53
+ position: relative;
54
+ white-space: nowrap;
55
+ }
56
+ /* The outline at rest, in CSS until the canvas has drawn and without JS. */
57
+ .effect-pixel-glitch.is-outline {
58
+ -webkit-text-fill-color: transparent;
59
+ -webkit-text-stroke: var(--glitch-stroke) currentColor;
60
+ }
61
+ /* Once the canvas draws the text, the element's own is only for layout. */
62
+ .effect-pixel-glitch:global(.is-ready) {
63
+ -webkit-text-fill-color: transparent;
64
+ -webkit-text-stroke: 0;
65
+ }
66
+ .effect-pixel-glitch :global(.effect-pixel-glitch-canvas) {
67
+ position: absolute;
68
+ pointer-events: none;
69
+ }
70
+ </style>
@@ -0,0 +1,37 @@
1
+ ---
2
+ /**
3
+ * PointCloud: a word drawn as a matrix of bright dots among rippling sheets
4
+ * of point cloud, the scene tilting towards the pointer. With `trackers`,
5
+ * boxes lock onto the word like a detector's debug view.
6
+ * See src/runtime/point-cloud.js.
7
+ *
8
+ * Opaque: it is the whole background of what it fills (its nearest
9
+ * positioned ancestor, or the viewport with `fixed`). Without WebGL the
10
+ * `background` colour shows. The word is decoration: put the real
11
+ * headline in the page too (it can be visually hidden).
12
+ *
13
+ * @example
14
+ * <section class="hero" style="position: relative">
15
+ * <PointCloud text="inference" />
16
+ * </section>
17
+ */
18
+ import EffectCanvas from './EffectCanvas.astro';
19
+ import type { PointCloudConfig } from '../runtime/point-cloud.js';
20
+
21
+ interface Props extends PointCloudConfig {
22
+ /** Fill the viewport, behind the page (position: fixed, z-index -1). Default false. */
23
+ fixed?: boolean;
24
+ class?: string;
25
+ }
26
+
27
+ const { fixed = false, class: className, ...config } = Astro.props;
28
+ ---
29
+
30
+ <EffectCanvas name="point-cloud" config={config} fixed={fixed} class={className} behind background={config.background ?? '#020205'} />
31
+
32
+ <script>
33
+ import { mount } from '../runtime/mount.js';
34
+ import { pointCloud } from '../runtime/point-cloud.js';
35
+
36
+ mount('[data-effect-point-cloud]', pointCloud);
37
+ </script>