matrix-rain-webgpu 1.0.0-beta.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.
@@ -0,0 +1,7 @@
1
+ import { type MatrixRainProps } from './types';
2
+ /**
3
+ * WebGPU Matrix-rain background effect. Renders a `<canvas>` that fills its
4
+ * positioned parent. Returns `null` (and reports via `onError`/`console.warn`)
5
+ * when WebGPU is unavailable or init fails — it never throws into the host tree.
6
+ */
7
+ export declare function MatrixRainWebGPU(props: MatrixRainProps): import("react").JSX.Element | null;
@@ -0,0 +1,95 @@
1
+ export interface RainOptions {
2
+ /**
3
+ * Glyph cell size in CSS pixels.
4
+ * @default 20
5
+ */
6
+ fontSize?: number;
7
+ /**
8
+ * Probability (0..1) that a column does NOT respawn each step — higher = sparser.
9
+ * @default 0.95
10
+ */
11
+ density?: number;
12
+ /**
13
+ * Logical simulation rate in Hz (rows advanced per second).
14
+ * @default 10
15
+ */
16
+ stepRate?: number;
17
+ /**
18
+ * [min, max] trail length in cells, rolled per column.
19
+ * @default [8, 35]
20
+ */
21
+ tailRange?: [number, number];
22
+ }
23
+ export interface ParallaxOptions {
24
+ /**
25
+ * [min, max] per-column fall speed; the spread is what creates the depth illusion.
26
+ * @default [0.4, 1.5]
27
+ */
28
+ speedRange?: [number, number];
29
+ /**
30
+ * How strongly far (slow) columns are dimmed, 0 (flat) .. 1 (deep).
31
+ * @default 0.3
32
+ */
33
+ depthDim?: number;
34
+ }
35
+ export interface BloomOptions {
36
+ /**
37
+ * Glow strength multiplier applied to the extracted bright pass.
38
+ * @default 1.5
39
+ */
40
+ intensity?: number;
41
+ /**
42
+ * Brightness above which a pixel contributes to the glow (~0..2).
43
+ * @default 0.8
44
+ */
45
+ threshold?: number;
46
+ /**
47
+ * How hot the heads burn into the HDR target (1 = none). Values >1 push heads
48
+ * above the displayable range, giving the bloom real headroom to extract from.
49
+ * @default 1.1
50
+ */
51
+ emission?: number;
52
+ }
53
+ export interface CrtOptions {
54
+ /**
55
+ * Scanline darkening depth, 0 (none) .. 1 (heavy).
56
+ * @default 0.3
57
+ */
58
+ scanlineStrength?: number;
59
+ /**
60
+ * Chromatic-aberration offset in pixels (R/B split along x).
61
+ * @default 1.0
62
+ */
63
+ aberration?: number;
64
+ }
65
+ export interface MatrixRainProps {
66
+ /** Core rain look & cadence: glyph size, density, step rate, trail length. */
67
+ rain?: RainOptions;
68
+ /** Depth illusion via per-column speed spread + far-dimming. `false` disables it. */
69
+ parallax?: ParallaxOptions | false;
70
+ /** Bloom glow pass. `false` disables it. */
71
+ bloom?: BloomOptions | false;
72
+ /** CRT post-process (scanlines + aberration). `false` disables it. */
73
+ crt?: CrtOptions | false;
74
+ /**
75
+ * Freeze on a settled static frame. The single off-state knob: the consumer
76
+ * composes reduced-motion / offscreen / user-toggle into this one boolean.
77
+ * @default false
78
+ */
79
+ paused?: boolean;
80
+ /** Forwarded to the underlying `<canvas>` (which is positioned to fill its parent). */
81
+ className?: string;
82
+ /**
83
+ * Called once if the renderer dies (init failure or a per-frame throw). The
84
+ * effect then stays dead — no auto-retry. If omitted, the error is
85
+ * `console.error`'d instead. Never throws into the host React tree.
86
+ */
87
+ onError?: (err: Error) => void;
88
+ }
89
+ export type Resolved<T> = Required<T> & {
90
+ enabled: boolean;
91
+ };
92
+ export type RainConfig = Required<RainOptions>;
93
+ export type BloomConfig = Resolved<BloomOptions>;
94
+ export type CrtConfig = Resolved<CrtOptions>;
95
+ export type ParallaxConfig = Required<ParallaxOptions>;
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "matrix-rain-webgpu",
3
+ "version": "1.0.0-beta.0",
4
+ "description": "WebGPU/TypeGPU Matrix-rain background effect for React.",
5
+ "keywords": [
6
+ "background-effect",
7
+ "matrix-rain",
8
+ "react",
9
+ "shader",
10
+ "typegpu",
11
+ "webgpu"
12
+ ],
13
+ "homepage": "https://chicio.github.io/matrix-rain-webgpu/",
14
+ "bugs": "https://github.com/chicio/matrix-rain-webgpu/issues",
15
+ "license": "MIT",
16
+ "author": "Fabrizio Duroni",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/chicio/matrix-rain-webgpu.git"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "type": "module",
25
+ "sideEffects": false,
26
+ "main": "./dist/index.js",
27
+ "module": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ }
34
+ },
35
+ "scripts": {
36
+ "check": "oxlint && oxfmt --check",
37
+ "fix": "oxlint --fix && oxfmt",
38
+ "types": "tsc -b",
39
+ "build": "vite build && tsc -p tsconfig.build.json",
40
+ "prepublishOnly": "npm run build",
41
+ "release": "release-it"
42
+ },
43
+ "devDependencies": {
44
+ "@release-it/conventional-changelog": "^11.0.1",
45
+ "@typegpu/noise": "^0.11.0",
46
+ "@typegpu/react": "^0.11.0",
47
+ "@types/node": "^24.12.3",
48
+ "@types/react": "^19.2.14",
49
+ "@types/react-dom": "^19.2.3",
50
+ "@vitejs/plugin-react": "^6.0.1",
51
+ "@webgpu/types": "^0.1.70",
52
+ "eslint-plugin-typegpu": "^0.11.1",
53
+ "oxfmt": "^0.49.0",
54
+ "oxlint": "^1.64.0",
55
+ "react": "^19.2.6",
56
+ "react-dom": "^19.2.6",
57
+ "release-it": "^20.2.0",
58
+ "typegpu": "^0.11.6",
59
+ "typescript": "npm:tsover@6.0.1",
60
+ "unplugin-typegpu": "^0.11.4",
61
+ "vite": "^8.0.12"
62
+ },
63
+ "peerDependencies": {
64
+ "@typegpu/noise": "^0.11.0",
65
+ "@typegpu/react": "^0.11.0",
66
+ "react": "^19.0.0",
67
+ "react-dom": "^19.0.0",
68
+ "typegpu": "^0.11.0"
69
+ },
70
+ "overrides": {
71
+ "typescript": "npm:tsover@6.0.1"
72
+ },
73
+ "pnpm": {
74
+ "overrides": {
75
+ "typescript": "npm:tsover@6.0.1"
76
+ }
77
+ }
78
+ }