own-the-canvas 1.0.12 → 2.0.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.
- package/CHANGELOG.md +57 -0
- package/README.md +113 -77
- package/lib/components/AntColony/AntColony.d.ts +6 -6
- package/lib/components/AntColony/useAntColony.d.ts +6 -0
- package/lib/components/AuroraBorealis/AuroraBorealis.d.ts +3 -3
- package/lib/components/BlackHole/BlackHole.d.ts +4 -4
- package/lib/components/BlackHole/useBlackHole.d.ts +11 -3
- package/lib/components/Boids/Boids.d.ts +3 -3
- package/lib/components/Boids/useBoids.d.ts +22 -3
- package/lib/components/BubbleUniverse/BubbleUniverse.d.ts +3 -3
- package/lib/components/ButterflySwarm/ButterflySwarm.d.ts +3 -3
- package/lib/components/CloudSea/CloudSea.d.ts +29 -0
- package/lib/components/CloudSea/index.d.ts +2 -0
- package/lib/components/CloudSea/useCloudSea.d.ts +17 -0
- package/lib/components/Confetti/Confetti.d.ts +2 -2
- package/lib/components/CrystalGrowth/CrystalGrowth.d.ts +7 -7
- package/lib/components/CrystalGrowth/useCrystalGrowth.d.ts +6 -0
- package/lib/components/Dandelion/Dandelion.d.ts +35 -0
- package/lib/components/Dandelion/index.d.ts +2 -0
- package/lib/components/Dandelion/useDandelion.d.ts +39 -0
- package/lib/components/DeepSeaBioluminescence/DeepSeaBioluminescence.d.ts +4 -4
- package/lib/components/DeepSeaBioluminescence/useDeepSeaBioluminescence.d.ts +6 -0
- package/lib/components/DiffusionAggregation/DiffusionAggregation.d.ts +4 -4
- package/lib/components/DragonCursor/DragonCursor.d.ts +6 -6
- package/lib/components/Ferrofluid/Ferrofluid.d.ts +31 -0
- package/lib/components/Ferrofluid/index.d.ts +2 -0
- package/lib/components/Ferrofluid/useFerrofluid.d.ts +18 -0
- package/lib/components/FireEffect/FireEffect.d.ts +2 -2
- package/lib/components/FireEffect/useFireEffect.d.ts +7 -0
- package/lib/components/Fireflies/Fireflies.d.ts +35 -0
- package/lib/components/Fireflies/index.d.ts +2 -0
- package/lib/components/Fireflies/useFireflies.d.ts +50 -0
- package/lib/components/Fireworks/Fireworks.d.ts +3 -3
- package/lib/components/Fireworks/useFireworks.d.ts +7 -1
- package/lib/components/FlowField/FlowField.d.ts +3 -3
- package/lib/components/FluidSimulation/FluidSimulation.d.ts +5 -5
- package/lib/components/FrostGlass/FrostGlass.d.ts +33 -0
- package/lib/components/FrostGlass/index.d.ts +2 -0
- package/lib/components/FrostGlass/useFrostGlass.d.ts +38 -0
- package/lib/components/GalaxySpiral/GalaxySpiral.d.ts +4 -4
- package/lib/components/GameOfLife/GameOfLife.d.ts +5 -5
- package/lib/components/GameOfLife/useGameOfLife.d.ts +2 -0
- package/lib/components/GrassField/GrassField.d.ts +35 -0
- package/lib/components/GrassField/index.d.ts +2 -0
- package/lib/components/GrassField/useGrassField.d.ts +33 -0
- package/lib/components/IncenseSmoke/IncenseSmoke.d.ts +31 -0
- package/lib/components/IncenseSmoke/index.d.ts +2 -0
- package/lib/components/IncenseSmoke/useIncenseSmoke.d.ts +18 -0
- package/lib/components/InkMountains/InkMountains.d.ts +31 -0
- package/lib/components/InkMountains/index.d.ts +2 -0
- package/lib/components/InkMountains/useInkMountains.d.ts +23 -0
- package/lib/components/IvyGrowth/IvyGrowth.d.ts +37 -0
- package/lib/components/IvyGrowth/index.d.ts +2 -0
- package/lib/components/IvyGrowth/useIvyGrowth.d.ts +89 -0
- package/lib/components/Kaleidoscope/Kaleidoscope.d.ts +5 -5
- package/lib/components/Kaleidoscope/useKaleidoscope.d.ts +5 -0
- package/lib/components/KelpForest/KelpForest.d.ts +31 -0
- package/lib/components/KelpForest/index.d.ts +2 -0
- package/lib/components/KelpForest/useKelpForest.d.ts +27 -0
- package/lib/components/KoiPond/KoiPond.d.ts +6 -6
- package/lib/components/LSystem/LSystem.d.ts +4 -4
- package/lib/components/LSystem/useLSystem.d.ts +6 -0
- package/lib/components/Lightning/Lightning.d.ts +4 -4
- package/lib/components/MagneticField/MagneticField.d.ts +6 -6
- package/lib/components/Mandala/Mandala.d.ts +3 -3
- package/lib/components/MatrixRain/MatrixRain.d.ts +2 -2
- package/lib/components/Metaballs/Metaballs.d.ts +3 -3
- package/lib/components/MoonlitSea/MoonlitSea.d.ts +31 -0
- package/lib/components/MoonlitSea/index.d.ts +2 -0
- package/lib/components/MoonlitSea/useMoonlitSea.d.ts +24 -0
- package/lib/components/Moths/Moths.d.ts +37 -0
- package/lib/components/Moths/index.d.ts +2 -0
- package/lib/components/Moths/useMoths.d.ts +38 -0
- package/lib/components/NeuralWeb/NeuralWeb.d.ts +5 -5
- package/lib/components/NeuralWeb/useNeuralWeb.d.ts +7 -0
- package/lib/components/NoiseGradient/NoiseGradient.d.ts +2 -2
- package/lib/components/NoiseGradient/useNoiseGradient.d.ts +7 -3
- package/lib/components/OrigamiCranes/OrigamiCranes.d.ts +27 -0
- package/lib/components/OrigamiCranes/index.d.ts +2 -0
- package/lib/components/OrigamiCranes/useOrigamiCranes.d.ts +21 -0
- package/lib/components/PaperLanterns/PaperLanterns.d.ts +33 -0
- package/lib/components/PaperLanterns/index.d.ts +2 -0
- package/lib/components/PaperLanterns/usePaperLanterns.d.ts +39 -0
- package/lib/components/ParticleField/ParticleField.d.ts +5 -5
- package/lib/components/PendulaWave/PendulaWave.d.ts +5 -5
- package/lib/components/PendulaWave/usePendulaWave.d.ts +6 -0
- package/lib/components/Rain/Rain.d.ts +4 -4
- package/lib/components/Rain/useRain.d.ts +6 -0
- package/lib/components/ReactionDiffusion/ReactionDiffusion.d.ts +4 -4
- package/lib/components/SakuraBlossom/SakuraBlossom.d.ts +11 -3
- package/lib/components/SakuraBlossom/useSakuraBlossom.d.ts +34 -2
- package/lib/components/SandSimulation/SandSimulation.d.ts +9 -7
- package/lib/components/SandSimulation/useSandSimulation.d.ts +1 -0
- package/lib/components/SeasonsTree/SeasonsTree.d.ts +38 -0
- package/lib/components/SeasonsTree/index.d.ts +3 -0
- package/lib/components/SeasonsTree/useSeasonsTree.d.ts +44 -0
- package/lib/components/SlimeMold/SlimeMold.d.ts +3 -3
- package/lib/components/SnowDrift/SnowDrift.d.ts +35 -0
- package/lib/components/SnowDrift/index.d.ts +2 -0
- package/lib/components/SnowDrift/useSnowDrift.d.ts +29 -0
- package/lib/components/SolarFlare/SolarFlare.d.ts +5 -5
- package/lib/components/SolarFlare/useSolarFlare.d.ts +13 -3
- package/lib/components/SpiderWeb/SpiderWeb.d.ts +6 -6
- package/lib/components/SpiderWeb/useSpiderWeb.d.ts +7 -0
- package/lib/components/Spirograph/Spirograph.d.ts +3 -3
- package/lib/components/Starfield/Starfield.d.ts +3 -3
- package/lib/components/SunbeamDust/SunbeamDust.d.ts +35 -0
- package/lib/components/SunbeamDust/index.d.ts +2 -0
- package/lib/components/SunbeamDust/useSunbeamDust.d.ts +34 -0
- package/lib/components/TornadoVortex/TornadoVortex.d.ts +4 -4
- package/lib/components/TornadoVortex/useTornadoVortex.d.ts +8 -3
- package/lib/components/VoronoiCells/VoronoiCells.d.ts +4 -4
- package/lib/components/WatercolorBloom/WatercolorBloom.d.ts +2 -2
- package/lib/components/WatercolorBloom/useWatercolorBloom.d.ts +10 -3
- package/lib/components/WaveInterference/WaveInterference.d.ts +3 -3
- package/lib/components/WindowRain/WindowRain.d.ts +29 -0
- package/lib/components/WindowRain/index.d.ts +2 -0
- package/lib/components/WindowRain/useWindowRain.d.ts +28 -0
- package/lib/hooks/useCanvasSetup.d.ts +33 -5
- package/lib/index.cjs.js +1 -1
- package/lib/index.d.ts +36 -22
- package/lib/index.es.js +10367 -8658
- package/lib/runtime/RuntimeCanvas.d.ts +19 -0
- package/lib/runtime/fx.d.ts +60 -0
- package/lib/runtime/noise.d.ts +11 -0
- package/lib/runtime/physics.d.ts +52 -0
- package/lib/runtime/world.d.ts +11 -0
- package/lib/types/index.d.ts +0 -13
- package/package.json +8 -6
- package/lib/components/AudioVisualizer/AudioVisualizer.d.ts +0 -48
- package/lib/components/AudioVisualizer/AudioVisualizer.stories.d.ts +0 -10
- package/lib/components/AudioVisualizer/index.d.ts +0 -3
- package/lib/components/AudioVisualizer/useAudioVisualizer.d.ts +0 -25
- package/lib/components/ClothSimulation/ClothSimulation.d.ts +0 -65
- package/lib/components/ClothSimulation/index.d.ts +0 -2
- package/lib/components/ClothSimulation/useClothSimulation.d.ts +0 -24
- package/lib/components/Confetti/Confetti.stories.d.ts +0 -10
- package/lib/components/FireEffect/FireEffect.stories.d.ts +0 -10
- package/lib/components/GlitchOverlay/GlitchOverlay.d.ts +0 -53
- package/lib/components/GlitchOverlay/index.d.ts +0 -2
- package/lib/components/GlitchOverlay/useGlitchOverlay.d.ts +0 -19
- package/lib/components/InkBleed/InkBleed.d.ts +0 -36
- package/lib/components/InkBleed/index.d.ts +0 -2
- package/lib/components/InkBleed/useInkBleed.d.ts +0 -19
- package/lib/components/Lissajous/Lissajous.d.ts +0 -40
- package/lib/components/Lissajous/index.d.ts +0 -3
- package/lib/components/Lissajous/useLissajous.d.ts +0 -21
- package/lib/components/MagneticBlob/MagneticBlob.d.ts +0 -51
- package/lib/components/MagneticBlob/index.d.ts +0 -2
- package/lib/components/MagneticBlob/useMagneticBlob.d.ts +0 -18
- package/lib/components/MatrixRain/MatrixRain.stories.d.ts +0 -11
- package/lib/components/NoiseGradient/NoiseGradient.stories.d.ts +0 -9
- package/lib/components/ParticleField/ParticleField.stories.d.ts +0 -9
- package/lib/components/ParticleText/ParticleText.d.ts +0 -38
- package/lib/components/ParticleText/index.d.ts +0 -2
- package/lib/components/ParticleText/useParticleText.d.ts +0 -20
- package/lib/components/PixelDissolve/PixelDissolve.d.ts +0 -25
- package/lib/components/PixelDissolve/PixelDissolve.stories.d.ts +0 -8
- package/lib/components/PixelDissolve/index.d.ts +0 -3
- package/lib/components/PixelDissolve/usePixelDissolve.d.ts +0 -15
- package/lib/components/Shockwave/Shockwave.d.ts +0 -49
- package/lib/components/Shockwave/index.d.ts +0 -2
- package/lib/components/Shockwave/useShockwave.d.ts +0 -20
- package/lib/components/Starfield/Starfield.stories.d.ts +0 -9
- package/lib/components/TerrainMesh/TerrainMesh.d.ts +0 -42
- package/lib/components/TerrainMesh/index.d.ts +0 -2
- package/lib/components/TerrainMesh/useTerrainMesh.d.ts +0 -22
- package/lib/components/Wormhole/Wormhole.d.ts +0 -48
- package/lib/components/Wormhole/index.d.ts +0 -2
- package/lib/components/Wormhole/useWormhole.d.ts +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.0.0] - 2026-11-01
|
|
6
|
+
|
|
7
|
+
The big one: 18 new Living Scenes, effects that react to your page's elements, a production-safe runtime, color by default, and a redrawn catalog. 11 components are removed; see the README's "Upgrading from 1.x" for replacements.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- 10 more scene components: `SnowDrift`, `FrostGlass`, `OrigamiCranes`, `SeasonsTree`, `InkMountains`, `WindowRain`, `IncenseSmoke`, `MoonlitSea`, `CloudSea`, `Ferrofluid`. `SnowDrift`, `FrostGlass`, `OrigamiCranes`, and `SeasonsTree` support `collide`.
|
|
12
|
+
- 8 new nature components, all on the shared runtime: `IvyGrowth`, `Fireflies`, `Dandelion`, `GrassField`, `Moths`, `SunbeamDust`, `PaperLanterns`, `KelpForest`. Each tracks the cursor at window level, so it reacts even when used as a background under other content. `IvyGrowth`, `Fireflies`, `Dandelion`, and `PaperLanterns` support `collide` with `data-otc-solid` elements.
|
|
13
|
+
- DOM-aware effects: `SakuraBlossom` gains `overlay`, `collide`, `restitution`, and `zIndex`. With `collide`, petals land on elements marked `data-otc-solid`, rest there (following the element on scroll), and slide off with the wind. `data-otc-solid="live"` re-reads sticky/animated elements every frame.
|
|
14
|
+
- Shared canvas runtime under `SakuraBlossom`: pauses offscreen and in background tabs, honors `prefers-reduced-motion` (one static frame), adapts particle budget to frame rate, caps DPR at 2.
|
|
15
|
+
|
|
16
|
+
### Improved
|
|
17
|
+
|
|
18
|
+
- `Fireworks` is a full show over a city skyline: rockets climb on spark trails and burst as one of six shell types (peony, chrysanthemum, willow, ring, palm, crossette), stars leave glowing streaks, gold willows glitter, and each burst lights the sky. Clicking now sends the shell to the clicked height. Motion is frame-rate independent. New default palette swaps violet for gold.
|
|
19
|
+
- `BubbleUniverse` bubbles look like soap film (clear centres, swirling rainbow rims, window reflections and glints) over a soft bokeh background, and drift upward instead of piling on the floor. `gravity` is now a pull against buoyancy: below 0.03 bubbles rise.
|
|
20
|
+
- `Rain` is a rainy night street: three depth layers of rain in a gusting wind, mist, street lamps mirrored on wet asphalt, ripples and spray, and lightning flashes when the rain is heavy. New default palette (blue night).
|
|
21
|
+
- `Metaballs` are lit as glossy 3D lava-lamp wax with a hot core, highlights and rim glow, and move with a rising and sinking convection drift. New default colour (orange).
|
|
22
|
+
- `SandSimulation` pours itself (new `autoPour`, default true): three drifting streams build banded dunes, and the floor drains when the pile gets high. Grains keep a stable colour with lit surfaces and depth shading instead of re-randomising every frame.
|
|
23
|
+
- `CrystalGrowth` grows vector snowflakes (faceted ice prisms with mirrored dendrites, a sectored centre plate, glow and twinkling tips) instead of a pixel blob; finished flakes melt and regrow. `cellSize` now sets branch thickness.
|
|
24
|
+
- `PendulaWave` draws a real harmonograph onto a persistent ink layer that fills the canvas, with a glowing pen and soft glow. New default palette (amber shading into teal).
|
|
25
|
+
- `AntColony` places food at the start so trails form right away, draws real ants (with walking legs and carried crumbs), an anthill, berry piles and a soil floor; food trails glow. New default palette (fire ants on soil, green trails).
|
|
26
|
+
- `NeuralWeb` draws neurons (glowing body, nucleus, dendrites) joined by curved axons; signals run as comets and set off cascades of firing. New default palette (cyan and amber).
|
|
27
|
+
- `ParticleField` gets soft glowing particles with depth, two-tone colour, lines that brighten as particles close in, and the cursor joining the constellation. New default palette (ice blue).
|
|
28
|
+
- `LSystem` grows plants with tapered bark-to-green branches, leaves and blossoms at the tips, wind sway, a grassy mound and drifting petals; flat fractals get a colour gradient.
|
|
29
|
+
- `MagneticField` adds an iron-filings texture, red-to-blue field lines, glowing current flowing from N to S, and shaded metal poles. `animated` now defaults to true (it drives the current). Default poles are red N and blue S.
|
|
30
|
+
- `ReactionDiffusion` is lit as a glossy relief, with shaded slopes and specular ridges.
|
|
31
|
+
- `FireEffect` renders smooth licking flames instead of per-pixel static: a noise-driven heat field on a coarse grid, upscaled with smoothing, plus a glow layer and rising sparks. Same props; `resolution` now sets the grid cell size.
|
|
32
|
+
- `Kaleidoscope` is a real kaleidoscope: coloured glass shards and beads tumble in one wedge that is mirrored around the centre and fills the canvas edge to edge, instead of blurry noise inside a disc. New default palette (amber and teal). `noiseScale` now sets how many shards there are.
|
|
33
|
+
- `DeepSeaBioluminescence` draws translucent pulsing jellyfish at different depths (glowing bells, rim lights, ruffled oral arms, trailing tentacles) with marine snow and light shafts; moving the cursor stirs up luminous sparks and makes nearby plankton and jellyfish flash. New default palette (cyan and teal).
|
|
34
|
+
- `SpiderWeb` is a real orb web: an irregular frame bridged to the edges, radii, and one continuous scalloped capture spiral that shimmers in the moonlight, with dew beads and an orb-weaver spider that walks to where you disturb the web. `ringCount` is now the number of spiral turns.
|
|
35
|
+
- `DragonCursor` is redrawn as a solid, glowing dragon instead of a wireframe skeleton: tapered scaled body with a glowing rim, dorsal spines, legs, membrane wings with veins, a horned head with glowing slit-pupil eyes and whiskers, and additive fire. New default palette (emerald body, amber eyes, orange flame) and `wingSpan` default 80. Props and presets are unchanged.
|
|
36
|
+
- `TornadoVortex`, `SolarFlare`, `BlackHole`, `NoiseGradient`, `Boids`, and `WatercolorBloom` are rebuilt for much better visuals and moved onto the shared runtime (pause offscreen, reduced motion, frame-rate independent, adaptive quality). Props and presets are unchanged.
|
|
37
|
+
- TornadoVortex: curved rope funnel of orbiting condensation streaks under a rotating wall cloud; dust skirt, flung debris, lightning that lights the cloud.
|
|
38
|
+
- SolarFlare: granulated photosphere with limb darkening and sunspots, corona streamers, plasma flowing along magnetic loops, eruptions whose plasma falls back.
|
|
39
|
+
- BlackHole: Interstellar-style shadow, photon ring, Doppler-beamed disk, lensed far side of the disk, gravitationally lensed stars and grid.
|
|
40
|
+
- NoiseGradient: domain-warped flowing gradient (no more stretched streaks), dithered against banding, pixel budget capped for full-screen use.
|
|
41
|
+
- Boids: field of view, variable speed, panic that ripples through the flock, flapping/banking bird silhouettes with depth; spatial grid for large flocks.
|
|
42
|
+
- WatercolorBloom: layered translucent washes from recursive polygon deformation, wet-edge pigment, paper grain.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- Docs site: smooth scrolling kept the first page's height as its scroll limit, so Introduction and Installation couldn't be scrolled to the bottom after navigating from another page.
|
|
47
|
+
- Cursor-following effects no longer chase the cursor outside their canvas (regression from 1.0.12, which moved their `mousemove` listener to `window`). They still react through foreground content stacked on the canvas; anywhere else on the page they behave as if the cursor left. `DragonCursor` wanders autonomously, `BlackHole` drifts back to center, `TornadoVortex` wanders, the rest drop their cursor interaction, and a `ParticleField` drag ends when it leaves the canvas.
|
|
48
|
+
|
|
49
|
+
- npm package: published type declarations no longer include test and Storybook files, and now include the shared runtime types that component declarations import (strict `skipLibCheck: false` setups resolved them as missing).
|
|
50
|
+
|
|
51
|
+
### Removed (breaking)
|
|
52
|
+
|
|
53
|
+
- `Shockwave`, `Lissajous`, `MagneticBlob`, `Wormhole`, `ClothSimulation`, `GlitchOverlay`, `PixelDissolve`, `AudioVisualizer`, `TerrainMesh`, `ParticleText`, and `InkBleed` are removed, along with their exported types (`LissajousColorMode`, `VisualizerMode`, `DissolveDirection`, and so on). Closest replacements: `PendulaWave` for Lissajous curves (its harmonograph draws the same figures), `Metaballs` for MagneticBlob, `Starfield` with `perspective="3D"` for Wormhole.
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
|
|
57
|
+
- **Components default to color instead of monochrome (visual breaking change).** With no `preset`, each component now renders in its signature palette: the colors of a natural preset (`KoiPond` uses `koi`, `FlowField` uses `ocean`, `Fireworks` uses `celebration`, `FireEffect` uses `inferno`, and so on). Only colors change; counts, speeds, and physics are untouched. `MatrixRain` defaults to classic `#00ff41`, `Confetti` to the `colorful` palette, `LSystem` to green branches. To keep the old look, pass `preset="monochrome"`, which every preset-driven component now accepts. Explicit color props still win over any preset.
|
|
58
|
+
- Docs site: playgrounds open on the colorful default and list `monochrome` as a preset; the site is redesigned as a paper-cut diorama: cream sheets with hand-cut edges on a kraft desk, stacked colored under-sheets, washi-tape labels, layered-hill banners, and a terracotta accent instead of black.
|
|
59
|
+
- React 19 is now a supported peer dependency (`^18.0.0 || ^19.0.0`).
|
|
60
|
+
- `SakuraBlossom` motion is time-based. It looks identical at 60Hz and no longer runs 2x fast on 120Hz displays.
|
|
61
|
+
|
|
5
62
|
## [1.0.12] - 2026-09-16
|
|
6
63
|
|
|
7
64
|
### Fixed
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# own-the-canvas
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**60 canvas-based React visual components. Zero dependencies. TypeScript.**
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/own-the-canvas)
|
|
10
10
|
[](LICENSE)
|
|
@@ -16,6 +16,18 @@
|
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
+
## What's New in 2.0
|
|
20
|
+
|
|
21
|
+
- **18 Living Scenes:** nature effects with real models underneath, from ivy that grows along your headline to fireflies that flash in sync and a moonlit sea that glitters where the waves catch the moon.
|
|
22
|
+
- **Effects that know your page:** mark any element with `data-otc-solid` and petals, snow, seeds, leaves, fireflies, and paper cranes land on it, and ivy climbs it.
|
|
23
|
+
- **Color by default:** every component opens in its signature palette. Pass `preset="monochrome"` for the 1.x look.
|
|
24
|
+
- **Production-safe runtime:** effects pause offscreen and in background tabs, respect `prefers-reduced-motion`, and run at the same speed on 60Hz and 120Hz screens.
|
|
25
|
+
- **Rebuilt classics:** DragonCursor, Fireworks, Rain, BlackHole, TornadoVortex, SolarFlare, Boids, and more were redrawn from scratch with the same props.
|
|
26
|
+
|
|
27
|
+
Upgrading from 1.x? See [Upgrading from 1.x](#upgrading-from-1x).
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
19
31
|
## Install
|
|
20
32
|
|
|
21
33
|
```bash
|
|
@@ -26,7 +38,7 @@ pnpm add own-the-canvas
|
|
|
26
38
|
yarn add own-the-canvas
|
|
27
39
|
```
|
|
28
40
|
|
|
29
|
-
> **Peer deps:** React 18
|
|
41
|
+
> **Peer deps:** React 18 or 19
|
|
30
42
|
|
|
31
43
|
---
|
|
32
44
|
|
|
@@ -35,7 +47,7 @@ yarn add own-the-canvas
|
|
|
35
47
|
Every component fills its parent container by default. Drop it in and it works.
|
|
36
48
|
|
|
37
49
|
```tsx
|
|
38
|
-
import {
|
|
50
|
+
import { MatrixRain } from "own-the-canvas";
|
|
39
51
|
|
|
40
52
|
export default function App() {
|
|
41
53
|
return (
|
|
@@ -50,13 +62,67 @@ All components accept a `preset` prop for instant themed defaults — override a
|
|
|
50
62
|
|
|
51
63
|
---
|
|
52
64
|
|
|
65
|
+
## Effects That Know Your Page
|
|
66
|
+
|
|
67
|
+
Mark any element with `data-otc-solid` and effects collide with it. Petals land on your headline, rest on your buttons, and slide off the edges in the wind. Resting petals stay attached when the page scrolls.
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { SakuraBlossom } from "own-the-canvas";
|
|
71
|
+
|
|
72
|
+
<SakuraBlossom overlay collide preset="sakura" />
|
|
73
|
+
|
|
74
|
+
<h1 data-otc-solid>Ship faster</h1>
|
|
75
|
+
<button data-otc-solid>Get started</button>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
| Prop | Type | Default | Description |
|
|
79
|
+
| --- | --- | --- | --- |
|
|
80
|
+
| `overlay` | `boolean` | `false` | Fixed full-viewport layer over the page, click-through, transparent background |
|
|
81
|
+
| `collide` | `boolean` | `false` | Collide with `[data-otc-solid]` elements |
|
|
82
|
+
| `restitution` | `number` | `0` | `0` = rest and slide off, `> 0` = bounce |
|
|
83
|
+
| `zIndex` | `number` | `10` | Overlay stacking order |
|
|
84
|
+
|
|
85
|
+
Use `data-otc-solid="live"` for sticky or animated elements so their position is re-read every frame.
|
|
86
|
+
|
|
87
|
+
What each DOM-aware effect does with marked elements:
|
|
88
|
+
|
|
89
|
+
| Component | With `collide` |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| `SakuraBlossom` | Petals land, rest, and slide off in the wind |
|
|
92
|
+
| `IvyGrowth` | Vines climb each element's sides and grow across its top |
|
|
93
|
+
| `Fireflies` | Fireflies perch on top edges and blink there |
|
|
94
|
+
| `Dandelion` | Blown seeds parachute down and settle on elements |
|
|
95
|
+
| `PaperLanterns` | Clicking a marked element releases a lantern from it |
|
|
96
|
+
| `SnowDrift` | Snow piles up on top edges and spills off the sides |
|
|
97
|
+
| `FrostGlass` | Frost nucleates on element edges and grows outward |
|
|
98
|
+
| `OrigamiCranes` | Paper cranes land and rest with wings folded |
|
|
99
|
+
| `SeasonsTree` | Falling autumn leaves and petals settle on elements |
|
|
100
|
+
|
|
101
|
+
Rain and Confetti are next.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Production-Safe by Default
|
|
106
|
+
|
|
107
|
+
Runtime-based components (SakuraBlossom, the 18 Living Scenes below, and the rebuilt TornadoVortex, SolarFlare, BlackHole, NoiseGradient, Boids, and WatercolorBloom) get these behaviors with no setup:
|
|
108
|
+
|
|
109
|
+
- **Pause offscreen:** zero work while scrolled out of view.
|
|
110
|
+
- **Pause in background tabs:** resumes without a burst of catch-up motion.
|
|
111
|
+
- **Respects `prefers-reduced-motion`:** renders one still frame and stops.
|
|
112
|
+
- **Adaptive quality:** particle budget drops when frames run slow and recovers when they don't.
|
|
113
|
+
- **Same speed on every display:** motion is time-based, so 120Hz screens don't run 2x fast.
|
|
114
|
+
- **DPR capped at 2:** sharp on retina without 3x-density cost on phones.
|
|
115
|
+
- **SSR-safe:** overlay canvases mount on the client only.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
53
119
|
## Featured Components
|
|
54
120
|
|
|
55
121
|
### DragonCursor
|
|
56
122
|
|
|
57
123
|
A sinuous dragon body that trails your cursor in real time. Segments, wings, optional fire breath, and a background star field with optional per-star glow halos — all configurable.
|
|
58
124
|
|
|
59
|
-
**Presets:** `default · emerald · inferno · void · ice`
|
|
125
|
+
**Presets:** `default · emerald · inferno · void · ice · monochrome`
|
|
60
126
|
|
|
61
127
|
```tsx
|
|
62
128
|
import { DragonCursor } from "own-the-canvas";
|
|
@@ -67,8 +133,8 @@ import { DragonCursor } from "own-the-canvas";
|
|
|
67
133
|
| Prop | Type | Default | Description |
|
|
68
134
|
| --- | --- | --- | --- |
|
|
69
135
|
| `segmentCount` | `number` | `20` | Body segment count |
|
|
70
|
-
| `bodyColor` | `string` | `"#
|
|
71
|
-
| `wingSpan` | `number` | `
|
|
136
|
+
| `bodyColor` | `string` | `"#35e0a1"` | Dragon body color |
|
|
137
|
+
| `wingSpan` | `number` | `80` | Wing span in px |
|
|
72
138
|
| `showFire` | `boolean` | `false` | Enable fire breath |
|
|
73
139
|
| `followSpeed` | `number` | `0.15` | Cursor follow lerp speed |
|
|
74
140
|
| `starCount` | `number` | `60` | Number of background stars |
|
|
@@ -82,7 +148,7 @@ import { DragonCursor } from "own-the-canvas";
|
|
|
82
148
|
|
|
83
149
|
Falling character rain — katakana, latin, or binary. Per-column trail fade, variable speed, neon green or any color.
|
|
84
150
|
|
|
85
|
-
**Presets:** `default · cyberpunk · binary · minimal · blood`
|
|
151
|
+
**Presets:** `default · cyberpunk · binary · minimal · blood · monochrome`
|
|
86
152
|
|
|
87
153
|
```tsx
|
|
88
154
|
import { MatrixRain } from "own-the-canvas";
|
|
@@ -92,7 +158,7 @@ import { MatrixRain } from "own-the-canvas";
|
|
|
92
158
|
|
|
93
159
|
| Prop | Type | Default | Description |
|
|
94
160
|
| --- | --- | --- | --- |
|
|
95
|
-
| `color` | `string` | `"#
|
|
161
|
+
| `color` | `string` | `"#00ff41"` | Character color |
|
|
96
162
|
| `charset` | `"latin" \| "binary" \| "katakana" \| string` | `"latin"` | Character set |
|
|
97
163
|
| `fontSize` | `number` | `14` | Font size in px |
|
|
98
164
|
| `speed` | `number` | `33` | Ms per frame — lower = faster |
|
|
@@ -104,7 +170,7 @@ import { MatrixRain } from "own-the-canvas";
|
|
|
104
170
|
|
|
105
171
|
Living koi pond on canvas — fish navigate with organic steering, ripple on hover, lily pads float, caustic light dances.
|
|
106
172
|
|
|
107
|
-
**Presets:** `default · koi · night · lotus · neon`
|
|
173
|
+
**Presets:** `default · koi · night · lotus · neon · monochrome`
|
|
108
174
|
|
|
109
175
|
```tsx
|
|
110
176
|
import { KoiPond } from "own-the-canvas";
|
|
@@ -115,7 +181,7 @@ import { KoiPond } from "own-the-canvas";
|
|
|
115
181
|
| Prop | Type | Default | Description |
|
|
116
182
|
| --- | --- | --- | --- |
|
|
117
183
|
| `fishCount` | `number` | `6` | Number of koi fish |
|
|
118
|
-
| `fishColor` | `string` | `"#
|
|
184
|
+
| `fishColor` | `string` | `"#ff6030"` | Fish body color |
|
|
119
185
|
| `showLilies` | `boolean` | `true` | Render floating lily pads |
|
|
120
186
|
| `caustics` | `boolean` | `true` | Caustic light shimmer |
|
|
121
187
|
| `interactive` | `boolean` | `true` | React to mouse movement |
|
|
@@ -126,7 +192,7 @@ import { KoiPond } from "own-the-canvas";
|
|
|
126
192
|
|
|
127
193
|
Real-time Navier-Stokes fluid solver. Move your mouse to inject velocity and ink — auto-bursts fire at intervals for continuous motion.
|
|
128
194
|
|
|
129
|
-
**Presets:** `default · ink · neon · lava · ocean · smoke`
|
|
195
|
+
**Presets:** `default · ink · neon · lava · ocean · smoke · monochrome`
|
|
130
196
|
|
|
131
197
|
```tsx
|
|
132
198
|
import { FluidSimulation } from "own-the-canvas";
|
|
@@ -141,7 +207,7 @@ import { FluidSimulation } from "own-the-canvas";
|
|
|
141
207
|
| Prop | Type | Default | Description |
|
|
142
208
|
| --- | --- | --- | --- |
|
|
143
209
|
| `resolution` | `number` | `128` | Grid resolution 32–128 |
|
|
144
|
-
| `inkColors` | `string[]` |
|
|
210
|
+
| `inkColors` | `string[]` | `["#0c4a6e", "#0891B2", "#06b6d4", "#67e8f9"]` | Ink colors |
|
|
145
211
|
| `viscosity` | `number` | `0.0001` | Fluid viscosity |
|
|
146
212
|
| `autoInk` | `boolean` | `true` | Auto-inject ink bursts |
|
|
147
213
|
| `mouseForce` | `number` | `5` | Mouse velocity force multiplier |
|
|
@@ -168,44 +234,18 @@ import { FlowField } from "own-the-canvas";
|
|
|
168
234
|
| Prop | Type | Default | Description |
|
|
169
235
|
| --- | --- | --- | --- |
|
|
170
236
|
| `particleCount` | `number` | `800` | Number of flow particles |
|
|
171
|
-
| `colors` | `string[]` |
|
|
237
|
+
| `colors` | `string[]` | `["#0c4a6e", "#0891B2", "#06b6d4", "#67e8f9", "#e0f2fe"]` | Particle stroke colors |
|
|
172
238
|
| `noiseScale` | `number` | `0.004` | Noise scale — lower = larger structures |
|
|
173
239
|
| `curl` | `boolean` | `false` | Add curl noise for swirling flow |
|
|
174
240
|
| `speed` | `number` | `1` | Flow speed multiplier |
|
|
175
241
|
|
|
176
242
|
---
|
|
177
243
|
|
|
178
|
-
### GlitchOverlay
|
|
179
|
-
|
|
180
|
-
Digital glitch effect with RGB channel separation, CRT scanlines, block-slice artifacts, and film noise. Designed as an absolute-positioned overlay — zero configuration required.
|
|
181
|
-
|
|
182
|
-
**Presets:** `default · crt · cyberpunk · subtle · corrupt`
|
|
183
|
-
|
|
184
|
-
```tsx
|
|
185
|
-
import { GlitchOverlay } from "own-the-canvas";
|
|
186
|
-
|
|
187
|
-
<div style={{ position: "relative" }}>
|
|
188
|
-
<YourContent />
|
|
189
|
-
<GlitchOverlay preset="cyberpunk" intensity={0.8} rgbShift={12} />
|
|
190
|
-
</div>
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
| Prop | Type | Default | Description |
|
|
194
|
-
| --- | --- | --- | --- |
|
|
195
|
-
| `intensity` | `number` | `0.6` | Glitch probability 0–1 |
|
|
196
|
-
| `rgbShift` | `number` | `8` | RGB color shift in px |
|
|
197
|
-
| `rgbShiftColor` | `string` | `"#ff0000"` | RGB split primary color — complement used for opposing channel |
|
|
198
|
-
| `scanlines` | `boolean` | `true` | CRT scanline overlay |
|
|
199
|
-
| `blockGlitch` | `boolean` | `true` | Block-slice glitch artifacts |
|
|
200
|
-
| `flickerRate` | `number` | `0.02` | Screen flicker rate 0–1 |
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
244
|
### BubbleUniverse
|
|
205
245
|
|
|
206
246
|
Physics-based soap bubbles that float, collide, merge on contact, and pop on click. Iridescent shimmer and glow included.
|
|
207
247
|
|
|
208
|
-
**Presets:** `default · soap · neon · deep · minimal`
|
|
248
|
+
**Presets:** `default · soap · neon · deep · minimal · monochrome`
|
|
209
249
|
|
|
210
250
|
```tsx
|
|
211
251
|
import { BubbleUniverse } from "own-the-canvas";
|
|
@@ -227,7 +267,7 @@ import { BubbleUniverse } from "own-the-canvas";
|
|
|
227
267
|
|
|
228
268
|
Falling rain streaks with sinusoidal wind drift, splash particles on ground impact, and a background star field with optional glow halos. Great as a layered overlay.
|
|
229
269
|
|
|
230
|
-
**Presets:** `default · storm · drizzle · neon · golden`
|
|
270
|
+
**Presets:** `default · storm · drizzle · neon · golden · monochrome`
|
|
231
271
|
|
|
232
272
|
```tsx
|
|
233
273
|
import { Rain } from "own-the-canvas";
|
|
@@ -240,7 +280,7 @@ import { Rain } from "own-the-canvas";
|
|
|
240
280
|
| `dropCount` | `number` | `200` | Number of rain drops |
|
|
241
281
|
| `speed` | `number` | `15` | Drop fall speed px/frame |
|
|
242
282
|
| `wind` | `number` | `0.3` | Horizontal wind drift |
|
|
243
|
-
| `dropColor` | `string` | `"#
|
|
283
|
+
| `dropColor` | `string` | `"#a9c2e8"` | Drop stroke color |
|
|
244
284
|
| `showSplashes` | `boolean` | `true` | Splash particles on impact |
|
|
245
285
|
| `starCount` | `number` | `60` | Number of background stars |
|
|
246
286
|
| `starColor` | `string` | `"#ffffff"` | Star color |
|
|
@@ -251,9 +291,9 @@ import { Rain } from "own-the-canvas";
|
|
|
251
291
|
|
|
252
292
|
### FireEffect
|
|
253
293
|
|
|
254
|
-
|
|
294
|
+
Licking flame tongues from a smooth noise-driven heat field, with a soft glow and sparks rising off the top. Five colour palettes, wind, and flame height controls.
|
|
255
295
|
|
|
256
|
-
**Presets:** `default · inferno · toxic · ice · plasma`
|
|
296
|
+
**Presets:** `default · inferno · toxic · ice · plasma · monochrome`
|
|
257
297
|
|
|
258
298
|
```tsx
|
|
259
299
|
import { FireEffect } from "own-the-canvas";
|
|
@@ -263,7 +303,7 @@ import { FireEffect } from "own-the-canvas";
|
|
|
263
303
|
|
|
264
304
|
| Prop | Type | Default | Description |
|
|
265
305
|
| --- | --- | --- | --- |
|
|
266
|
-
| `palette` | `"smoke" \| "inferno" \| "toxic" \| "ice" \| "plasma"` | `"
|
|
306
|
+
| `palette` | `"smoke" \| "inferno" \| "toxic" \| "ice" \| "plasma"` | `"inferno"` | Color theme |
|
|
267
307
|
| `customColors` | `string[]` | `undefined` | Custom gradient — overrides palette when ≥2 colors |
|
|
268
308
|
| `intensity` | `number` | `0.95` | Flame intensity 0–1 |
|
|
269
309
|
| `windStrength` | `number` | `0.3` | Horizontal wind -1 to 1 |
|
|
@@ -272,35 +312,6 @@ import { FireEffect } from "own-the-canvas";
|
|
|
272
312
|
|
|
273
313
|
---
|
|
274
314
|
|
|
275
|
-
### ParticleText
|
|
276
|
-
|
|
277
|
-
Text rendered from thousands of particles — each springs to its position in the letterform. Mouse cursor repels them; they reform when it leaves.
|
|
278
|
-
|
|
279
|
-
**Presets:** `default · neon · fire · frost · gold · minimal`
|
|
280
|
-
|
|
281
|
-
```tsx
|
|
282
|
-
import { ParticleText } from "own-the-canvas";
|
|
283
|
-
|
|
284
|
-
<ParticleText
|
|
285
|
-
text="HELLO"
|
|
286
|
-
preset="neon"
|
|
287
|
-
fontSize={140}
|
|
288
|
-
repelRadius={100}
|
|
289
|
-
repelForce={8}
|
|
290
|
-
/>
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
| Prop | Type | Default | Description |
|
|
294
|
-
| --- | --- | --- | --- |
|
|
295
|
-
| `text` | `string` | `"hello"` | Text to render as particles |
|
|
296
|
-
| `fontSize` | `number` | `120` | Font size in px |
|
|
297
|
-
| `color` | `string` | `"#ffffff"` | Particle color |
|
|
298
|
-
| `repelRadius` | `number` | `80` | Mouse repulsion radius in px |
|
|
299
|
-
| `repelForce` | `number` | `5` | Mouse repulsion force |
|
|
300
|
-
| `snapSpeed` | `number` | `0.12` | Spring constant for snap-to-target |
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
315
|
## Base Props
|
|
305
316
|
|
|
306
317
|
Every component accepts these props:
|
|
@@ -311,15 +322,23 @@ Every component accepts these props:
|
|
|
311
322
|
| `height` | `number \| string` | `"100%"` | Container height |
|
|
312
323
|
| `className` | `string` | — | CSS class on wrapper `<div>` |
|
|
313
324
|
| `style` | `React.CSSProperties` | — | Inline styles on wrapper `<div>` |
|
|
314
|
-
| `preset` | `string` | `"default"` | Named preset
|
|
325
|
+
| `preset` | `string` | `"default"` | Named preset that sets themed defaults. `"monochrome"` gives the 1.x grayscale look |
|
|
315
326
|
|
|
316
327
|
All components use `forwardRef` — the ref is forwarded to the underlying `<canvas>` element.
|
|
317
328
|
|
|
318
329
|
---
|
|
319
330
|
|
|
320
|
-
##
|
|
331
|
+
## Living Scenes
|
|
332
|
+
|
|
333
|
+
Nature effects with real models underneath, built for hero sections:
|
|
334
|
+
|
|
335
|
+
> IvyGrowth (space colonization) · Fireflies (pulse-coupled sync) · Dandelion (pappus drag) · GrassField (spring blades) · Moths (transverse orientation) · SunbeamDust (Tyndall-lit dust) · PaperLanterns (buoyancy and depth) · KelpForest (anchored rope dynamics) · SnowDrift (angle-of-repose drifts) · FrostGlass (60° ice dendrites) · OrigamiCranes (faceted 3D paper) · SeasonsTree (kinematic tree, four seasons) · InkMountains (sumi-e ridgelines) · WindowRain (refracting drops on fogged glass) · IncenseSmoke (laminar-to-turbulent plume) · MoonlitSea (moon-path glitter) · CloudSea (sunlit cloud deck) · Ferrofluid (Rosensweig spikes)
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## 34 More Components
|
|
321
340
|
|
|
322
|
-
>
|
|
341
|
+
> AntColony · AuroraBorealis · BlackHole · Boids · ButterflySwarm · Confetti · CrystalGrowth · DeepSeaBioluminescence · DiffusionAggregation · Fireworks · GalaxySpiral · GameOfLife · Kaleidoscope · LSystem · Lightning · MagneticField · Mandala · Metaballs · NeuralWeb · NoiseGradient · ParticleField · PendulaWave · ReactionDiffusion · SakuraBlossom · SandSimulation · SlimeMold · SolarFlare · SpiderWeb · Spirograph · Starfield · TornadoVortex · VoronoiCells · WatercolorBloom · WaveInterference
|
|
323
342
|
|
|
324
343
|
Full docs, live previews, and interactive playground:
|
|
325
344
|
|
|
@@ -327,6 +346,23 @@ Full docs, live previews, and interactive playground:
|
|
|
327
346
|
|
|
328
347
|
---
|
|
329
348
|
|
|
349
|
+
## Upgrading from 1.x
|
|
350
|
+
|
|
351
|
+
2.0 removes 11 components and changes default colors. Everything else keeps its props.
|
|
352
|
+
|
|
353
|
+
| Removed in 2.0 | Use instead |
|
|
354
|
+
| --- | --- |
|
|
355
|
+
| `Lissajous` | `PendulaWave` (its harmonograph draws the same figures) |
|
|
356
|
+
| `MagneticBlob` | `Metaballs` |
|
|
357
|
+
| `Wormhole` | `Starfield` with `perspective="3D"` |
|
|
358
|
+
| `Shockwave`, `ClothSimulation`, `GlitchOverlay`, `PixelDissolve`, `AudioVisualizer`, `TerrainMesh`, `ParticleText`, `InkBleed` | No direct replacement. Stay on 1.0.12 if you need them |
|
|
359
|
+
|
|
360
|
+
**Default colors changed.** With no `preset`, components now render in color. To keep the 1.x look, pass `preset="monochrome"`. Explicit color props still override any preset.
|
|
361
|
+
|
|
362
|
+
**Cursor effects stay inside their canvas.** Effects that follow the cursor now ignore it when it's outside their canvas, instead of chasing it across the page.
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
330
366
|
## License
|
|
331
367
|
|
|
332
368
|
MIT
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCanvasProps } from '../../types';
|
|
2
2
|
|
|
3
|
-
type AntColonyPreset = "default" | "neon" | "desert" | "jungle" | "minimal" | "swarm";
|
|
3
|
+
type AntColonyPreset = "default" | "neon" | "desert" | "jungle" | "minimal" | "swarm" | "monochrome";
|
|
4
4
|
export interface AntColonyProps extends BaseCanvasProps {
|
|
5
5
|
/** Number of ants (default: 150) */
|
|
6
6
|
antCount?: number;
|
|
@@ -18,15 +18,15 @@ export interface AntColonyProps extends BaseCanvasProps {
|
|
|
18
18
|
sensorDistance?: number;
|
|
19
19
|
/** Max turn per frame in radians (default: 0.3) */
|
|
20
20
|
turnSpeed?: number;
|
|
21
|
-
/** Ant dot color (default: "#
|
|
21
|
+
/** Ant dot color (default: "#d9693a") */
|
|
22
22
|
antColor?: string;
|
|
23
|
-
/** Pheromone trail color (default: "#
|
|
23
|
+
/** Pheromone trail color (default: "#6fdc8c") */
|
|
24
24
|
pheromoneColor?: string;
|
|
25
|
-
/** Food source color (default: "#
|
|
25
|
+
/** Food source color (default: "#f5c242") */
|
|
26
26
|
foodColor?: string;
|
|
27
|
-
/** Nest color (default: "#
|
|
27
|
+
/** Nest color (default: "#9a6a3a") */
|
|
28
28
|
nestColor?: string;
|
|
29
|
-
/** Canvas background (default: "#
|
|
29
|
+
/** Canvas background (default: "#1a140d") */
|
|
30
30
|
backgroundColor?: string;
|
|
31
31
|
/** Pheromone grid resolution (default: 0.5) */
|
|
32
32
|
resolution?: number;
|
|
@@ -19,4 +19,10 @@ export interface UseAntColonyOptions {
|
|
|
19
19
|
interactive: boolean;
|
|
20
20
|
maxFood: number;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Ant colony foraging. Ants leave the anthill, wander, and lay a "home" scent; the ones that
|
|
24
|
+
* find food carry a crumb back while laying a "food" scent, and the others follow it, so
|
|
25
|
+
* glowing trails form between the hill and each food pile and fade once the pile is gone.
|
|
26
|
+
* Food is placed at the start and respawns; click to drop more.
|
|
27
|
+
*/
|
|
22
28
|
export declare function useAntColony(canvasRef: RefObject<HTMLCanvasElement | null>, options: UseAntColonyOptions): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCanvasProps } from '../../types';
|
|
2
2
|
|
|
3
|
-
type AuroraBorealisPreset = "default" | "arctic" | "solar" | "tropical" | "neon" | "midnight";
|
|
3
|
+
type AuroraBorealisPreset = "default" | "arctic" | "solar" | "tropical" | "neon" | "midnight" | "monochrome";
|
|
4
4
|
interface AuroraBorealisPresetValues {
|
|
5
5
|
colors?: string[];
|
|
6
6
|
backgroundColor?: string;
|
|
@@ -9,7 +9,7 @@ interface AuroraBorealisPresetValues {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const PRESETS: Record<AuroraBorealisPreset, AuroraBorealisPresetValues>;
|
|
11
11
|
export interface AuroraBorealisProps extends BaseCanvasProps {
|
|
12
|
-
/** Aurora band colors (default:
|
|
12
|
+
/** Aurora band colors (default: ["#00ff88", "#00ccff", "#88ff00"]) */
|
|
13
13
|
colors?: string[];
|
|
14
14
|
/** Animation speed multiplier (default: 1) */
|
|
15
15
|
speed?: number;
|
|
@@ -17,7 +17,7 @@ export interface AuroraBorealisProps extends BaseCanvasProps {
|
|
|
17
17
|
intensity?: number;
|
|
18
18
|
/** Number of aurora layers (default: 5) */
|
|
19
19
|
layers?: number;
|
|
20
|
-
/** Sky background color (default: "#
|
|
20
|
+
/** Sky background color (default: "#050a0f") */
|
|
21
21
|
backgroundColor?: string;
|
|
22
22
|
/** Wave height as fraction of canvas height (default: 0.15) */
|
|
23
23
|
waveAmplitude?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCanvasProps } from '../../types';
|
|
2
2
|
|
|
3
|
-
type BlackHolePreset = "default" | "cosmic" | "inferno" | "neon" | "void";
|
|
3
|
+
type BlackHolePreset = "default" | "cosmic" | "inferno" | "neon" | "void" | "monochrome";
|
|
4
4
|
interface BlackHolePresetValues {
|
|
5
5
|
diskColor?: string;
|
|
6
6
|
backgroundColor?: string;
|
|
@@ -12,9 +12,9 @@ interface BlackHolePresetValues {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const PRESETS: Record<BlackHolePreset, BlackHolePresetValues>;
|
|
14
14
|
export interface BlackHoleProps extends BaseCanvasProps {
|
|
15
|
-
/** Accretion disk particle color (default: "#
|
|
15
|
+
/** Accretion disk particle color (default: "#ff6600") */
|
|
16
16
|
diskColor?: string;
|
|
17
|
-
/** Canvas background (default: "#
|
|
17
|
+
/** Canvas background (default: "#0d0200") */
|
|
18
18
|
backgroundColor?: string;
|
|
19
19
|
/** Number of disk particles (default: 300) */
|
|
20
20
|
particleCount?: number;
|
|
@@ -24,7 +24,7 @@ export interface BlackHoleProps extends BaseCanvasProps {
|
|
|
24
24
|
eventHorizonRadius?: number;
|
|
25
25
|
/** Accretion disk radial extent in px (default: 120) */
|
|
26
26
|
diskWidth?: number;
|
|
27
|
-
/** Polar jet stream color (default: "#
|
|
27
|
+
/** Polar jet stream color (default: "#ff3300") */
|
|
28
28
|
jetColor?: string;
|
|
29
29
|
/** Show polar particle jets (default: true) */
|
|
30
30
|
showJets?: boolean;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
|
|
3
1
|
export interface UseBlackHoleOptions {
|
|
4
2
|
diskColor: string;
|
|
5
3
|
backgroundColor: string;
|
|
@@ -17,4 +15,14 @@ export interface UseBlackHoleOptions {
|
|
|
17
15
|
glowingStars: boolean;
|
|
18
16
|
starGlowBlur: number;
|
|
19
17
|
}
|
|
20
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Relativistic beaming: gas moving toward the viewer is boosted, receding
|
|
20
|
+
* gas dims. theta = orbital angle, 0 = the side swinging toward us.
|
|
21
|
+
*/
|
|
22
|
+
export declare function doppler(theta: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* Point-lens deflection of a background point at distance d from the hole:
|
|
25
|
+
* images are pushed outward by θE²/d. Returns null inside the shadow.
|
|
26
|
+
*/
|
|
27
|
+
export declare function lensOffset(d: number, einstein: number, shadow: number): number | null;
|
|
28
|
+
export declare function useBlackHole(options: UseBlackHoleOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCanvasProps } from '../../types';
|
|
2
2
|
|
|
3
|
-
type BoidsPreset = "default" | "birds" | "fish" | "swarm" | "neon";
|
|
3
|
+
type BoidsPreset = "default" | "birds" | "fish" | "swarm" | "neon" | "monochrome";
|
|
4
4
|
interface BoidsPresetValues {
|
|
5
5
|
count?: number;
|
|
6
6
|
maxSpeed?: number;
|
|
@@ -38,7 +38,7 @@ export interface BoidsProps extends BaseCanvasProps {
|
|
|
38
38
|
alignmentForce?: number;
|
|
39
39
|
/** Cohesion steering force. (default: 0.03) */
|
|
40
40
|
cohesionForce?: number;
|
|
41
|
-
/** Boid and trail color. (default: "#
|
|
41
|
+
/** Boid and trail color. (default: "#0891B2") */
|
|
42
42
|
color?: string;
|
|
43
43
|
/** Trail history length in frames. (default: 8) */
|
|
44
44
|
trailLength?: number;
|
|
@@ -46,7 +46,7 @@ export interface BoidsProps extends BaseCanvasProps {
|
|
|
46
46
|
trailOpacity?: number;
|
|
47
47
|
/** Boid triangle size in px. (default: 6) */
|
|
48
48
|
boidSize?: number;
|
|
49
|
-
/** Canvas background color. (default: "#
|
|
49
|
+
/** Canvas background color. (default: "#030d1a") */
|
|
50
50
|
backgroundColor?: string;
|
|
51
51
|
/** Boids flee from mouse cursor. (default: true) */
|
|
52
52
|
interactive?: boolean;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
|
|
3
1
|
export interface UseBoidsOptions {
|
|
4
2
|
count: number;
|
|
5
3
|
maxSpeed: number;
|
|
@@ -19,4 +17,25 @@ export interface UseBoidsOptions {
|
|
|
19
17
|
mouseForce: number;
|
|
20
18
|
wrapEdges: boolean;
|
|
21
19
|
}
|
|
22
|
-
export
|
|
20
|
+
export interface Boid {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
vx: number;
|
|
24
|
+
vy: number;
|
|
25
|
+
/** 0.6 (far) .. 1 (near): size, brightness. */
|
|
26
|
+
z: number;
|
|
27
|
+
flap: number;
|
|
28
|
+
bank: number;
|
|
29
|
+
/** Panic level 0..1; spreads to neighbours (murmuration ripple). */
|
|
30
|
+
fear: number;
|
|
31
|
+
wander: number;
|
|
32
|
+
trail: number[];
|
|
33
|
+
}
|
|
34
|
+
/** Boids only see neighbours within ~270° ahead of them (blind spot behind). */
|
|
35
|
+
export declare function canSee(b: Boid, dx: number, dy: number): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Reynolds' three rules over the neighbours in view, plus fear propagation.
|
|
38
|
+
* Returns the steering acceleration. Pure: no canvas, testable.
|
|
39
|
+
*/
|
|
40
|
+
export declare function steer(b: Boid, neighbours: readonly Boid[], o: UseBoidsOptions): [number, number, number];
|
|
41
|
+
export declare function useBoids(options: UseBoidsOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCanvasProps } from '../../types';
|
|
2
2
|
|
|
3
|
-
type BubbleUniversePreset = "default" | "soap" | "neon" | "deep" | "minimal";
|
|
3
|
+
type BubbleUniversePreset = "default" | "soap" | "neon" | "deep" | "minimal" | "monochrome";
|
|
4
4
|
export interface BubbleUniverseProps extends BaseCanvasProps {
|
|
5
5
|
/** Number of simultaneous bubbles (default: 15) */
|
|
6
6
|
bubbleCount?: number;
|
|
@@ -8,13 +8,13 @@ export interface BubbleUniverseProps extends BaseCanvasProps {
|
|
|
8
8
|
minRadius?: number;
|
|
9
9
|
/** Maximum bubble radius in px (default: 50) */
|
|
10
10
|
maxRadius?: number;
|
|
11
|
-
/** Canvas background (default: "#
|
|
11
|
+
/** Canvas background (default: "#050a12") */
|
|
12
12
|
backgroundColor?: string;
|
|
13
13
|
/** Specular highlight color (default: "#ffffff") */
|
|
14
14
|
shimmerColor?: string;
|
|
15
15
|
/** Click to pop bubbles with particle burst (default: true) */
|
|
16
16
|
popEffect?: boolean;
|
|
17
|
-
/**
|
|
17
|
+
/** Pull on the bubbles against their buoyancy; below 0.03 they rise, above it they sink (default: 0.02) */
|
|
18
18
|
gravity?: number;
|
|
19
19
|
/** Velocity friction per frame (default: 0.995) */
|
|
20
20
|
friction?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCanvasProps } from '../../types';
|
|
2
2
|
|
|
3
|
-
type ButterflySwarmPreset = "default" | "monarch" | "morpho" | "meadow" | "night";
|
|
3
|
+
type ButterflySwarmPreset = "default" | "monarch" | "morpho" | "meadow" | "night" | "monochrome";
|
|
4
4
|
interface ButterflySwarmPresetValues {
|
|
5
5
|
wingColor?: string;
|
|
6
6
|
patternColor?: string;
|
|
@@ -10,11 +10,11 @@ export declare const PRESETS: Record<ButterflySwarmPreset, ButterflySwarmPresetV
|
|
|
10
10
|
export interface ButterflySwarmProps extends BaseCanvasProps {
|
|
11
11
|
/** Number of butterflies (default: 12) */
|
|
12
12
|
butterflyCount?: number;
|
|
13
|
-
/** Primary wing color (default: "#
|
|
13
|
+
/** Primary wing color (default: "#e06010") */
|
|
14
14
|
wingColor?: string;
|
|
15
15
|
/** Wing pattern and body color (default: "#111111") */
|
|
16
16
|
patternColor?: string;
|
|
17
|
-
/** Canvas background (default: "#
|
|
17
|
+
/** Canvas background (default: "#0a0800") */
|
|
18
18
|
backgroundColor?: string;
|
|
19
19
|
/** Wing flap speed multiplier (default: 1) */
|
|
20
20
|
flapSpeed?: number;
|