own-the-canvas 1.0.4 → 1.0.5
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.
- package/README.md +185 -187
- package/dist/components/AntColony/AntColony.d.ts +42 -0
- package/dist/components/AntColony/index.d.ts +2 -0
- package/dist/components/AntColony/useAntColony.d.ts +22 -0
- package/dist/components/AuroraBorealis/AuroraBorealis.d.ts +27 -0
- package/dist/components/AuroraBorealis/index.d.ts +2 -0
- package/dist/components/AuroraBorealis/useAuroraBorealis.d.ts +14 -0
- package/dist/components/CrystalGrowth/CrystalGrowth.d.ts +37 -0
- package/dist/components/CrystalGrowth/index.d.ts +3 -0
- package/dist/components/CrystalGrowth/useCrystalGrowth.d.ts +20 -0
- package/dist/components/DiffusionAggregation/DiffusionAggregation.d.ts +42 -0
- package/dist/components/DiffusionAggregation/index.d.ts +3 -0
- package/dist/components/DiffusionAggregation/useDiffusionAggregation.d.ts +17 -0
- package/dist/components/FireEffect/FireEffect.d.ts +1 -1
- package/dist/components/GameOfLife/GameOfLife.d.ts +13 -0
- package/dist/components/GameOfLife/index.d.ts +1 -1
- package/dist/components/InkBleed/InkBleed.d.ts +36 -0
- package/dist/components/InkBleed/index.d.ts +2 -0
- package/dist/components/InkBleed/useInkBleed.d.ts +19 -0
- package/dist/components/Kaleidoscope/Kaleidoscope.d.ts +29 -0
- package/dist/components/Kaleidoscope/index.d.ts +2 -0
- package/dist/components/Kaleidoscope/useKaleidoscope.d.ts +15 -0
- package/dist/components/LSystem/LSystem.d.ts +33 -0
- package/dist/components/LSystem/index.d.ts +2 -0
- package/dist/components/LSystem/useLSystem.d.ts +17 -0
- package/dist/components/Lissajous/Lissajous.d.ts +40 -0
- package/dist/components/Lissajous/index.d.ts +3 -0
- package/dist/components/Lissajous/useLissajous.d.ts +21 -0
- package/dist/components/MagneticField/MagneticField.d.ts +38 -0
- package/dist/components/MagneticField/index.d.ts +2 -0
- package/dist/components/MagneticField/useMagneticField.d.ts +20 -0
- package/dist/components/MatrixRain/MatrixRain.d.ts +9 -0
- package/dist/components/MatrixRain/index.d.ts +1 -1
- package/dist/components/Metaballs/Metaballs.d.ts +32 -0
- package/dist/components/Metaballs/index.d.ts +2 -0
- package/dist/components/Metaballs/useMetaballs.d.ts +17 -0
- package/dist/components/NeuralWeb/NeuralWeb.d.ts +42 -0
- package/dist/components/NeuralWeb/index.d.ts +2 -0
- package/dist/components/NeuralWeb/useNeuralWeb.d.ts +22 -0
- package/dist/components/ParticleText/ParticleText.d.ts +38 -0
- package/dist/components/ParticleText/index.d.ts +2 -0
- package/dist/components/ParticleText/useParticleText.d.ts +20 -0
- package/dist/components/PendulaWave/PendulaWave.d.ts +41 -0
- package/dist/components/PendulaWave/index.d.ts +3 -0
- package/dist/components/PendulaWave/usePendulaWave.d.ts +22 -0
- package/dist/components/Rain/Rain.d.ts +3 -3
- package/dist/components/ReactionDiffusion/ReactionDiffusion.d.ts +29 -0
- package/dist/components/ReactionDiffusion/index.d.ts +2 -0
- package/dist/components/ReactionDiffusion/useReactionDiffusion.d.ts +15 -0
- package/dist/components/SandSimulation/SandSimulation.d.ts +30 -0
- package/dist/components/SandSimulation/index.d.ts +3 -0
- package/dist/components/SandSimulation/useSandSimulation.d.ts +16 -0
- package/dist/components/Shockwave/Shockwave.d.ts +1 -1
- package/dist/components/SlimeMold/SlimeMold.d.ts +37 -0
- package/dist/components/SlimeMold/index.d.ts +2 -0
- package/dist/components/SlimeMold/useSlimeMold.d.ts +19 -0
- package/dist/components/Spirograph/Spirograph.d.ts +42 -0
- package/dist/components/Spirograph/index.d.ts +3 -0
- package/dist/components/Spirograph/useSpirograph.d.ts +22 -0
- package/dist/components/Spotlight/Spotlight.d.ts +15 -1
- package/dist/components/Spotlight/index.d.ts +1 -1
- package/dist/components/TerrainMesh/TerrainMesh.d.ts +42 -0
- package/dist/components/TerrainMesh/index.d.ts +2 -0
- package/dist/components/TerrainMesh/useTerrainMesh.d.ts +22 -0
- package/dist/components/VoronoiCells/VoronoiCells.d.ts +32 -0
- package/dist/components/VoronoiCells/index.d.ts +3 -0
- package/dist/components/VoronoiCells/useVoronoiCells.d.ts +17 -0
- package/dist/components/WatercolorBloom/WatercolorBloom.d.ts +38 -0
- package/dist/components/WatercolorBloom/index.d.ts +2 -0
- package/dist/components/WatercolorBloom/useWatercolorBloom.d.ts +20 -0
- package/dist/components/WaveInterference/WaveInterference.d.ts +37 -0
- package/dist/components/WaveInterference/index.d.ts +2 -0
- package/dist/components/WaveInterference/useWaveInterference.d.ts +15 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +42 -2
- package/dist/index.es.js +7402 -2944
- package/dist/robots.txt +4 -0
- package/dist/sitemap.xml +168 -0
- package/package.json +1 -1
- package/dist/components/RippleEffect/RippleEffect.d.ts +0 -33
- package/dist/components/RippleEffect/RippleEffect.stories.d.ts +0 -7
- package/dist/components/RippleEffect/index.d.ts +0 -2
- package/dist/components/RippleEffect/useRippleEffect.d.ts +0 -17
package/README.md
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
<p align="left">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/jabid-19/own-the-canvas/main/.github/assets/logo.png" alt="own-the-canvas logo" width="
|
|
2
|
+
<img src="https://raw.githubusercontent.com/jabid-19/own-the-canvas/main/.github/assets/logo.png" alt="own-the-canvas logo" width="100" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
# own-the-canvas
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**52 canvas-based React visual components. Zero dependencies. TypeScript.**
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/own-the-canvas)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://www.typescriptlang.org)
|
|
12
|
+
[](https://www.npmjs.com/package/own-the-canvas)
|
|
13
|
+
[](https://react.dev)
|
|
8
14
|
|
|
9
15
|

|
|
10
16
|
|
|
17
|
+
---
|
|
18
|
+
|
|
11
19
|
## Install
|
|
12
20
|
|
|
13
21
|
```bash
|
|
14
22
|
npm install own-the-canvas
|
|
15
23
|
# or
|
|
16
24
|
pnpm add own-the-canvas
|
|
25
|
+
# or
|
|
26
|
+
yarn add own-the-canvas
|
|
17
27
|
```
|
|
18
28
|
|
|
19
29
|
> **Peer deps:** React 18+
|
|
@@ -22,300 +32,288 @@ pnpm add own-the-canvas
|
|
|
22
32
|
|
|
23
33
|
## Quick Start
|
|
24
34
|
|
|
35
|
+
Every component fills its parent container by default. Drop it in and it works.
|
|
36
|
+
|
|
25
37
|
```tsx
|
|
26
|
-
import {
|
|
38
|
+
import { DragonCursor, MatrixRain, ParticleText } from "own-the-canvas";
|
|
27
39
|
|
|
28
40
|
export default function App() {
|
|
29
41
|
return (
|
|
30
42
|
<div style={{ width: "100vw", height: "100vh" }}>
|
|
31
|
-
<MatrixRain
|
|
43
|
+
<MatrixRain preset="cyberpunk" />
|
|
32
44
|
</div>
|
|
33
45
|
);
|
|
34
46
|
}
|
|
35
47
|
```
|
|
36
48
|
|
|
37
|
-
All components
|
|
49
|
+
All components accept a `preset` prop for instant themed defaults — override any individual prop on top.
|
|
38
50
|
|
|
39
51
|
---
|
|
40
52
|
|
|
41
|
-
## Components
|
|
53
|
+
## Featured Components
|
|
42
54
|
|
|
43
|
-
###
|
|
55
|
+
### DragonCursor
|
|
44
56
|
|
|
45
|
-
|
|
57
|
+
A sinuous dragon body that trails your cursor in real time. Segments, wings, optional fire breath — all configurable.
|
|
58
|
+
|
|
59
|
+
**Presets:** `default · emerald · inferno · void · ice`
|
|
46
60
|
|
|
47
61
|
```tsx
|
|
48
|
-
import {
|
|
62
|
+
import { DragonCursor } from "own-the-canvas";
|
|
49
63
|
|
|
50
|
-
<
|
|
51
|
-
color="#00ff41"
|
|
52
|
-
fontSize={16}
|
|
53
|
-
speed={1}
|
|
54
|
-
charset="katakana"
|
|
55
|
-
glowEffect
|
|
56
|
-
/>;
|
|
64
|
+
<DragonCursor preset="inferno" segmentCount={24} showFire wingSpan={70} />
|
|
57
65
|
```
|
|
58
66
|
|
|
59
|
-
| Prop
|
|
60
|
-
|
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `density` | `number` | `0.85` | Column density 0–1 |
|
|
67
|
-
| `fadeStrength` | `number` | `0.05` | Trail fade 0–1 |
|
|
68
|
-
| `glowEffect` | `boolean` | `true` | Neon glow |
|
|
67
|
+
| Prop | Type | Default | Description |
|
|
68
|
+
| --- | --- | --- | --- |
|
|
69
|
+
| `segmentCount` | `number` | `20` | Body segment count |
|
|
70
|
+
| `bodyColor` | `string` | `"#ffffff"` | Dragon body color |
|
|
71
|
+
| `wingSpan` | `number` | `60` | Wing span in px |
|
|
72
|
+
| `showFire` | `boolean` | `false` | Enable fire breath |
|
|
73
|
+
| `followSpeed` | `number` | `0.15` | Cursor follow lerp speed |
|
|
69
74
|
|
|
70
75
|
---
|
|
71
76
|
|
|
72
|
-
###
|
|
77
|
+
### MatrixRain
|
|
78
|
+
|
|
79
|
+
Falling character rain — katakana, latin, or binary. Per-column trail fade, variable speed, neon green or any color.
|
|
73
80
|
|
|
74
|
-
|
|
81
|
+
**Presets:** `default · cyberpunk · binary · minimal · blood`
|
|
75
82
|
|
|
76
83
|
```tsx
|
|
77
|
-
import {
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
particleCount={120}
|
|
81
|
-
particleColor="#7eb8f7"
|
|
82
|
-
connectParticles
|
|
83
|
-
interactive
|
|
84
|
-
/>;
|
|
84
|
+
import { MatrixRain } from "own-the-canvas";
|
|
85
|
+
|
|
86
|
+
<MatrixRain color="#00ff41" charset="katakana" fontSize={16} speed={20} />
|
|
85
87
|
```
|
|
86
88
|
|
|
87
|
-
| Prop
|
|
88
|
-
|
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `speed` | `number` | `0.8` | Movement speed |
|
|
95
|
-
| `connectParticles` | `boolean` | `true` | Draw lines between close particles |
|
|
96
|
-
| `interactive` | `boolean` | `true` | Repel on mouse move |
|
|
97
|
-
| `backgroundColor` | `string` | `"transparent"` | Background color |
|
|
89
|
+
| Prop | Type | Default | Description |
|
|
90
|
+
| --- | --- | --- | --- |
|
|
91
|
+
| `color` | `string` | `"#ffffff"` | Character color |
|
|
92
|
+
| `charset` | `"latin" \| "binary" \| "katakana" \| string` | `"latin"` | Character set |
|
|
93
|
+
| `fontSize` | `number` | `14` | Font size in px |
|
|
94
|
+
| `speed` | `number` | `33` | Ms per frame — lower = faster |
|
|
95
|
+
| `backgroundColor` | `string` | `"rgba(17,17,17,0.1)"` | Per-frame overlay — controls trail length |
|
|
98
96
|
|
|
99
97
|
---
|
|
100
98
|
|
|
101
|
-
###
|
|
99
|
+
### KoiPond
|
|
102
100
|
|
|
103
|
-
|
|
101
|
+
Living koi pond on canvas — fish navigate with organic steering, ripple on hover, lily pads float, caustic light dances.
|
|
102
|
+
|
|
103
|
+
**Presets:** `default · koi · night · lotus · neon`
|
|
104
104
|
|
|
105
105
|
```tsx
|
|
106
|
-
import {
|
|
106
|
+
import { KoiPond } from "own-the-canvas";
|
|
107
107
|
|
|
108
|
-
<
|
|
108
|
+
<KoiPond preset="koi" fishCount={8} interactive showLilies caustics />
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
| Prop
|
|
112
|
-
|
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `shootingStars` | `boolean` | `true` | Shooting stars |
|
|
119
|
-
| `shootingStarInterval` | `number` | `3000` | Ms between shooting stars |
|
|
120
|
-
| `perspective` | `"2D" \| "3D"` | `"2D"` | Flat or warp tunnel |
|
|
111
|
+
| Prop | Type | Default | Description |
|
|
112
|
+
| --- | --- | --- | --- |
|
|
113
|
+
| `fishCount` | `number` | `6` | Number of koi fish |
|
|
114
|
+
| `fishColor` | `string` | `"#ffffff"` | Fish body color |
|
|
115
|
+
| `showLilies` | `boolean` | `true` | Render floating lily pads |
|
|
116
|
+
| `caustics` | `boolean` | `true` | Caustic light shimmer |
|
|
117
|
+
| `interactive` | `boolean` | `true` | React to mouse movement |
|
|
121
118
|
|
|
122
119
|
---
|
|
123
120
|
|
|
124
|
-
###
|
|
121
|
+
### FluidSimulation
|
|
125
122
|
|
|
126
|
-
|
|
123
|
+
Real-time Navier-Stokes fluid solver. Move your mouse to inject velocity and ink — auto-bursts fire at intervals for continuous motion.
|
|
124
|
+
|
|
125
|
+
**Presets:** `default · ink · neon · lava · ocean · smoke`
|
|
127
126
|
|
|
128
127
|
```tsx
|
|
129
|
-
import {
|
|
128
|
+
import { FluidSimulation } from "own-the-canvas";
|
|
130
129
|
|
|
131
|
-
<
|
|
130
|
+
<FluidSimulation
|
|
131
|
+
preset="neon"
|
|
132
|
+
inkColors={["#ff00ff", "#00ffff", "#7700ff"]}
|
|
133
|
+
resolution={80}
|
|
134
|
+
/>
|
|
132
135
|
```
|
|
133
136
|
|
|
134
|
-
| Prop
|
|
135
|
-
|
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `cooling` | `number` | `0.3` | Cooling rate 0–1 |
|
|
137
|
+
| Prop | Type | Default | Description |
|
|
138
|
+
| --- | --- | --- | --- |
|
|
139
|
+
| `resolution` | `number` | `128` | Grid resolution 32–128 |
|
|
140
|
+
| `inkColors` | `string[]` | monochrome | Ink colors |
|
|
141
|
+
| `viscosity` | `number` | `0.0001` | Fluid viscosity |
|
|
142
|
+
| `autoInk` | `boolean` | `true` | Auto-inject ink bursts |
|
|
143
|
+
| `mouseForce` | `number` | `5` | Mouse velocity force multiplier |
|
|
142
144
|
|
|
143
145
|
---
|
|
144
146
|
|
|
145
|
-
###
|
|
147
|
+
### FlowField
|
|
146
148
|
|
|
147
|
-
|
|
149
|
+
Perlin noise vector field guiding 800 particle streams. Enable `curl` for swirling, organic motion. Builds layered ink-like compositions over time.
|
|
148
150
|
|
|
149
|
-
|
|
150
|
-
import { AudioVisualizer } from "own-the-canvas";
|
|
151
|
-
|
|
152
|
-
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
151
|
+
**Presets:** `default · neon · ocean · lava · forest · monochrome`
|
|
153
152
|
|
|
154
|
-
|
|
153
|
+
```tsx
|
|
154
|
+
import { FlowField } from "own-the-canvas";
|
|
155
|
+
|
|
156
|
+
<FlowField
|
|
157
|
+
preset="ocean"
|
|
158
|
+
particleCount={1200}
|
|
159
|
+
curl
|
|
160
|
+
noiseScale={0.003}
|
|
161
|
+
/>
|
|
155
162
|
```
|
|
156
163
|
|
|
157
|
-
| Prop
|
|
158
|
-
|
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
| `
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
| `sensitivity` | `number` | `1` | Amplitude multiplier |
|
|
165
|
-
| `gapBetweenBars` | `number` | `2` | Gap between bars (px) |
|
|
166
|
-
| `rounded` | `boolean` | `true` | Rounded bar caps |
|
|
167
|
-
| `gradient` | `boolean` | `true` | Color gradient on bars |
|
|
164
|
+
| Prop | Type | Default | Description |
|
|
165
|
+
| --- | --- | --- | --- |
|
|
166
|
+
| `particleCount` | `number` | `800` | Number of flow particles |
|
|
167
|
+
| `colors` | `string[]` | monochrome | Particle stroke colors |
|
|
168
|
+
| `noiseScale` | `number` | `0.004` | Noise scale — lower = larger structures |
|
|
169
|
+
| `curl` | `boolean` | `false` | Add curl noise for swirling flow |
|
|
170
|
+
| `speed` | `number` | `1` | Flow speed multiplier |
|
|
168
171
|
|
|
169
172
|
---
|
|
170
173
|
|
|
171
|
-
###
|
|
174
|
+
### GlitchOverlay
|
|
175
|
+
|
|
176
|
+
Digital glitch effect with RGB channel separation, CRT scanlines, block-slice artifacts, and film noise. Designed as an absolute-positioned overlay — zero configuration required.
|
|
172
177
|
|
|
173
|
-
|
|
178
|
+
**Presets:** `default · crt · cyberpunk · subtle · corrupt`
|
|
174
179
|
|
|
175
180
|
```tsx
|
|
176
|
-
import {
|
|
177
|
-
const [fire, setFire] = useState(false);
|
|
181
|
+
import { GlitchOverlay } from "own-the-canvas";
|
|
178
182
|
|
|
179
|
-
<
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
</
|
|
183
|
+
<div style={{ position: "relative" }}>
|
|
184
|
+
<YourContent />
|
|
185
|
+
<GlitchOverlay preset="cyberpunk" intensity={0.8} rgbShift={12} />
|
|
186
|
+
</div>
|
|
183
187
|
```
|
|
184
188
|
|
|
185
|
-
| Prop
|
|
186
|
-
|
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `
|
|
191
|
-
| `
|
|
192
|
-
| `shapes` | `ConfettiShape[]` | all shapes | Shapes to include |
|
|
193
|
-
| `duration` | `number` | `4000` | Piece lifetime (ms) |
|
|
194
|
-
| `continuous` | `boolean` | `false` | Trickle while trigger is true |
|
|
195
|
-
| `wind` | `number` | `0.5` | Horizontal wind |
|
|
189
|
+
| Prop | Type | Default | Description |
|
|
190
|
+
| --- | --- | --- | --- |
|
|
191
|
+
| `intensity` | `number` | `0.6` | Glitch probability 0–1 |
|
|
192
|
+
| `rgbShift` | `number` | `8` | RGB color shift in px |
|
|
193
|
+
| `scanlines` | `boolean` | `true` | CRT scanline overlay |
|
|
194
|
+
| `blockGlitch` | `boolean` | `true` | Block-slice glitch artifacts |
|
|
195
|
+
| `flickerRate` | `number` | `0.02` | Screen flicker rate 0–1 |
|
|
196
196
|
|
|
197
197
|
---
|
|
198
198
|
|
|
199
|
-
###
|
|
199
|
+
### BubbleUniverse
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
Physics-based soap bubbles that float, collide, merge on contact, and pop on click. Iridescent shimmer and glow included.
|
|
202
|
+
|
|
203
|
+
**Presets:** `default · soap · neon · deep · minimal`
|
|
202
204
|
|
|
203
205
|
```tsx
|
|
204
|
-
import {
|
|
206
|
+
import { BubbleUniverse } from "own-the-canvas";
|
|
205
207
|
|
|
206
|
-
<
|
|
208
|
+
<BubbleUniverse preset="soap" bubbleCount={20} mergeOnCollide glowEffect />
|
|
207
209
|
```
|
|
208
210
|
|
|
209
|
-
| Prop
|
|
210
|
-
|
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
215
|
-
| `
|
|
216
|
-
| `multiRipple` | `boolean` | `true` | Allow multiple simultaneous ripples |
|
|
217
|
-
| `backgroundColor` | `string` | `"transparent"` | Canvas background |
|
|
218
|
-
| `interactive` | `boolean` | `true` | Spawn ripple on click |
|
|
211
|
+
| Prop | Type | Default | Description |
|
|
212
|
+
| --- | --- | --- | --- |
|
|
213
|
+
| `bubbleCount` | `number` | `15` | Number of bubbles |
|
|
214
|
+
| `mergeOnCollide` | `boolean` | `true` | Bubbles merge on collision |
|
|
215
|
+
| `popEffect` | `boolean` | `true` | Pop animation on click |
|
|
216
|
+
| `glowEffect` | `boolean` | `true` | Glow on bubbles |
|
|
217
|
+
| `gravity` | `number` | `0.02` | Gravity strength |
|
|
219
218
|
|
|
220
219
|
---
|
|
221
220
|
|
|
222
|
-
###
|
|
221
|
+
### Rain
|
|
222
|
+
|
|
223
|
+
Falling rain streaks with sinusoidal wind drift and splash particles on ground impact. Great as a layered overlay.
|
|
223
224
|
|
|
224
|
-
|
|
225
|
+
**Presets:** `default · storm · drizzle · neon · golden`
|
|
225
226
|
|
|
226
227
|
```tsx
|
|
227
|
-
import {
|
|
228
|
-
|
|
229
|
-
<
|
|
230
|
-
colors={["#0d0221", "#2d1b69", "#11998e", "#38ef7d"]}
|
|
231
|
-
speed={0.3}
|
|
232
|
-
octaves={3}
|
|
233
|
-
animated
|
|
234
|
-
/>;
|
|
228
|
+
import { Rain } from "own-the-canvas";
|
|
229
|
+
|
|
230
|
+
<Rain preset="storm" dropCount={400} wind={0.6} showSplashes />
|
|
235
231
|
```
|
|
236
232
|
|
|
237
|
-
| Prop
|
|
238
|
-
|
|
|
239
|
-
| `
|
|
240
|
-
| `speed`
|
|
241
|
-
| `
|
|
242
|
-
| `
|
|
243
|
-
| `
|
|
244
|
-
| `blendMode` | `string` | `"source-over"` | Canvas composite mode |
|
|
233
|
+
| Prop | Type | Default | Description |
|
|
234
|
+
| --- | --- | --- | --- |
|
|
235
|
+
| `dropCount` | `number` | `200` | Number of rain drops |
|
|
236
|
+
| `speed` | `number` | `15` | Drop fall speed px/frame |
|
|
237
|
+
| `wind` | `number` | `0.3` | Horizontal wind drift |
|
|
238
|
+
| `dropColor` | `string` | `"#000000"` | Drop stroke color |
|
|
239
|
+
| `showSplashes` | `boolean` | `true` | Splash particles on impact |
|
|
245
240
|
|
|
246
241
|
---
|
|
247
242
|
|
|
248
|
-
###
|
|
243
|
+
### FireEffect
|
|
249
244
|
|
|
250
|
-
|
|
245
|
+
Pixel-level cellular automaton fire. Heat seeds at the bottom row, rises with cooling and wind drift, maps to a palette. Five color themes.
|
|
246
|
+
|
|
247
|
+
**Presets:** `default · inferno · toxic · ice · plasma`
|
|
251
248
|
|
|
252
249
|
```tsx
|
|
253
|
-
import {
|
|
250
|
+
import { FireEffect } from "own-the-canvas";
|
|
254
251
|
|
|
255
|
-
<
|
|
256
|
-
<YourComponent />
|
|
257
|
-
</PixelDissolve>;
|
|
252
|
+
<FireEffect palette="inferno" intensity={0.95} windStrength={0.4} />
|
|
258
253
|
```
|
|
259
254
|
|
|
260
|
-
| Prop
|
|
261
|
-
|
|
|
262
|
-
| `
|
|
263
|
-
| `
|
|
264
|
-
| `
|
|
265
|
-
| `
|
|
266
|
-
| `
|
|
267
|
-
| `color` | `string` | `"#0a0a0a"` | Pixel fill color |
|
|
268
|
-
| `onComplete` | `() => void` | — | Called when animation finishes |
|
|
255
|
+
| Prop | Type | Default | Description |
|
|
256
|
+
| --- | --- | --- | --- |
|
|
257
|
+
| `palette` | `"smoke" \| "inferno" \| "toxic" \| "ice" \| "plasma"` | `"smoke"` | Color theme |
|
|
258
|
+
| `intensity` | `number` | `0.95` | Flame intensity 0–1 |
|
|
259
|
+
| `windStrength` | `number` | `0.3` | Horizontal wind -1 to 1 |
|
|
260
|
+
| `cooling` | `number` | `0.3` | Cooling rate — higher = shorter flames |
|
|
261
|
+
| `spread` | `number` | `0.7` | Flame spread 0–1 |
|
|
269
262
|
|
|
270
263
|
---
|
|
271
264
|
|
|
272
|
-
###
|
|
265
|
+
### ParticleText
|
|
273
266
|
|
|
274
|
-
|
|
267
|
+
Text rendered from thousands of particles — each springs to its position in the letterform. Mouse cursor repels them; they reform when it leaves.
|
|
275
268
|
|
|
276
|
-
|
|
277
|
-
import { ConstellationMap } from "own-the-canvas";
|
|
269
|
+
**Presets:** `default · neon · fire · frost · gold · minimal`
|
|
278
270
|
|
|
279
|
-
|
|
271
|
+
```tsx
|
|
272
|
+
import { ParticleText } from "own-the-canvas";
|
|
273
|
+
|
|
274
|
+
<ParticleText
|
|
275
|
+
text="HELLO"
|
|
276
|
+
preset="neon"
|
|
277
|
+
fontSize={140}
|
|
278
|
+
repelRadius={100}
|
|
279
|
+
repelForce={8}
|
|
280
|
+
/>
|
|
280
281
|
```
|
|
281
282
|
|
|
282
|
-
| Prop
|
|
283
|
-
|
|
|
284
|
-
| `
|
|
285
|
-
| `
|
|
286
|
-
| `
|
|
287
|
-
| `
|
|
288
|
-
| `
|
|
289
|
-
| `
|
|
290
|
-
| `lineStyle` | `"solid" \| "dashed"` | `"solid"` | Line style |
|
|
291
|
-
| `glowStars` | `boolean` | `true` | Glow on stars |
|
|
292
|
-
| `connectionDistance` | `number` | `100` | Max distance for lines |
|
|
283
|
+
| Prop | Type | Default | Description |
|
|
284
|
+
| --- | --- | --- | --- |
|
|
285
|
+
| `text` | `string` | `"hello"` | Text to render as particles |
|
|
286
|
+
| `fontSize` | `number` | `120` | Font size in px |
|
|
287
|
+
| `color` | `string` | `"#ffffff"` | Particle color |
|
|
288
|
+
| `repelRadius` | `number` | `80` | Mouse repulsion radius in px |
|
|
289
|
+
| `repelForce` | `number` | `5` | Mouse repulsion force |
|
|
290
|
+
| `snapSpeed` | `number` | `0.12` | Spring constant for snap-to-target |
|
|
293
291
|
|
|
294
292
|
---
|
|
295
293
|
|
|
296
|
-
## Base Props
|
|
294
|
+
## Base Props
|
|
297
295
|
|
|
298
|
-
Every component accepts these:
|
|
296
|
+
Every component accepts these props:
|
|
299
297
|
|
|
300
|
-
| Prop
|
|
301
|
-
|
|
|
302
|
-
| `width`
|
|
303
|
-
| `height`
|
|
304
|
-
| `className` | `string`
|
|
305
|
-
| `style`
|
|
298
|
+
| Prop | Type | Default | Description |
|
|
299
|
+
| --- | --- | --- | --- |
|
|
300
|
+
| `width` | `number \| string` | `"100%"` | Container width |
|
|
301
|
+
| `height` | `number \| string` | `"100%"` | Container height |
|
|
302
|
+
| `className` | `string` | — | CSS class on wrapper `<div>` |
|
|
303
|
+
| `style` | `React.CSSProperties` | — | Inline styles on wrapper `<div>` |
|
|
304
|
+
| `preset` | `string` | `"default"` | Named preset — sets themed defaults |
|
|
306
305
|
|
|
307
306
|
All components use `forwardRef` — the ref is forwarded to the underlying `<canvas>` element.
|
|
308
307
|
|
|
309
308
|
---
|
|
310
309
|
|
|
311
|
-
##
|
|
310
|
+
## 42 More Components
|
|
312
311
|
|
|
313
|
-
|
|
312
|
+
> Starfield · Fireworks · Boids · SlimeMold · GameOfLife · Kaleidoscope · ReactionDiffusion · AuroraBorealis · Spirograph · Lightning · ClothSimulation · VoronoiCells · NeuralWeb · Metaballs · AntColony · Wormhole · Mandala · MagneticBlob · WatercolorBloom · InkBleed · CrystalGrowth · SandSimulation · WaveInterference · LSystem · Lissajous · PendulaWave · DiffusionAggregation · TerrainMesh · MagneticField · Spotlight · Shockwave · Confetti · RippleEffect · NoiseGradient · PixelDissolve · AudioVisualizer · ParticleField · LiveChart · GalaxySpiral · SolarFlare · TornadoVortex · SakuraBlossom
|
|
314
313
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
```
|
|
314
|
+
Full docs, live previews, and interactive playground:
|
|
315
|
+
|
|
316
|
+
**[own-the-canvas.vercel.app](https://own-the-canvas.vercel.app)**
|
|
319
317
|
|
|
320
318
|
---
|
|
321
319
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type AntColonyPreset = "default" | "neon" | "desert" | "jungle" | "minimal" | "swarm";
|
|
4
|
+
export interface AntColonyProps extends BaseCanvasProps {
|
|
5
|
+
/** Number of ants (default: 150) */
|
|
6
|
+
antCount?: number;
|
|
7
|
+
/** Pheromone decay per frame (default: 0.003) */
|
|
8
|
+
evaporationRate?: number;
|
|
9
|
+
/** Pheromone spread to neighbors (default: 0.1) */
|
|
10
|
+
diffusionRate?: number;
|
|
11
|
+
/** Pheromone deposited per step (default: 5) */
|
|
12
|
+
pheromoneStrength?: number;
|
|
13
|
+
/** Pixels per frame per ant (default: 1.5) */
|
|
14
|
+
antSpeed?: number;
|
|
15
|
+
/** Ant sensor angle offset in radians (default: 0.4) */
|
|
16
|
+
sensorAngle?: number;
|
|
17
|
+
/** Pheromone sensor lookahead in px (default: 6) */
|
|
18
|
+
sensorDistance?: number;
|
|
19
|
+
/** Max turn per frame in radians (default: 0.3) */
|
|
20
|
+
turnSpeed?: number;
|
|
21
|
+
/** Ant dot color (default: "#ffffff") */
|
|
22
|
+
antColor?: string;
|
|
23
|
+
/** Pheromone trail color (default: "#6b7280") */
|
|
24
|
+
pheromoneColor?: string;
|
|
25
|
+
/** Food source color (default: "#4ade80") */
|
|
26
|
+
foodColor?: string;
|
|
27
|
+
/** Nest color (default: "#f59e0b") */
|
|
28
|
+
nestColor?: string;
|
|
29
|
+
/** Canvas background (default: "#111111") */
|
|
30
|
+
backgroundColor?: string;
|
|
31
|
+
/** Pheromone grid resolution (default: 0.5) */
|
|
32
|
+
resolution?: number;
|
|
33
|
+
/** Enable animation (default: true) */
|
|
34
|
+
animated?: boolean;
|
|
35
|
+
/** Click to place food (default: true) */
|
|
36
|
+
interactive?: boolean;
|
|
37
|
+
/** Max simultaneous food sources (default: 5) */
|
|
38
|
+
maxFood?: number;
|
|
39
|
+
preset?: AntColonyPreset | string;
|
|
40
|
+
}
|
|
41
|
+
export declare const AntColony: import('react').ForwardRefExoticComponent<AntColonyProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface UseAntColonyOptions {
|
|
4
|
+
antCount: number;
|
|
5
|
+
evaporationRate: number;
|
|
6
|
+
diffusionRate: number;
|
|
7
|
+
pheromoneStrength: number;
|
|
8
|
+
antSpeed: number;
|
|
9
|
+
sensorAngle: number;
|
|
10
|
+
sensorDistance: number;
|
|
11
|
+
turnSpeed: number;
|
|
12
|
+
antColor: string;
|
|
13
|
+
pheromoneColor: string;
|
|
14
|
+
foodColor: string;
|
|
15
|
+
nestColor: string;
|
|
16
|
+
backgroundColor: string;
|
|
17
|
+
resolution: number;
|
|
18
|
+
animated: boolean;
|
|
19
|
+
interactive: boolean;
|
|
20
|
+
maxFood: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function useAntColony(canvasRef: RefObject<HTMLCanvasElement | null>, options: UseAntColonyOptions): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type AuroraBorealisPreset = "default" | "arctic" | "solar" | "tropical" | "neon" | "midnight";
|
|
4
|
+
export interface AuroraBorealisProps extends BaseCanvasProps {
|
|
5
|
+
/** Aurora band colors (default: monochrome whites/grays) */
|
|
6
|
+
colors?: string[];
|
|
7
|
+
/** Animation speed multiplier (default: 1) */
|
|
8
|
+
speed?: number;
|
|
9
|
+
/** Band brightness/opacity 0–1 (default: 0.8) */
|
|
10
|
+
intensity?: number;
|
|
11
|
+
/** Number of aurora layers (default: 5) */
|
|
12
|
+
layers?: number;
|
|
13
|
+
/** Sky background color (default: "#111111") */
|
|
14
|
+
backgroundColor?: string;
|
|
15
|
+
/** Wave height as fraction of canvas height (default: 0.15) */
|
|
16
|
+
waveAmplitude?: number;
|
|
17
|
+
/** Wave oscillations across canvas width (default: 2) */
|
|
18
|
+
waveFrequency?: number;
|
|
19
|
+
/** Background star count (default: 80) */
|
|
20
|
+
starCount?: number;
|
|
21
|
+
/** Enable animation (default: true) */
|
|
22
|
+
animated?: boolean;
|
|
23
|
+
/** Named preset */
|
|
24
|
+
preset?: AuroraBorealisPreset | string;
|
|
25
|
+
}
|
|
26
|
+
export declare const AuroraBorealis: import('react').ForwardRefExoticComponent<AuroraBorealisProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface UseAuroraBorealisOptions {
|
|
4
|
+
colors: string[];
|
|
5
|
+
speed: number;
|
|
6
|
+
intensity: number;
|
|
7
|
+
layers: number;
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
waveAmplitude: number;
|
|
10
|
+
waveFrequency: number;
|
|
11
|
+
starCount: number;
|
|
12
|
+
animated: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function useAuroraBorealis(canvasRef: RefObject<HTMLCanvasElement | null>, options: UseAuroraBorealisOptions): void;
|