Code Rain
v1.0.0FreeWebGLBackgroundInteractive
An interactive WebGL matrix digital rain canvas that reacts to mouse clicks and keypress typing bursts.
Code Rain
Installation
npx vectorvesper add code-rainRun npx vectorvesper init once first to set up your project.
Dependencies
npm install three @react-three/fiber- three
- @react-three/fiber
Usage
Import
Usage
Client-only component — disable SSR
This component uses WebGL and must be rendered client-side only.
Props
An interactive canvas matrix code rain shader built on WebGL. Pressing keys or clicking the screen injects energetic heat bursts into the character grid that ripple outward and fade over time. Features customized grid density, horizontal scanline overlays, and color mixes.
<CodeRainVisualizer />
WebGL canvas component displaying the matrix digital rain simulation.
| Prop | Type | Default | Description |
|---|---|---|---|
backgroundColor | string | "#000000" | Canvas background hex color. |
color1 | string | "#001a0a" | Primary color for cold/faded background glyph streams. |
color2 | string | "#00ff66" | Secondary color for active, high-intensity particle trails and keypress explosions. |
gridResolution | number | 80.0 | Visual density of character columns. Higher values result in smaller, denser characters. |
intensityDecay | number | 0.96 | Multiplier applied per frame to decay the visual excitement of key/mouse bursts. |
explosionRadius | number | 30.0 | Maximum radius (in grid cells) of the heat impact ripple on key/mouse clicks. |
glowIntensity | number | 0.4 | Additive glow intensity overlay applied to hot cells (0.0 to 1.0). |
scanlineIntensity | number | 0.0 | Opacity of the CRT horizontal scanline shader filter overlay. |
trailSpeed | number | 0.12 | Speed coefficient at which streams flow downwards. |
burstPattern | "digital" | "circular" | "digital" | Splat shape pattern on mouse click: digital (angular blocks) or circular (smooth radial falloff). |
className | string | "" | Class name applied to the outer canvas wrapping div. |
Examples
Uses raw WebGL context and CanvasRenderingContext2D. Strictly client-side — requires dynamic loading with
ssr: false to prevent build crashes.