@arraypress/effects-astro 0.10.0 → 0.12.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 (47) hide show
  1. package/AGENTS.md +1 -1
  2. package/COMPONENTS.md +214 -10
  3. package/LICENSE +2 -2
  4. package/package.json +1 -1
  5. package/src/components/CascadeGrid.astro +41 -0
  6. package/src/components/DitherField.astro +41 -0
  7. package/src/components/DitherGradient.astro +41 -0
  8. package/src/components/FlowField.astro +38 -0
  9. package/src/components/FlutedGlow.astro +39 -0
  10. package/src/components/KineticGrid.astro +38 -0
  11. package/src/components/LightLeak.astro +39 -0
  12. package/src/components/PixelFountain.astro +20 -7
  13. package/src/components/PixelGlitchText.astro +4 -3
  14. package/src/components/PixelHorizon.astro +40 -0
  15. package/src/components/TruchetField.astro +40 -0
  16. package/src/components/VoronoiMesh.astro +39 -0
  17. package/src/index.d.ts +23 -1
  18. package/src/index.js +13 -1
  19. package/src/runtime/ascii-noise.js +6 -107
  20. package/src/runtime/bayer.d.ts +5 -0
  21. package/src/runtime/bayer.js +48 -0
  22. package/src/runtime/cascade-grid.d.ts +112 -0
  23. package/src/runtime/cascade-grid.js +423 -0
  24. package/src/runtime/dither-field.d.ts +74 -0
  25. package/src/runtime/dither-field.js +416 -0
  26. package/src/runtime/dither-gradient.d.ts +91 -0
  27. package/src/runtime/dither-gradient.js +410 -0
  28. package/src/runtime/flow-field.d.ts +117 -0
  29. package/src/runtime/flow-field.js +516 -0
  30. package/src/runtime/fluted-glow.d.ts +79 -0
  31. package/src/runtime/fluted-glow.js +312 -0
  32. package/src/runtime/hash-noise.d.ts +14 -0
  33. package/src/runtime/hash-noise.js +169 -0
  34. package/src/runtime/kinetic-grid.d.ts +88 -0
  35. package/src/runtime/kinetic-grid.js +487 -0
  36. package/src/runtime/light-leak.d.ts +72 -0
  37. package/src/runtime/light-leak.js +408 -0
  38. package/src/runtime/pixel-fountain.d.ts +29 -13
  39. package/src/runtime/pixel-fountain.js +183 -42
  40. package/src/runtime/pixel-glitch.d.ts +2 -0
  41. package/src/runtime/pixel-glitch.js +8 -2
  42. package/src/runtime/pixel-horizon.d.ts +60 -0
  43. package/src/runtime/pixel-horizon.js +274 -0
  44. package/src/runtime/truchet-field.d.ts +60 -0
  45. package/src/runtime/truchet-field.js +272 -0
  46. package/src/runtime/voronoi-mesh.d.ts +101 -0
  47. package/src/runtime/voronoi-mesh.js +610 -0
@@ -0,0 +1,101 @@
1
+ import type { PaletteName } from './palettes.js';
2
+
3
+ export interface VoronoiMeshConfig {
4
+ /** Two CSS hex colours: the macro lines' and the inner lines'. Default a pale stone and a dusty rose (`#c1c2bc`, `#a67676`). */
5
+ colors?: string[];
6
+ /** A shared palette by name (`PALETTES`, any case), when there are no `colors`: its glint for the macro lines, its first colour for the inner. */
7
+ palette?: PaletteName | (string & {});
8
+ /** The ground, a CSS hex colour (opaque, so the canvas covers what is behind it); `transparent` draws the lines alone. Default `#350f0e`. */
9
+ background?: string;
10
+ /** Macro cells across the width. Default 9. */
11
+ cells?: number;
12
+ /** Inner seeds per macro cell, 0–8; 0 for the macro tier alone. Default 5. */
13
+ inner?: number;
14
+ /** The macro lines' width in CSS px; the inner lines are 0.7 of it. Default 1. */
15
+ width?: number;
16
+ /** The macro and inner lines' opacity, each 0–1. Default [0.4, 0.22]. */
17
+ opacity?: [number, number];
18
+ /** How far the inner seeds pulse, 0–1: 1 draws them in to the macro seed and out again, 0 holds them still. Default 1. */
19
+ pulse?: number;
20
+ /** How far out the inner seeds push, a share of a cell. Default 0.6. */
21
+ spread?: number;
22
+ /** How far each macro seed rests off its square's centre, 0–1. Default 0.75. */
23
+ jitter?: number;
24
+ /** How wide the macro seeds orbit, 0–1. Default 1. */
25
+ orbit?: number;
26
+ /** The slow driver, 0–1: how much it speeds the clocks, thickens the lines and lifts the macro tier. Default 0.35. */
27
+ breathe?: number;
28
+ /** Plays every clock faster or slower; 0 for one still frame. Default 1. */
29
+ speed?: number;
30
+ /** Where the grid starts, in cells, so two cards differ. Default [0, 0]. */
31
+ offset?: [number, number];
32
+ /** An area kept quiet: centre (0–1 from the top left), radius (share of the height), depth (0–1). */
33
+ quiet?: { x?: number; y?: number; radius?: number; depth?: number } | null;
34
+ }
35
+
36
+ /** The settings as the seeds take them, each in cells. */
37
+ export interface SeedOptions {
38
+ /** The furthest a seed rests off its square's centre, along each axis. */
39
+ jitter: number;
40
+ /** The widest it orbits. */
41
+ orbit: number;
42
+ /** Inner seeds per cell. */
43
+ inner: number;
44
+ /** How far out the inner seeds push. */
45
+ spread: number;
46
+ /** How far they pulse, 0–1. */
47
+ pulse: number;
48
+ }
49
+
50
+ /** The settings' defaults, shared by the shader and the JavaScript twins. */
51
+ export declare const MESH_DEFAULTS: {
52
+ background: string;
53
+ cells: number;
54
+ inner: number;
55
+ width: number;
56
+ opacity: [number, number];
57
+ pulse: number;
58
+ spread: number;
59
+ jitter: number;
60
+ orbit: number;
61
+ breathe: number;
62
+ };
63
+
64
+ /** Dave Hoskins' Hash without Sine, three in and three out (the shader's `hash33`); each 0–1. */
65
+ export declare function hash33(x: number, y: number, z: number): [number, number, number];
66
+
67
+ /** The slow driver at a time (seconds, at the effect's speed): 0 to `breathe`. */
68
+ export declare function driveAt(t: number, breathe?: number): number;
69
+
70
+ /** The seeds' clock at a time: the integral of `1 + 2 · driveAt`, in closed form; 0 at 0. */
71
+ export declare function clockAt(t: number, breathe?: number): number;
72
+
73
+ /** The pulse's shape over one cycle (0–1): at rest through the dead zone, a squared sine out to 1 halfway and back. */
74
+ export declare function pulseWave(t: number): number;
75
+
76
+ /** The settings, with defaults, as the seeds take them (in cells). */
77
+ export declare function seedOptions(config?: VoronoiMeshConfig): SeedOptions;
78
+
79
+ /** The macro seed for the grid square at (cx, cy), at a clock (`clockAt`), in cells. */
80
+ export declare function macroSeed(cx: number, cy: number, clock: number, options?: SeedOptions): [number, number];
81
+
82
+ /** A macro cell's inner seeds at a clock, in cells. */
83
+ export declare function innerSeeds(cx: number, cy: number, clock: number, options?: SeedOptions): [number, number][];
84
+
85
+ /** The macro tier at a point (in cells), as the shader finds it: the nearest seed's square, the seed, and the distance to its cell's border. */
86
+ export declare function macroAt(x: number, y: number, clock: number, options?: SeedOptions): { cell: [number, number]; seed: [number, number]; edge: number };
87
+
88
+ /** One frame's macro and inner cells as polygons, in CSS px from the top left. */
89
+ export declare function meshPolygons(config: VoronoiMeshConfig, width: number, height: number, time?: number): { macro: [number, number][][]; inner: [number, number][][] };
90
+
91
+ /** The two line colours as the shader takes them: the macro lines' and the inner lines'. */
92
+ export declare function meshColors(config: VoronoiMeshConfig): [string, string];
93
+
94
+ /** One frame as an SVG's markup: the ground, both tiers' lines and the quiet area. */
95
+ export declare function meshSvg(config: VoronoiMeshConfig, width: number, height: number, time?: number): string;
96
+
97
+ /** One frame as a CSS `background` value (the SVG as a data URL over the ground), for the still shown before the shader starts and without WebGL. */
98
+ export declare function meshStill(config: VoronoiMeshConfig, width: number, height: number, time?: number): string;
99
+
100
+ /** Starts the mesh on an element (its first canvas is drawn into). Returns a function that stops it. */
101
+ export declare function voronoiMesh(el: HTMLElement, config: VoronoiMeshConfig): () => void;