own-the-canvas 1.0.1 → 1.0.3
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 +130 -155
- 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/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/Spirograph/Spirograph.d.ts +29 -0
- package/dist/components/Spirograph/index.d.ts +2 -0
- package/dist/components/Spirograph/useSpirograph.d.ts +15 -0
- package/dist/components/Spotlight/Spotlight.d.ts +1 -1
- package/dist/components/WaveInterference/WaveInterference.d.ts +29 -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 +10 -0
- package/dist/index.es.js +3682 -2875
- package/dist/robots.txt +4 -0
- package/dist/sitemap.xml +168 -0
- package/package.json +15 -3
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<p align="
|
|
1
|
+
<p align="left">
|
|
2
2
|
<img src="https://raw.githubusercontent.com/jabid-19/own-the-canvas/main/.github/assets/logo.png" alt="own-the-canvas logo" width="120" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
# own-the-canvas
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Beautiful, responsive, fully customizable HTML canvas–based React visual components. Zero dependencies. TypeScript.
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
@@ -23,11 +23,11 @@ pnpm add own-the-canvas
|
|
|
23
23
|
## Quick Start
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
|
-
import { MatrixRain, ParticleField, Starfield } from
|
|
26
|
+
import { MatrixRain, ParticleField, Starfield } from "own-the-canvas";
|
|
27
27
|
|
|
28
28
|
export default function App() {
|
|
29
29
|
return (
|
|
30
|
-
<div style={{ width:
|
|
30
|
+
<div style={{ width: "100vw", height: "100vh" }}>
|
|
31
31
|
<MatrixRain color="#00ff41" glowEffect />
|
|
32
32
|
</div>
|
|
33
33
|
);
|
|
@@ -44,9 +44,8 @@ All components default to `width: "100%"` and `height: "100%"` so they fill thei
|
|
|
44
44
|
|
|
45
45
|
Classic falling character rain effect.
|
|
46
46
|
|
|
47
|
-
|
|
48
47
|
```tsx
|
|
49
|
-
import { MatrixRain } from
|
|
48
|
+
import { MatrixRain } from "own-the-canvas";
|
|
50
49
|
|
|
51
50
|
<MatrixRain
|
|
52
51
|
color="#00ff41"
|
|
@@ -54,19 +53,19 @@ import { MatrixRain } from 'own-the-canvas';
|
|
|
54
53
|
speed={1}
|
|
55
54
|
charset="katakana"
|
|
56
55
|
glowEffect
|
|
57
|
-
|
|
56
|
+
/>;
|
|
58
57
|
```
|
|
59
58
|
|
|
60
|
-
| Prop
|
|
61
|
-
|
|
62
|
-
| `color`
|
|
63
|
-
| `backgroundColor` | `string`
|
|
64
|
-
| `fontSize`
|
|
65
|
-
| `speed`
|
|
66
|
-
| `charset`
|
|
67
|
-
| `density`
|
|
68
|
-
| `fadeStrength`
|
|
69
|
-
| `glowEffect`
|
|
59
|
+
| Prop | Type | Default | Description |
|
|
60
|
+
| ----------------- | --------------------------------------------- | -------------------- | -------------------------------------- |
|
|
61
|
+
| `color` | `string` | `"#00ff41"` | Character color |
|
|
62
|
+
| `backgroundColor` | `string` | `"rgba(0,0,0,0.05)"` | Canvas background (use rgba for trail) |
|
|
63
|
+
| `fontSize` | `number` | `16` | Character font size in px |
|
|
64
|
+
| `speed` | `number` | `1` | Fall speed multiplier |
|
|
65
|
+
| `charset` | `"katakana" \| "latin" \| "binary" \| string` | `"katakana"` | Character set |
|
|
66
|
+
| `density` | `number` | `0.85` | Column density 0–1 |
|
|
67
|
+
| `fadeStrength` | `number` | `0.05` | Trail fade 0–1 |
|
|
68
|
+
| `glowEffect` | `boolean` | `true` | Neon glow |
|
|
70
69
|
|
|
71
70
|
---
|
|
72
71
|
|
|
@@ -74,29 +73,28 @@ import { MatrixRain } from 'own-the-canvas';
|
|
|
74
73
|
|
|
75
74
|
Floating particles with optional connections and mouse repulsion.
|
|
76
75
|
|
|
77
|
-
|
|
78
76
|
```tsx
|
|
79
|
-
import { ParticleField } from
|
|
77
|
+
import { ParticleField } from "own-the-canvas";
|
|
80
78
|
|
|
81
79
|
<ParticleField
|
|
82
80
|
particleCount={120}
|
|
83
81
|
particleColor="#7eb8f7"
|
|
84
82
|
connectParticles
|
|
85
83
|
interactive
|
|
86
|
-
|
|
84
|
+
/>;
|
|
87
85
|
```
|
|
88
86
|
|
|
89
|
-
| Prop
|
|
90
|
-
|
|
91
|
-
| `particleCount`
|
|
92
|
-
| `particleColor`
|
|
93
|
-
| `lineColor`
|
|
94
|
-
| `lineDistance`
|
|
95
|
-
| `particleSize`
|
|
96
|
-
| `speed`
|
|
97
|
-
| `connectParticles` | `boolean` | `true`
|
|
98
|
-
| `interactive`
|
|
99
|
-
| `backgroundColor`
|
|
87
|
+
| Prop | Type | Default | Description |
|
|
88
|
+
| ------------------ | --------- | --------------- | ---------------------------------- |
|
|
89
|
+
| `particleCount` | `number` | `120` | Number of particles |
|
|
90
|
+
| `particleColor` | `string` | `"#7eb8f7"` | Particle fill color |
|
|
91
|
+
| `lineColor` | `string` | `"#7eb8f7"` | Connection line color |
|
|
92
|
+
| `lineDistance` | `number` | `120` | Max distance for lines |
|
|
93
|
+
| `particleSize` | `number` | `2.5` | Max particle radius |
|
|
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 |
|
|
100
98
|
|
|
101
99
|
---
|
|
102
100
|
|
|
@@ -104,28 +102,22 @@ import { ParticleField } from 'own-the-canvas';
|
|
|
104
102
|
|
|
105
103
|
2D twinkle or 3D warp tunnel starfield.
|
|
106
104
|
|
|
107
|
-
|
|
108
105
|
```tsx
|
|
109
|
-
import { Starfield } from
|
|
110
|
-
|
|
111
|
-
<Starfield
|
|
112
|
-
starCount={200}
|
|
113
|
-
perspective="3D"
|
|
114
|
-
speed={2}
|
|
115
|
-
shootingStars
|
|
116
|
-
/>
|
|
106
|
+
import { Starfield } from "own-the-canvas";
|
|
107
|
+
|
|
108
|
+
<Starfield starCount={200} perspective="3D" speed={2} shootingStars />;
|
|
117
109
|
```
|
|
118
110
|
|
|
119
|
-
| Prop
|
|
120
|
-
|
|
121
|
-
| `starCount`
|
|
122
|
-
| `starColor`
|
|
123
|
-
| `backgroundColor`
|
|
124
|
-
| `speed`
|
|
125
|
-
| `twinkle`
|
|
126
|
-
| `shootingStars`
|
|
127
|
-
| `shootingStarInterval` | `number`
|
|
128
|
-
| `perspective`
|
|
111
|
+
| Prop | Type | Default | Description |
|
|
112
|
+
| ---------------------- | -------------- | ----------- | ------------------------- |
|
|
113
|
+
| `starCount` | `number` | `200` | Number of stars |
|
|
114
|
+
| `starColor` | `string` | `"#ffffff"` | Star color |
|
|
115
|
+
| `backgroundColor` | `string` | `"#000010"` | Background |
|
|
116
|
+
| `speed` | `number` | `0.5` | Movement speed |
|
|
117
|
+
| `twinkle` | `boolean` | `true` | Twinkle effect |
|
|
118
|
+
| `shootingStars` | `boolean` | `true` | Shooting stars |
|
|
119
|
+
| `shootingStarInterval` | `number` | `3000` | Ms between shooting stars |
|
|
120
|
+
| `perspective` | `"2D" \| "3D"` | `"2D"` | Flat or warp tunnel |
|
|
129
121
|
|
|
130
122
|
---
|
|
131
123
|
|
|
@@ -133,21 +125,20 @@ import { Starfield } from 'own-the-canvas';
|
|
|
133
125
|
|
|
134
126
|
Pixel-level fire simulation with multiple palettes.
|
|
135
127
|
|
|
136
|
-
|
|
137
128
|
```tsx
|
|
138
|
-
import { FireEffect } from
|
|
129
|
+
import { FireEffect } from "own-the-canvas";
|
|
139
130
|
|
|
140
|
-
<FireEffect palette="inferno" intensity={0.95}
|
|
131
|
+
<FireEffect palette="inferno" intensity={0.95} />;
|
|
141
132
|
```
|
|
142
133
|
|
|
143
|
-
| Prop
|
|
144
|
-
|
|
145
|
-
| `palette`
|
|
146
|
-
| `intensity`
|
|
147
|
-
| `windStrength`
|
|
148
|
-
| `windDirection` | `number`
|
|
149
|
-
| `spread`
|
|
150
|
-
| `cooling`
|
|
134
|
+
| Prop | Type | Default | Description |
|
|
135
|
+
| --------------- | ------------------------------------------- | ----------- | -------------------- |
|
|
136
|
+
| `palette` | `"inferno" \| "toxic" \| "ice" \| "plasma"` | `"inferno"` | Color theme |
|
|
137
|
+
| `intensity` | `number` | `0.95` | Flame intensity 0–1 |
|
|
138
|
+
| `windStrength` | `number` | `0.3` | Horizontal wind 0–1 |
|
|
139
|
+
| `windDirection` | `number` | `1` | 1 = right, -1 = left |
|
|
140
|
+
| `spread` | `number` | `0.7` | Flame spread 0–1 |
|
|
141
|
+
| `cooling` | `number` | `0.3` | Cooling rate 0–1 |
|
|
151
142
|
|
|
152
143
|
---
|
|
153
144
|
|
|
@@ -155,31 +146,25 @@ import { FireEffect } from 'own-the-canvas';
|
|
|
155
146
|
|
|
156
147
|
Web Audio API visualizer with 4 modes.
|
|
157
148
|
|
|
158
|
-
|
|
159
149
|
```tsx
|
|
160
|
-
import { AudioVisualizer } from
|
|
150
|
+
import { AudioVisualizer } from "own-the-canvas";
|
|
161
151
|
|
|
162
152
|
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
163
153
|
|
|
164
|
-
<AudioVisualizer
|
|
165
|
-
audioSource={stream}
|
|
166
|
-
mode="bars"
|
|
167
|
-
barCount={64}
|
|
168
|
-
gradient
|
|
169
|
-
/>
|
|
154
|
+
<AudioVisualizer audioSource={stream} mode="bars" barCount={64} gradient />;
|
|
170
155
|
```
|
|
171
156
|
|
|
172
|
-
| Prop
|
|
173
|
-
|
|
174
|
-
| `audioSource`
|
|
175
|
-
| `barCount`
|
|
176
|
-
| `barColor`
|
|
177
|
-
| `waveColor`
|
|
178
|
-
| `mode`
|
|
179
|
-
| `sensitivity`
|
|
180
|
-
| `gapBetweenBars` | `number`
|
|
181
|
-
| `rounded`
|
|
182
|
-
| `gradient`
|
|
157
|
+
| Prop | Type | Default | Description |
|
|
158
|
+
| ---------------- | -------------------------------------------- | ----------- | ---------------------------------------- |
|
|
159
|
+
| `audioSource` | `MediaStream \| null` | `null` | Audio stream (shows idle anim when null) |
|
|
160
|
+
| `barCount` | `number` | `64` | Number of frequency bars |
|
|
161
|
+
| `barColor` | `string` | `"#00cfff"` | Bar fill color |
|
|
162
|
+
| `waveColor` | `string` | `"#00cfff"` | Wave stroke color |
|
|
163
|
+
| `mode` | `"bars" \| "wave" \| "circular" \| "mirror"` | `"bars"` | Visualization mode |
|
|
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 |
|
|
183
168
|
|
|
184
169
|
---
|
|
185
170
|
|
|
@@ -187,7 +172,6 @@ const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
|
187
172
|
|
|
188
173
|
Burst or continuous confetti cannon.
|
|
189
174
|
|
|
190
|
-
|
|
191
175
|
```tsx
|
|
192
176
|
import { Confetti } from 'own-the-canvas';
|
|
193
177
|
const [fire, setFire] = useState(false);
|
|
@@ -198,17 +182,17 @@ const [fire, setFire] = useState(false);
|
|
|
198
182
|
</button>
|
|
199
183
|
```
|
|
200
184
|
|
|
201
|
-
| Prop
|
|
202
|
-
|
|
203
|
-
| `trigger`
|
|
204
|
-
| `particleCount` | `number`
|
|
205
|
-
| `spread`
|
|
206
|
-
| `gravity`
|
|
207
|
-
| `colors`
|
|
208
|
-
| `shapes`
|
|
209
|
-
| `duration`
|
|
210
|
-
| `continuous`
|
|
211
|
-
| `wind`
|
|
185
|
+
| Prop | Type | Default | Description |
|
|
186
|
+
| --------------- | ----------------- | ----------- | ----------------------------- |
|
|
187
|
+
| `trigger` | `boolean` | `false` | Rising edge fires a burst |
|
|
188
|
+
| `particleCount` | `number` | `150` | Pieces per burst |
|
|
189
|
+
| `spread` | `number` | `0.8` | Spread angle 0–1 |
|
|
190
|
+
| `gravity` | `number` | `0.5` | Gravity strength |
|
|
191
|
+
| `colors` | `string[]` | multi-color | Confetti colors |
|
|
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 |
|
|
212
196
|
|
|
213
197
|
---
|
|
214
198
|
|
|
@@ -216,23 +200,22 @@ const [fire, setFire] = useState(false);
|
|
|
216
200
|
|
|
217
201
|
Expanding ring ripples on click or auto.
|
|
218
202
|
|
|
219
|
-
|
|
220
203
|
```tsx
|
|
221
|
-
import { RippleEffect } from
|
|
204
|
+
import { RippleEffect } from "own-the-canvas";
|
|
222
205
|
|
|
223
|
-
<RippleEffect color="#00cfff" maxRadius={150} interactive
|
|
206
|
+
<RippleEffect color="#00cfff" maxRadius={150} interactive />;
|
|
224
207
|
```
|
|
225
208
|
|
|
226
|
-
| Prop
|
|
227
|
-
|
|
228
|
-
| `color`
|
|
229
|
-
| `maxRadius`
|
|
230
|
-
| `speed`
|
|
231
|
-
| `lineWidth`
|
|
232
|
-
| `decay`
|
|
233
|
-
| `multiRipple`
|
|
234
|
-
| `backgroundColor` | `string`
|
|
235
|
-
| `interactive`
|
|
209
|
+
| Prop | Type | Default | Description |
|
|
210
|
+
| ----------------- | --------- | --------------- | ----------------------------------- |
|
|
211
|
+
| `color` | `string` | `"#00cfff"` | Ring stroke color |
|
|
212
|
+
| `maxRadius` | `number` | `150` | Max ring radius |
|
|
213
|
+
| `speed` | `number` | `2` | Expansion speed |
|
|
214
|
+
| `lineWidth` | `number` | `1.5` | Stroke width |
|
|
215
|
+
| `decay` | `number` | `0.8` | Opacity decay rate |
|
|
216
|
+
| `multiRipple` | `boolean` | `true` | Allow multiple simultaneous ripples |
|
|
217
|
+
| `backgroundColor` | `string` | `"transparent"` | Canvas background |
|
|
218
|
+
| `interactive` | `boolean` | `true` | Spawn ripple on click |
|
|
236
219
|
|
|
237
220
|
---
|
|
238
221
|
|
|
@@ -240,26 +223,25 @@ import { RippleEffect } from 'own-the-canvas';
|
|
|
240
223
|
|
|
241
224
|
Animated Perlin noise–driven color gradient.
|
|
242
225
|
|
|
243
|
-
|
|
244
226
|
```tsx
|
|
245
|
-
import { NoiseGradient } from
|
|
227
|
+
import { NoiseGradient } from "own-the-canvas";
|
|
246
228
|
|
|
247
229
|
<NoiseGradient
|
|
248
230
|
colors={["#0d0221", "#2d1b69", "#11998e", "#38ef7d"]}
|
|
249
231
|
speed={0.3}
|
|
250
232
|
octaves={3}
|
|
251
233
|
animated
|
|
252
|
-
|
|
234
|
+
/>;
|
|
253
235
|
```
|
|
254
236
|
|
|
255
|
-
| Prop
|
|
256
|
-
|
|
257
|
-
| `colors`
|
|
258
|
-
| `speed`
|
|
259
|
-
| `scale`
|
|
260
|
-
| `octaves`
|
|
261
|
-
| `animated`
|
|
262
|
-
| `blendMode` | `string`
|
|
237
|
+
| Prop | Type | Default | Description |
|
|
238
|
+
| ----------- | ---------- | --------------- | ---------------------- |
|
|
239
|
+
| `colors` | `string[]` | deep space | 2–5 hex gradient stops |
|
|
240
|
+
| `speed` | `number` | `0.3` | Animation speed |
|
|
241
|
+
| `scale` | `number` | `1` | Noise zoom level |
|
|
242
|
+
| `octaves` | `number` | `3` | Fractal detail 1–6 |
|
|
243
|
+
| `animated` | `boolean` | `true` | Enable animation |
|
|
244
|
+
| `blendMode` | `string` | `"source-over"` | Canvas composite mode |
|
|
263
245
|
|
|
264
246
|
---
|
|
265
247
|
|
|
@@ -267,24 +249,23 @@ import { NoiseGradient } from 'own-the-canvas';
|
|
|
267
249
|
|
|
268
250
|
Pixelated dissolve transition overlay for any React content.
|
|
269
251
|
|
|
270
|
-
|
|
271
252
|
```tsx
|
|
272
|
-
import { PixelDissolve } from
|
|
253
|
+
import { PixelDissolve } from "own-the-canvas";
|
|
273
254
|
|
|
274
255
|
<PixelDissolve trigger={show} direction="out" pixelSize={8}>
|
|
275
256
|
<YourComponent />
|
|
276
|
-
</PixelDissolve
|
|
257
|
+
</PixelDissolve>;
|
|
277
258
|
```
|
|
278
259
|
|
|
279
|
-
| Prop
|
|
280
|
-
|
|
281
|
-
| `children`
|
|
282
|
-
| `pixelSize`
|
|
283
|
-
| `speed`
|
|
284
|
-
| `direction`
|
|
285
|
-
| `trigger`
|
|
286
|
-
| `color`
|
|
287
|
-
| `onComplete` | `() => void`
|
|
260
|
+
| Prop | Type | Default | Description |
|
|
261
|
+
| ------------ | ------------------------- | ----------- | ------------------------------ |
|
|
262
|
+
| `children` | `ReactNode` | — | Content to dissolve over |
|
|
263
|
+
| `pixelSize` | `number` | `8` | Block size in px |
|
|
264
|
+
| `speed` | `number` | `0.5` | Animation speed 0–2 |
|
|
265
|
+
| `direction` | `"in" \| "out" \| "both"` | `"out"` | Dissolve direction |
|
|
266
|
+
| `trigger` | `boolean` | `false` | Rising edge triggers animation |
|
|
267
|
+
| `color` | `string` | `"#0a0a0a"` | Pixel fill color |
|
|
268
|
+
| `onComplete` | `() => void` | — | Called when animation finishes |
|
|
288
269
|
|
|
289
270
|
---
|
|
290
271
|
|
|
@@ -292,29 +273,23 @@ import { PixelDissolve } from 'own-the-canvas';
|
|
|
292
273
|
|
|
293
274
|
Draggable star constellation with animated connections.
|
|
294
275
|
|
|
295
|
-
|
|
296
276
|
```tsx
|
|
297
|
-
import { ConstellationMap } from
|
|
277
|
+
import { ConstellationMap } from "own-the-canvas";
|
|
298
278
|
|
|
299
|
-
<ConstellationMap
|
|
300
|
-
starCount={80}
|
|
301
|
-
lineColor="#8888ff"
|
|
302
|
-
interactive
|
|
303
|
-
glowStars
|
|
304
|
-
/>
|
|
279
|
+
<ConstellationMap starCount={80} lineColor="#8888ff" interactive glowStars />;
|
|
305
280
|
```
|
|
306
281
|
|
|
307
|
-
| Prop
|
|
308
|
-
|
|
309
|
-
| `starCount`
|
|
310
|
-
| `starColor`
|
|
311
|
-
| `lineColor`
|
|
312
|
-
| `backgroundColor`
|
|
313
|
-
| `speed`
|
|
314
|
-
| `interactive`
|
|
315
|
-
| `lineStyle`
|
|
316
|
-
| `glowStars`
|
|
317
|
-
| `connectionDistance` | `number`
|
|
282
|
+
| Prop | Type | Default | Description |
|
|
283
|
+
| -------------------- | --------------------- | ----------- | ---------------------- |
|
|
284
|
+
| `starCount` | `number` | `80` | Number of stars |
|
|
285
|
+
| `starColor` | `string` | `"#ffffff"` | Star color |
|
|
286
|
+
| `lineColor` | `string` | `"#8888ff"` | Connection line color |
|
|
287
|
+
| `backgroundColor` | `string` | `"#050510"` | Background |
|
|
288
|
+
| `speed` | `number` | `0.3` | Star drift speed |
|
|
289
|
+
| `interactive` | `boolean` | `true` | Drag stars with mouse |
|
|
290
|
+
| `lineStyle` | `"solid" \| "dashed"` | `"solid"` | Line style |
|
|
291
|
+
| `glowStars` | `boolean` | `true` | Glow on stars |
|
|
292
|
+
| `connectionDistance` | `number` | `100` | Max distance for lines |
|
|
318
293
|
|
|
319
294
|
---
|
|
320
295
|
|
|
@@ -322,12 +297,12 @@ import { ConstellationMap } from 'own-the-canvas';
|
|
|
322
297
|
|
|
323
298
|
Every component accepts these:
|
|
324
299
|
|
|
325
|
-
| Prop
|
|
326
|
-
|
|
327
|
-
| `width`
|
|
328
|
-
| `height`
|
|
329
|
-
| `className` | `string`
|
|
330
|
-
| `style`
|
|
300
|
+
| Prop | Type | Default |
|
|
301
|
+
| ----------- | --------------------- | -------- |
|
|
302
|
+
| `width` | `number \| string` | `"100%"` |
|
|
303
|
+
| `height` | `number \| string` | `"100%"` |
|
|
304
|
+
| `className` | `string` | — |
|
|
305
|
+
| `style` | `React.CSSProperties` | — |
|
|
331
306
|
|
|
332
307
|
All components use `forwardRef` — the ref is forwarded to the underlying `<canvas>` element.
|
|
333
308
|
|
|
@@ -338,8 +313,8 @@ All components use `forwardRef` — the ref is forwarded to the underlying `<can
|
|
|
338
313
|
Import only what you use:
|
|
339
314
|
|
|
340
315
|
```tsx
|
|
341
|
-
import { MatrixRain } from
|
|
342
|
-
import { ParticleField } from
|
|
316
|
+
import { MatrixRain } from "own-the-canvas"; // ✓ only MatrixRain bundled
|
|
317
|
+
import { ParticleField } from "own-the-canvas"; // ✓ only ParticleField bundled
|
|
343
318
|
```
|
|
344
319
|
|
|
345
320
|
---
|
|
@@ -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;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type ReactionDiffusionPreset = "default" | "coral" | "spots" | "maze" | "waves" | "neon";
|
|
4
|
+
export interface ReactionDiffusionProps extends BaseCanvasProps {
|
|
5
|
+
/** Feed rate f — controls pattern type (default: 0.055) */
|
|
6
|
+
feedRate?: number;
|
|
7
|
+
/** Kill rate k — controls pattern density (default: 0.062) */
|
|
8
|
+
killRate?: number;
|
|
9
|
+
/** Diffusion rate for U chemical — keep dU/dV ratio at 2 (default: 0.2) */
|
|
10
|
+
diffusionU?: number;
|
|
11
|
+
/** Diffusion rate for V chemical — keep dU/dV ratio at 2 (default: 0.1) */
|
|
12
|
+
diffusionV?: number;
|
|
13
|
+
/** Render resolution fraction — lower = faster (default: 0.5) */
|
|
14
|
+
resolution?: number;
|
|
15
|
+
/** Simulation steps per frame (default: 8) */
|
|
16
|
+
speed?: number;
|
|
17
|
+
/** Color at low V concentration (default: "#111111") */
|
|
18
|
+
colorA?: string;
|
|
19
|
+
/** Color at high V concentration (default: "#ffffff") */
|
|
20
|
+
colorB?: string;
|
|
21
|
+
/** Canvas background color (default: "#111111") */
|
|
22
|
+
backgroundColor?: string;
|
|
23
|
+
/** Mouse disturbs the field (default: true) */
|
|
24
|
+
interactive?: boolean;
|
|
25
|
+
/** Named preset */
|
|
26
|
+
preset?: ReactionDiffusionPreset | string;
|
|
27
|
+
}
|
|
28
|
+
export declare const ReactionDiffusion: import('react').ForwardRefExoticComponent<ReactionDiffusionProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface UseReactionDiffusionOptions {
|
|
4
|
+
feedRate: number;
|
|
5
|
+
killRate: number;
|
|
6
|
+
diffusionU: number;
|
|
7
|
+
diffusionV: number;
|
|
8
|
+
resolution: number;
|
|
9
|
+
speed: number;
|
|
10
|
+
colorA: string;
|
|
11
|
+
colorB: string;
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
interactive: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function useReactionDiffusion(canvasRef: RefObject<HTMLCanvasElement | null>, options: UseReactionDiffusionOptions): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
import { SandMaterial } from './useSandSimulation';
|
|
3
|
+
|
|
4
|
+
type SandSimulationPreset = "default" | "desert" | "ocean" | "inferno" | "neon";
|
|
5
|
+
export interface SandSimulationProps extends BaseCanvasProps {
|
|
6
|
+
/** Cell size in pixels (default: 4) */
|
|
7
|
+
cellSize?: number;
|
|
8
|
+
/** Paint brush radius in cells (default: 3) */
|
|
9
|
+
brushSize?: number;
|
|
10
|
+
/** Active material to paint (default: "sand") */
|
|
11
|
+
material?: SandMaterial;
|
|
12
|
+
/** Sand cell color (default: "#ffffff") */
|
|
13
|
+
sandColor?: string;
|
|
14
|
+
/** Water cell color (default: "#6b7280") */
|
|
15
|
+
waterColor?: string;
|
|
16
|
+
/** Fire cell color (default: "#ffffff") */
|
|
17
|
+
fireColor?: string;
|
|
18
|
+
/** Wall cell color (default: "#4b5563") */
|
|
19
|
+
wallColor?: string;
|
|
20
|
+
/** Empty cell / background color (default: "#111111") */
|
|
21
|
+
backgroundColor?: string;
|
|
22
|
+
/** Enable mouse painting (default: true) */
|
|
23
|
+
interactive?: boolean;
|
|
24
|
+
/** Gravity strength multiplier (default: 1) */
|
|
25
|
+
gravity?: number;
|
|
26
|
+
/** Named preset */
|
|
27
|
+
preset?: SandSimulationPreset | string;
|
|
28
|
+
}
|
|
29
|
+
export declare const SandSimulation: import('react').ForwardRefExoticComponent<SandSimulationProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
export type SandMaterial = "sand" | "water" | "fire" | "wall" | "erase";
|
|
4
|
+
export interface UseSandSimulationOptions {
|
|
5
|
+
cellSize: number;
|
|
6
|
+
brushSize: number;
|
|
7
|
+
material: SandMaterial;
|
|
8
|
+
sandColor: string;
|
|
9
|
+
waterColor: string;
|
|
10
|
+
fireColor: string;
|
|
11
|
+
wallColor: string;
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
interactive: boolean;
|
|
14
|
+
gravity: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function useSandSimulation(canvasRef: RefObject<HTMLCanvasElement | null>, options: UseSandSimulationOptions): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type SpirographPreset = "default" | "neon" | "minimal" | "cosmic" | "pastel";
|
|
4
|
+
export interface SpirographProps extends BaseCanvasProps {
|
|
5
|
+
/** Outer circle R as fraction of min(w,h)/2 (default: 0.85) */
|
|
6
|
+
outerRadius?: number;
|
|
7
|
+
/** Inner circle r as fraction of outerRadius (default: 0.4) */
|
|
8
|
+
innerRadius?: number;
|
|
9
|
+
/** Pen arm d as fraction of innerRadius (default: 0.9) */
|
|
10
|
+
penDistance?: number;
|
|
11
|
+
/** Degrees drawn per frame (default: 2) */
|
|
12
|
+
speed?: number;
|
|
13
|
+
/** Curve stroke color (default: "#ffffff") */
|
|
14
|
+
color?: string;
|
|
15
|
+
/** Background fill color (default: "#111111") */
|
|
16
|
+
backgroundColor?: string;
|
|
17
|
+
/** Stroke line width (default: 1) */
|
|
18
|
+
lineWidth?: number;
|
|
19
|
+
/** Background fade opacity per frame — lower = longer trails (default: 0.003) */
|
|
20
|
+
trailFade?: number;
|
|
21
|
+
/** Enable animation (default: true) */
|
|
22
|
+
animated?: boolean;
|
|
23
|
+
/** Start new pattern after each full cycle (default: true) */
|
|
24
|
+
autoReset?: boolean;
|
|
25
|
+
/** Named preset */
|
|
26
|
+
preset?: SpirographPreset | string;
|
|
27
|
+
}
|
|
28
|
+
export declare const Spirograph: import('react').ForwardRefExoticComponent<SpirographProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
29
|
+
export {};
|