own-the-canvas 2.0.1 → 2.0.2
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 +23 -0
- package/README.md +5 -7
- package/lib/components/AuroraBorealis/AuroraBorealis.d.ts +5 -3
- package/lib/components/AuroraBorealis/useAuroraBorealis.d.ts +14 -3
- package/lib/components/ButterflySwarm/useButterflySwarm.d.ts +7 -0
- package/lib/components/Candle/Candle.d.ts +35 -0
- package/lib/components/Candle/index.d.ts +2 -0
- package/lib/components/Candle/useCandle.d.ts +18 -0
- package/lib/components/Cat/Cat.d.ts +42 -0
- package/lib/components/Cat/index.d.ts +2 -0
- package/lib/components/Cat/useCat.d.ts +22 -0
- package/lib/components/Eye/Eye.d.ts +46 -0
- package/lib/components/Eye/index.d.ts +3 -0
- package/lib/components/Eye/useEye.d.ts +29 -0
- package/lib/components/Fireworks/Fireworks.d.ts +2 -0
- package/lib/components/Fireworks/useFireworks.d.ts +1 -0
- package/lib/components/FluidSimulation/useFluidSimulation.d.ts +9 -3
- package/lib/components/GameOfLife/GameOfLife.d.ts +2 -2
- package/lib/components/GameOfLife/useGameOfLife.d.ts +10 -1
- package/lib/components/Hummingbird/Hummingbird.d.ts +43 -0
- package/lib/components/Hummingbird/index.d.ts +2 -0
- package/lib/components/Hummingbird/useHummingbird.d.ts +35 -0
- package/lib/components/Jellyfish/Jellyfish.d.ts +37 -0
- package/lib/components/Jellyfish/index.d.ts +2 -0
- package/lib/components/Jellyfish/useJellyfish.d.ts +20 -0
- package/lib/components/KoiPond/KoiPond.d.ts +2 -2
- package/lib/components/KoiPond/useKoiPond.d.ts +10 -3
- package/lib/components/Komorebi/Komorebi.d.ts +34 -0
- package/lib/components/Komorebi/index.d.ts +2 -0
- package/lib/components/Komorebi/useKomorebi.d.ts +22 -0
- package/lib/components/Lightning/Lightning.d.ts +1 -1
- package/lib/components/Lightning/useLightning.d.ts +7 -0
- package/lib/components/Octopus/Octopus.d.ts +44 -0
- package/lib/components/Octopus/index.d.ts +2 -0
- package/lib/components/Octopus/useOctopus.d.ts +35 -0
- package/lib/components/Owl/Owl.d.ts +48 -0
- package/lib/components/Owl/index.d.ts +2 -0
- package/lib/components/Owl/useOwl.d.ts +29 -0
- package/lib/components/Rain/Rain.d.ts +2 -0
- package/lib/components/Rain/useRain.d.ts +1 -0
- package/lib/components/ReactionDiffusion/ReactionDiffusion.d.ts +1 -1
- package/lib/components/ReactionDiffusion/useReactionDiffusion.d.ts +9 -3
- package/lib/components/Snail/Snail.d.ts +38 -0
- package/lib/components/Snail/index.d.ts +2 -0
- package/lib/components/Snail/useSnail.d.ts +21 -0
- package/lib/components/SpiderWeb/SpiderWeb.d.ts +4 -0
- package/lib/components/SpiderWeb/useSpiderWeb.d.ts +3 -0
- package/lib/components/Starfield/useStarfield.d.ts +10 -3
- package/lib/components/Sunflowers/Sunflowers.d.ts +36 -0
- package/lib/components/Sunflowers/index.d.ts +2 -0
- package/lib/components/Sunflowers/useSunflowers.d.ts +23 -0
- package/lib/components/TidePool/TidePool.d.ts +32 -0
- package/lib/components/TidePool/index.d.ts +2 -0
- package/lib/components/TidePool/useTidePool.d.ts +21 -0
- package/lib/components/WaveInterference/WaveInterference.d.ts +2 -0
- package/lib/components/WaveInterference/useWaveInterference.d.ts +20 -3
- package/lib/index.cjs.js +1 -1
- package/lib/index.d.ts +22 -6
- package/lib/index.es.js +11154 -9467
- package/lib/runtime/caustics.d.ts +16 -0
- package/package.json +1 -1
- package/lib/components/DeepSeaBioluminescence/DeepSeaBioluminescence.d.ts +0 -29
- package/lib/components/DeepSeaBioluminescence/index.d.ts +0 -2
- package/lib/components/DeepSeaBioluminescence/useDeepSeaBioluminescence.d.ts +0 -18
- package/lib/components/FrostGlass/FrostGlass.d.ts +0 -33
- package/lib/components/FrostGlass/index.d.ts +0 -2
- package/lib/components/FrostGlass/useFrostGlass.d.ts +0 -38
- package/lib/components/LSystem/LSystem.d.ts +0 -33
- package/lib/components/LSystem/index.d.ts +0 -2
- package/lib/components/LSystem/useLSystem.d.ts +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [2.0.2] - 2026-11-06
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- 11 new Living Scenes on the shared runtime: `Eye`, `Owl`, `Octopus`, `Hummingbird`, `Candle`, `Cat`, `Jellyfish`, `Snail`, `Sunflowers`, `Komorebi`, `TidePool`. `Owl`, `Octopus`, `Hummingbird`, `Cat`, `Jellyfish`, and `Snail` support `collide`.
|
|
12
|
+
|
|
13
|
+
### Improved
|
|
14
|
+
|
|
15
|
+
- `KoiPond` is rebuilt: koi swim on a 12-point spine with a full silhouette, painted patches, flapping pectoral fins and a butterfly tail, each casting a shadow on the pond floor; lily pads have veins and waterlilies and drift on the ripples. Tap to drop food and the koi race to eat it.
|
|
16
|
+
- `AuroraBorealis` draws real curtains: vertical ray striations with a sharp hem fading upward into a second color, brightest where they fold, over a mountain lake that mirrors them. New `interactive` prop (default `true`): the cursor brightens nearby curtains, a tap sets off a substorm.
|
|
17
|
+
- `Starfield` (2D) is a deep-sky vista: a Milky Way band with star clouds, dust lanes and nebulae, three parallax layers of temperature-tinted stars that shift with the cursor, diffraction spikes on bright stars and tapered meteors. 3D warp streaks stars and the cursor steers the vanishing point.
|
|
18
|
+
- `GameOfLife` cells glow: they swell in at birth, cool with age, leave fading embers, and cross-fade between generations under a bloom. Dragging paints life, and a settled board is stirred with gliders.
|
|
19
|
+
- `ReactionDiffusion` lets feed and kill rates drift across the canvas so pattern types coexist and keep morphing; hovering seeds chemical, and a dead field reseeds itself.
|
|
20
|
+
- `FluidSimulation` uses square cells at any aspect ratio, vorticity confinement for crisp eddies, orbiting ink jets so it is never blank, and tone-mapped ink with a relief sheen.
|
|
21
|
+
- `WaveInterference` renders a lit water surface (diffuse plus specular glint) with glowing sources. New `interactive` prop (default `true`): drag sources to move them, and the hovering cursor stirs its own ripples.
|
|
22
|
+
- All seven now run on the shared canvas runtime (pause offscreen, reduced motion, DPR cap, window-level pointer).
|
|
23
|
+
|
|
24
|
+
### Removed (breaking)
|
|
25
|
+
|
|
26
|
+
- `DeepSeaBioluminescence` (use `Jellyfish`), `FrostGlass`, and `LSystem`.
|
|
27
|
+
|
|
5
28
|
## [2.0.1] - 2026-11-01
|
|
6
29
|
|
|
7
30
|
Docs-only release so the npm page shows the 2.0 README.
|
package/README.md
CHANGED
|
@@ -94,7 +94,6 @@ What each DOM-aware effect does with marked elements:
|
|
|
94
94
|
| `Dandelion` | Blown seeds parachute down and settle on elements |
|
|
95
95
|
| `PaperLanterns` | Clicking a marked element releases a lantern from it |
|
|
96
96
|
| `SnowDrift` | Snow piles up on top edges and spills off the sides |
|
|
97
|
-
| `FrostGlass` | Frost nucleates on element edges and grows outward |
|
|
98
97
|
| `OrigamiCranes` | Paper cranes land and rest with wings folded |
|
|
99
98
|
| `SeasonsTree` | Falling autumn leaves and petals settle on elements |
|
|
100
99
|
|
|
@@ -168,7 +167,7 @@ import { MatrixRain } from "own-the-canvas";
|
|
|
168
167
|
|
|
169
168
|
### KoiPond
|
|
170
169
|
|
|
171
|
-
|
|
170
|
+
A koi pond from above: koi on flexible spines with painted patches, fins and trailing tails cast shadows on the pond floor under drifting caustics, and lily pads (some flowering) float on the ripples. Move the cursor to ripple the water; tap to drop food and the koi race to eat it.
|
|
172
171
|
|
|
173
172
|
**Presets:** `default · koi · night · lotus · neon · monochrome`
|
|
174
173
|
|
|
@@ -184,13 +183,13 @@ import { KoiPond } from "own-the-canvas";
|
|
|
184
183
|
| `fishColor` | `string` | `"#ff6030"` | Fish body color |
|
|
185
184
|
| `showLilies` | `boolean` | `true` | Render floating lily pads |
|
|
186
185
|
| `caustics` | `boolean` | `true` | Caustic light shimmer |
|
|
187
|
-
| `interactive` | `boolean` | `true` |
|
|
186
|
+
| `interactive` | `boolean` | `true` | Cursor ripples; tap to feed the koi |
|
|
188
187
|
|
|
189
188
|
---
|
|
190
189
|
|
|
191
190
|
### FluidSimulation
|
|
192
191
|
|
|
193
|
-
|
|
192
|
+
Ink in water: a stable-fluids solver with vorticity confinement on square cells at any aspect ratio. Three slow ink jets keep it marbling untouched; move the cursor to drag ink and current, tap to blow a ring outward.
|
|
194
193
|
|
|
195
194
|
**Presets:** `default · ink · neon · lava · ocean · smoke · monochrome`
|
|
196
195
|
|
|
@@ -209,7 +208,7 @@ import { FluidSimulation } from "own-the-canvas";
|
|
|
209
208
|
| `resolution` | `number` | `80` | Grid resolution 32–128 |
|
|
210
209
|
| `inkColors` | `string[]` | `["#0c4a6e", "#0891B2", "#06b6d4", "#67e8f9"]` | Ink colors |
|
|
211
210
|
| `viscosity` | `number` | `0.0001` | Fluid viscosity |
|
|
212
|
-
| `autoInk` | `boolean` | `true` |
|
|
211
|
+
| `autoInk` | `boolean` | `true` | Orbiting ink jets plus timed bursts |
|
|
213
212
|
| `mouseForce` | `number` | `5` | Mouse velocity force multiplier |
|
|
214
213
|
|
|
215
214
|
---
|
|
@@ -343,7 +342,6 @@ Nature effects with real models underneath, built for hero sections. Each one ru
|
|
|
343
342
|
| `PaperLanterns` ✦ | Sky lanterns rising with depth and flicker; click a button to release one from it |
|
|
344
343
|
| `KelpForest` | Swaying kelp, schooling fish, and surface light; the cursor pushes the water |
|
|
345
344
|
| `SnowDrift` ✦ | Snow that piles up on your headline and buttons, then slides off the edges |
|
|
346
|
-
| `FrostGlass` ✦ | Frost crystals creep across the glass; the cursor is warm breath that melts them |
|
|
347
345
|
| `OrigamiCranes` ✦ | Faceted paper cranes in 3D that bank, flap, and land on your elements |
|
|
348
346
|
| `SeasonsTree` ✦ | A swaying tree living through spring, summer, autumn, and winter |
|
|
349
347
|
| `InkMountains` | Ink-wash ridgelines dissolving into drifting mist, with parallax |
|
|
@@ -357,7 +355,7 @@ Nature effects with real models underneath, built for hero sections. Each one ru
|
|
|
357
355
|
|
|
358
356
|
## More Components
|
|
359
357
|
|
|
360
|
-
> AntColony · AuroraBorealis · BlackHole · Boids · ButterflySwarm · Confetti · CrystalGrowth ·
|
|
358
|
+
> AntColony · AuroraBorealis · BlackHole · Boids · ButterflySwarm · Confetti · CrystalGrowth · DiffusionAggregation · Fireworks · GalaxySpiral · GameOfLife · Kaleidoscope · Lightning · MagneticField · Mandala · Metaballs · NeuralWeb · NoiseGradient · ParticleField · PendulaWave · ReactionDiffusion · SakuraBlossom · SandSimulation · SlimeMold · SolarFlare · SpiderWeb · Spirograph · Starfield · TornadoVortex · VoronoiCells · WatercolorBloom · WaveInterference
|
|
361
359
|
|
|
362
360
|
Full docs, live previews, and interactive playground:
|
|
363
361
|
|
|
@@ -15,18 +15,20 @@ export interface AuroraBorealisProps extends BaseCanvasProps {
|
|
|
15
15
|
speed?: number;
|
|
16
16
|
/** Band brightness/opacity 0–1 (default: 0.8) */
|
|
17
17
|
intensity?: number;
|
|
18
|
-
/** Number of aurora
|
|
18
|
+
/** Number of aurora curtains (default: 5) */
|
|
19
19
|
layers?: number;
|
|
20
20
|
/** Sky background color (default: "#050a0f") */
|
|
21
21
|
backgroundColor?: string;
|
|
22
|
-
/**
|
|
22
|
+
/** How far the curtains fold, as a fraction of the sky height (default: 0.15) */
|
|
23
23
|
waveAmplitude?: number;
|
|
24
|
-
/**
|
|
24
|
+
/** Folds across the width (default: 2) */
|
|
25
25
|
waveFrequency?: number;
|
|
26
26
|
/** Background star count (default: 80) */
|
|
27
27
|
starCount?: number;
|
|
28
28
|
/** Enable animation (default: true) */
|
|
29
29
|
animated?: boolean;
|
|
30
|
+
/** The cursor brightens the curtains near it; a tap sets off a substorm surge (default: true) */
|
|
31
|
+
interactive?: boolean;
|
|
30
32
|
/** Named preset */
|
|
31
33
|
preset?: AuroraBorealisPreset | string;
|
|
32
34
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
|
|
3
1
|
export interface UseAuroraBorealisOptions {
|
|
4
2
|
colors: string[];
|
|
5
3
|
speed: number;
|
|
@@ -10,5 +8,18 @@ export interface UseAuroraBorealisOptions {
|
|
|
10
8
|
waveFrequency: number;
|
|
11
9
|
starCount: number;
|
|
12
10
|
animated: boolean;
|
|
11
|
+
interactive: boolean;
|
|
13
12
|
}
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Curtain light at height `d` above the curtain's lower hem (d < 0 is below it), for a curtain of
|
|
15
|
+
* ray height `hgt`: a razor-sharp lower edge and a long exponential glow upward, as in real aurora.
|
|
16
|
+
*/
|
|
17
|
+
export declare function curtainProfile(d: number, hgt: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* Northern lights over a mountain lake. Each layer is a folding curtain of vertical rays: a
|
|
20
|
+
* sharp bright hem that fades upward into a second color, brighter where the curtain folds back
|
|
21
|
+
* on itself, rippling slowly along its length. Built in a small light buffer, added onto a
|
|
22
|
+
* starry sky and mirrored in the lake below. The cursor brightens the curtains near it; a tap
|
|
23
|
+
* sets off a substorm surge.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useAuroraBorealis(options: UseAuroraBorealisOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -11,4 +11,11 @@ export interface UseButterflySwarmOptions {
|
|
|
11
11
|
interactive: boolean;
|
|
12
12
|
showTrails: boolean;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* A drifting swarm of butterflies. Each one has a forewing and hindwing with dusky roots,
|
|
16
|
+
* veins, a dark margin and a row of pale spots; the wings fold in perspective as they beat
|
|
17
|
+
* (fast downstroke, the odd open-winged glide), and the flutter makes the flight bob and
|
|
18
|
+
* wander. Near butterflies are larger and brighter than far ones. They drift toward a slow
|
|
19
|
+
* cursor and scatter from a fast one. Soft out-of-focus light fills the background.
|
|
20
|
+
*/
|
|
14
21
|
export declare function useButterflySwarm(canvasRef: RefObject<HTMLCanvasElement | null>, options: UseButterflySwarmOptions): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type CandlePreset = "default" | "ivory" | "rose" | "obsidian" | "spirit" | "monochrome";
|
|
4
|
+
interface CandlePresetValues {
|
|
5
|
+
flameColor?: string;
|
|
6
|
+
coreColor?: string;
|
|
7
|
+
waxColor?: string;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
glowIntensity?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const PRESETS: Record<CandlePreset, CandlePresetValues>;
|
|
12
|
+
export interface CandleProps extends BaseCanvasProps {
|
|
13
|
+
/** Outer flame and light color (default: "#ff9a3c") */
|
|
14
|
+
flameColor?: string;
|
|
15
|
+
/** White-hot inner flame color (default: "#fff3d1") */
|
|
16
|
+
coreColor?: string;
|
|
17
|
+
/** Wax color (default: "#efe2cc") */
|
|
18
|
+
waxColor?: string;
|
|
19
|
+
/** Room color; "transparent" keeps only the candle and its light (default: "#0b0705") */
|
|
20
|
+
backgroundColor?: string;
|
|
21
|
+
/** Candle scale (default: 1) */
|
|
22
|
+
size?: number;
|
|
23
|
+
/** Pillar height, 0.1–1.2 (default: 0.6) */
|
|
24
|
+
candleHeight?: number;
|
|
25
|
+
/** How restless the flame is, 0–3 (default: 1) */
|
|
26
|
+
flicker?: number;
|
|
27
|
+
/** Strength of the light cast on the room, 0–3 (default: 1) */
|
|
28
|
+
glowIntensity?: number;
|
|
29
|
+
/** Cursor drafts bend the flame; click snuffs and relights it (default: true) */
|
|
30
|
+
interactive?: boolean;
|
|
31
|
+
/** Named preset: "default" | "ivory" | "rose" | "obsidian" | "spirit" | "monochrome" */
|
|
32
|
+
preset?: CandlePreset | string;
|
|
33
|
+
}
|
|
34
|
+
export declare const Candle: import('react').ForwardRefExoticComponent<CandleProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface UseCandleOptions {
|
|
2
|
+
flameColor: string;
|
|
3
|
+
coreColor: string;
|
|
4
|
+
waxColor: string;
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
size: number;
|
|
7
|
+
candleHeight: number;
|
|
8
|
+
flicker: number;
|
|
9
|
+
glowIntensity: number;
|
|
10
|
+
interactive: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A single pillar candle in a dark room. The flame is layered light (halo, body, white-hot
|
|
14
|
+
* core, blue base) that breathes and flickers, leans into drafts from the cursor with a
|
|
15
|
+
* springy wobble, and lights the molten pool, the translucent wax and the table around it.
|
|
16
|
+
* Click to snuff it: the wick smoulders and a thread of smoke curls up, then it relights.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useCandle(options: UseCandleOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type CatPreset = "default" | "tuxedo" | "siamese" | "grey" | "midnight" | "monochrome";
|
|
4
|
+
interface CatPresetValues {
|
|
5
|
+
furColor?: string;
|
|
6
|
+
stripeColor?: string;
|
|
7
|
+
bellyColor?: string;
|
|
8
|
+
eyeColor?: string;
|
|
9
|
+
cushionColor?: string;
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const PRESETS: Record<CatPreset, CatPresetValues>;
|
|
13
|
+
export interface CatProps extends BaseCanvasProps {
|
|
14
|
+
/** Main coat color (default: "#d9822b") */
|
|
15
|
+
furColor?: string;
|
|
16
|
+
/** Tabby stripes, tail bands and tail tip (default: "#8f4a16") */
|
|
17
|
+
stripeColor?: string;
|
|
18
|
+
/** Chest, muzzle and paws (default: "#f4dcc0") */
|
|
19
|
+
bellyColor?: string;
|
|
20
|
+
/** Iris color, seen when it opens an eye (default: "#9cc23a") */
|
|
21
|
+
eyeColor?: string;
|
|
22
|
+
/** Cushion color (default: "#7a2f3d") */
|
|
23
|
+
cushionColor?: string;
|
|
24
|
+
/** Room color; "transparent" drops the scene (default: "#140f16") */
|
|
25
|
+
backgroundColor?: string;
|
|
26
|
+
/** Cat scale (default: 1) */
|
|
27
|
+
size?: number;
|
|
28
|
+
/** Ears flick at nearby movement and an eye cracks open to watch the cursor (default: true) */
|
|
29
|
+
followCursor?: boolean;
|
|
30
|
+
/** Hover slowly to pet (it purrs and kneads); tap to startle it awake (default: true) */
|
|
31
|
+
interactive?: boolean;
|
|
32
|
+
/** Fixed full-viewport, click-through layer over the page (default: false) */
|
|
33
|
+
overlay?: boolean;
|
|
34
|
+
/** Nap on top of an element marked `data-otc-solid` instead of a cushion (default: false) */
|
|
35
|
+
collide?: boolean;
|
|
36
|
+
/** Overlay z-index (default: 10) */
|
|
37
|
+
zIndex?: number;
|
|
38
|
+
/** Named preset: "default" | "tuxedo" | "siamese" | "grey" | "midnight" | "monochrome" */
|
|
39
|
+
preset?: CatPreset | string;
|
|
40
|
+
}
|
|
41
|
+
export declare const Cat: import('react').ForwardRefExoticComponent<CatProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface UseCatOptions {
|
|
2
|
+
furColor: string;
|
|
3
|
+
stripeColor: string;
|
|
4
|
+
bellyColor: string;
|
|
5
|
+
eyeColor: string;
|
|
6
|
+
cushionColor: string;
|
|
7
|
+
backgroundColor: string;
|
|
8
|
+
size: number;
|
|
9
|
+
followCursor: boolean;
|
|
10
|
+
interactive: boolean;
|
|
11
|
+
overlay: boolean;
|
|
12
|
+
collide: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Is (x, y) on the curled body? Body-local units of S, origin at the cat's feet. */
|
|
15
|
+
export declare function onCat(x: number, y: number): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A cat asleep, curled nose-to-tail on a cushion. It breathes, dreams (tail tip and whiskers
|
|
18
|
+
* twitch), flicks an ear at nearby movement and cracks one eye open to watch the cursor. Hover
|
|
19
|
+
* slowly over it to pet it: it purrs and kneads. Tap it and it startles awake, then settles
|
|
20
|
+
* back to sleep. With `collide` it naps on top of a `data-otc-solid` element instead.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useCat(options: UseCatOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
import { EyePupilShape } from './useEye';
|
|
3
|
+
|
|
4
|
+
type EyePreset = "default" | "ocean" | "amber" | "violet" | "serpent" | "monochrome";
|
|
5
|
+
interface EyePresetValues {
|
|
6
|
+
irisColor?: string;
|
|
7
|
+
irisInnerColor?: string;
|
|
8
|
+
scleraColor?: string;
|
|
9
|
+
skinColor?: string;
|
|
10
|
+
lashColor?: string;
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
pupilShape?: EyePupilShape;
|
|
13
|
+
pupilSize?: number;
|
|
14
|
+
showLashes?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const PRESETS: Record<EyePreset, EyePresetValues>;
|
|
17
|
+
export interface EyeProps extends BaseCanvasProps {
|
|
18
|
+
/** Outer iris color (default: "#4a7c59") */
|
|
19
|
+
irisColor?: string;
|
|
20
|
+
/** Color of the ring around the pupil (default: "#c8963e") */
|
|
21
|
+
irisInnerColor?: string;
|
|
22
|
+
/** Color of the white of the eye (default: "#f1ebe4") */
|
|
23
|
+
scleraColor?: string;
|
|
24
|
+
/** Eyelid and face skin color (default: "#c99a7e") */
|
|
25
|
+
skinColor?: string;
|
|
26
|
+
/** Lash and lash-line color (default: "#1a1210") */
|
|
27
|
+
lashColor?: string;
|
|
28
|
+
/** Canvas background; "transparent" lets the face fade into the page (default: "#0c0807") */
|
|
29
|
+
backgroundColor?: string;
|
|
30
|
+
/** "round" or a reptile-like "slit" pupil (default: "round") */
|
|
31
|
+
pupilShape?: EyePupilShape;
|
|
32
|
+
/** Resting pupil size as a fraction of the iris, 0.08–0.85 (default: 0.38) */
|
|
33
|
+
pupilSize?: number;
|
|
34
|
+
/** Eye scale relative to the canvas, 0.2–1.5 (default: 1) */
|
|
35
|
+
eyeSize?: number;
|
|
36
|
+
/** Gaze follows the cursor anywhere on the page and the pupil narrows as it nears; off = the eye looks around on its own (default: true) */
|
|
37
|
+
followCursor?: boolean;
|
|
38
|
+
/** Average ms between blinks; 0 = only blink when clicked (default: 4000) */
|
|
39
|
+
blinkInterval?: number;
|
|
40
|
+
/** Draw eyelashes (default: true) */
|
|
41
|
+
showLashes?: boolean;
|
|
42
|
+
/** Named preset: "default" | "ocean" | "amber" | "violet" | "serpent" | "monochrome" */
|
|
43
|
+
preset?: EyePreset | string;
|
|
44
|
+
}
|
|
45
|
+
export declare const Eye: import('react').ForwardRefExoticComponent<EyeProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
export type EyePupilShape = "round" | "slit";
|
|
4
|
+
export interface UseEyeOptions {
|
|
5
|
+
irisColor: string;
|
|
6
|
+
irisInnerColor: string;
|
|
7
|
+
scleraColor: string;
|
|
8
|
+
skinColor: string;
|
|
9
|
+
lashColor: string;
|
|
10
|
+
backgroundColor: string;
|
|
11
|
+
pupilShape: EyePupilShape;
|
|
12
|
+
pupilSize: number;
|
|
13
|
+
eyeSize: number;
|
|
14
|
+
followCursor: boolean;
|
|
15
|
+
blinkInterval: number;
|
|
16
|
+
showLashes: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Blink closure 0..1 at `s` seconds into a blink: fast close, brief hold, slower open. */
|
|
19
|
+
export declare function blinkClosure(s: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* A single living eye, painted like a chiaroscuro portrait: skin falls away into darkness
|
|
22
|
+
* around an almond-shaped opening. The iris is a baked texture of radial stroma fibres,
|
|
23
|
+
* a pale collarette, crypts and a dark limbal ring; the pupil breathes (hippus), narrows
|
|
24
|
+
* as the cursor (the light) approaches and widens when startled. The gaze moves in
|
|
25
|
+
* saccades with tiny microsaccades, the upper lid rides with it, the lashes follow the
|
|
26
|
+
* lid through each blink, and the wet cornea holds a fixed window reflection.
|
|
27
|
+
* Click to make it blink.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useEye(canvasRef: RefObject<HTMLCanvasElement | null>, options: UseEyeOptions): void;
|
|
@@ -43,6 +43,8 @@ export interface FireworksProps extends BaseCanvasProps {
|
|
|
43
43
|
glowBlur?: number;
|
|
44
44
|
/** Canvas background (default: "#04060f") */
|
|
45
45
|
backgroundColor?: string;
|
|
46
|
+
/** Draw the night scene (sky, stars, burst glow, skyline). false = fireworks only, over a plain backgroundColor fill ("transparent" to overlay). (default: true) */
|
|
47
|
+
showBackground?: boolean;
|
|
46
48
|
/** Shell upward speed (default: 12) */
|
|
47
49
|
shellSpeed?: number;
|
|
48
50
|
/** Number of background stars (default: 0) */
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
|
|
3
1
|
export interface UseFluidSimulationOptions {
|
|
4
2
|
resolution: number;
|
|
5
3
|
viscosity: number;
|
|
@@ -14,4 +12,12 @@ export interface UseFluidSimulationOptions {
|
|
|
14
12
|
mouseForce: number;
|
|
15
13
|
inkRadius: number;
|
|
16
14
|
}
|
|
17
|
-
|
|
15
|
+
/** Semi-Lagrangian advection; velocities are in cells per second. */
|
|
16
|
+
export declare function advect(W: number, H: number, b: number, d: Float32Array, d0: Float32Array, u: Float32Array, v: Float32Array, dt: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Ink in water. Three slow ink jets orbit the canvas and bursts bloom on a timer, all cycling
|
|
19
|
+
* through the palette, so the field is always flowing and marbling even untouched. Moving the
|
|
20
|
+
* cursor drags ink and current behind it; a tap blows a ring outward. Ink is tone-mapped so
|
|
21
|
+
* overlapping colors mix rather than blow out, with a faint relief sheen on its folds.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useFluidSimulation(options: UseFluidSimulationOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -27,13 +27,13 @@ export interface GameOfLifeProps extends BaseCanvasProps {
|
|
|
27
27
|
aliveColor?: string;
|
|
28
28
|
/** Color of old cells. (default: "#004d14") */
|
|
29
29
|
oldColor?: string;
|
|
30
|
-
/**
|
|
30
|
+
/** Faint lattice dots marking dead cells. (default: "#000000") */
|
|
31
31
|
deadColor?: string;
|
|
32
32
|
/** Color cells by generation age. (default: true) */
|
|
33
33
|
showAge?: boolean;
|
|
34
34
|
/** Wrap cells at canvas edges. (default: true) */
|
|
35
35
|
wrapEdges?: boolean;
|
|
36
|
-
/** Click
|
|
36
|
+
/** Click toggles a cell, drag paints life. (default: true) */
|
|
37
37
|
interactive?: boolean;
|
|
38
38
|
/** Canvas background color. (default: "#000000") */
|
|
39
39
|
backgroundColor?: string;
|
|
@@ -20,4 +20,13 @@ export interface UseGameOfLifeOptions {
|
|
|
20
20
|
interactive: boolean;
|
|
21
21
|
backgroundColor: string;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
/** One Conway generation. Cells hold their age (0 = dead, 1 = newborn, capped at 255). */
|
|
24
|
+
export declare function stepLife(grid: Uint8Array, next: Uint8Array, cols: number, rows: number, wrap: boolean): number;
|
|
25
|
+
/**
|
|
26
|
+
* Conway's Game of Life as living light. Cells are soft glowing dots that swell in when born,
|
|
27
|
+
* cool from the newborn color to the old color as they age, and leave embers that fade when
|
|
28
|
+
* they die; generations cross-fade instead of snapping, under a bloom made from the board
|
|
29
|
+
* itself. Click toggles a cell, dragging paints life. When the board settles into still lifes
|
|
30
|
+
* and blinkers, a few gliders drift in to stir it up again.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useGameOfLife(options: UseGameOfLifeOptions, handleRef: RefObject<GameOfLifeHandle | null>): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type HummingbirdPreset = "default" | "ruby" | "violet" | "sunset" | "frost" | "monochrome";
|
|
4
|
+
interface HummingbirdPresetValues {
|
|
5
|
+
bodyColor?: string;
|
|
6
|
+
throatColor?: string;
|
|
7
|
+
bellyColor?: string;
|
|
8
|
+
flowerColor?: string;
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const PRESETS: Record<HummingbirdPreset, HummingbirdPresetValues>;
|
|
12
|
+
export interface HummingbirdProps extends BaseCanvasProps {
|
|
13
|
+
/** Iridescent back and head (default: "#2f9e6a") */
|
|
14
|
+
bodyColor?: string;
|
|
15
|
+
/** Gorget (throat patch) color; it flashes as the bird turns (default: "#ff2d6f") */
|
|
16
|
+
throatColor?: string;
|
|
17
|
+
/** Belly color (default: "#e9e4d4") */
|
|
18
|
+
bellyColor?: string;
|
|
19
|
+
/** Trumpet flower color (default: "#e8433a") */
|
|
20
|
+
flowerColor?: string;
|
|
21
|
+
/** Garden color; "transparent" drops the scene (default: "#0c1712") */
|
|
22
|
+
backgroundColor?: string;
|
|
23
|
+
/** Number of birds, 0–8 (default: 1) */
|
|
24
|
+
birdCount?: number;
|
|
25
|
+
/** Bird scale (default: 1) */
|
|
26
|
+
size?: number;
|
|
27
|
+
/** Dart speed multiplier (default: 1) */
|
|
28
|
+
speed?: number;
|
|
29
|
+
/** A slow cursor draws a bird over to look; a fast one scares it off (default: true) */
|
|
30
|
+
interactive?: boolean;
|
|
31
|
+
/** Draw the flowers (default: true) */
|
|
32
|
+
showFlowers?: boolean;
|
|
33
|
+
/** Fixed full-viewport, click-through layer over the page (default: false) */
|
|
34
|
+
overlay?: boolean;
|
|
35
|
+
/** Elements marked `data-otc-solid` become flowers; the hovered one is visited first (default: false) */
|
|
36
|
+
collide?: boolean;
|
|
37
|
+
/** Overlay z-index (default: 10) */
|
|
38
|
+
zIndex?: number;
|
|
39
|
+
/** Named preset: "default" | "ruby" | "violet" | "sunset" | "frost" | "monochrome" */
|
|
40
|
+
preset?: HummingbirdPreset | string;
|
|
41
|
+
}
|
|
42
|
+
export declare const Hummingbird: import('react').ForwardRefExoticComponent<HummingbirdProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Solid } from '../../runtime/physics';
|
|
2
|
+
|
|
3
|
+
export interface UseHummingbirdOptions {
|
|
4
|
+
bodyColor: string;
|
|
5
|
+
throatColor: string;
|
|
6
|
+
bellyColor: string;
|
|
7
|
+
flowerColor: string;
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
birdCount: number;
|
|
10
|
+
size: number;
|
|
11
|
+
speed: number;
|
|
12
|
+
interactive: boolean;
|
|
13
|
+
showFlowers: boolean;
|
|
14
|
+
overlay: boolean;
|
|
15
|
+
collide: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Somewhere a bird can feed: the beak tip goes to (x, y) while the bird faces `face`. */
|
|
18
|
+
export interface Nectar {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
face: 1 | -1;
|
|
22
|
+
key: string;
|
|
23
|
+
}
|
|
24
|
+
/** Feeding spots beside each solid's left and right edge, beak touching the edge. */
|
|
25
|
+
export declare function solidNectar(solids: readonly Solid[]): Nectar[];
|
|
26
|
+
/**
|
|
27
|
+
* Hummingbirds in a dusk garden. Wings beat too fast to see, so each stroke is drawn as a
|
|
28
|
+
* motion blur, densest at the ends where the wing turns, with a faint strobe of the wing
|
|
29
|
+
* itself. A bird darts between trumpet flowers, stops dead, fans its tail to brake, sips
|
|
30
|
+
* with a pumping motion and backs straight out before darting away; pollen puffs where it
|
|
31
|
+
* feeds and its gorget flashes as it turns. A slow cursor draws one over to inspect it, a
|
|
32
|
+
* fast one scares it off, and rival birds chase each other away from the flowers. With
|
|
33
|
+
* `collide`, `data-otc-solid` elements become flowers, and the hovered one is visited now.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useHummingbird(options: UseHummingbirdOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type JellyfishPreset = "default" | "sea-nettle" | "crystal" | "lions-mane" | "ghost" | "monochrome";
|
|
4
|
+
interface JellyfishPresetValues {
|
|
5
|
+
bellColor?: string;
|
|
6
|
+
glowColor?: string;
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
tentacleLength?: number;
|
|
9
|
+
count?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const PRESETS: Record<JellyfishPreset, JellyfishPresetValues>;
|
|
12
|
+
export interface JellyfishProps extends BaseCanvasProps {
|
|
13
|
+
/** Number of jellyfish (default: 4) */
|
|
14
|
+
count?: number;
|
|
15
|
+
/** Bell and oral-arm tint (default: "#c9a7e8") */
|
|
16
|
+
bellColor?: string;
|
|
17
|
+
/** Rim light, tentacles and flash color (default: "#8fd8ff") */
|
|
18
|
+
glowColor?: string;
|
|
19
|
+
/** Water color; "transparent" drops the scene (default: "#04122a") */
|
|
20
|
+
backgroundColor?: string;
|
|
21
|
+
/** Tentacle length multiplier (default: 1) */
|
|
22
|
+
tentacleLength?: number;
|
|
23
|
+
/** Bell pulse speed multiplier (default: 1) */
|
|
24
|
+
pulseRate?: number;
|
|
25
|
+
/** Jellies turn away from the cursor, which stirs the water; taps make them flash (default: true) */
|
|
26
|
+
interactive?: boolean;
|
|
27
|
+
/** Fixed full-viewport, click-through layer over the page (default: false) */
|
|
28
|
+
overlay?: boolean;
|
|
29
|
+
/** Nudge off elements marked `data-otc-solid` (default: false) */
|
|
30
|
+
collide?: boolean;
|
|
31
|
+
/** Overlay z-index (default: 10) */
|
|
32
|
+
zIndex?: number;
|
|
33
|
+
/** Named preset: "default" | "sea-nettle" | "crystal" | "lions-mane" | "ghost" | "monochrome" */
|
|
34
|
+
preset?: JellyfishPreset | string;
|
|
35
|
+
}
|
|
36
|
+
export declare const Jellyfish: import('react').ForwardRefExoticComponent<JellyfishProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface UseJellyfishOptions {
|
|
2
|
+
count: number;
|
|
3
|
+
bellColor: string;
|
|
4
|
+
glowColor: string;
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
tentacleLength: number;
|
|
7
|
+
pulseRate: number;
|
|
8
|
+
interactive: boolean;
|
|
9
|
+
overlay: boolean;
|
|
10
|
+
collide: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Bell contraction 0..1 over one pulse cycle: a quick squeeze, then a slow relax. */
|
|
13
|
+
export declare function pulse(phase: number): number;
|
|
14
|
+
/**
|
|
15
|
+
* Moon jellies in open water. Each bell pulses by jet propulsion (a quick squeeze that drives it
|
|
16
|
+
* forward, a slow relax), steering gently back upward, with verlet tentacles and frilled oral arms
|
|
17
|
+
* that trail and swirl in the wake. The cursor stirs the water and they turn away from it; a tap
|
|
18
|
+
* makes nearby bells flash. With `collide` they nudge off `data-otc-solid` elements.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useJellyfish(options: UseJellyfishOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -6,7 +6,7 @@ export interface KoiPondProps extends BaseCanvasProps {
|
|
|
6
6
|
fishCount?: number;
|
|
7
7
|
/** Primary fish body color (default: "#ff6030") */
|
|
8
8
|
fishColor?: string;
|
|
9
|
-
/**
|
|
9
|
+
/** Patch color of the markings; every third koi swaps body and patch (default: "#ffffff") */
|
|
10
10
|
scaleColor?: string;
|
|
11
11
|
/** Water background color (default: "#0a1520") */
|
|
12
12
|
waterColor?: string;
|
|
@@ -16,7 +16,7 @@ export interface KoiPondProps extends BaseCanvasProps {
|
|
|
16
16
|
lilyColor?: string;
|
|
17
17
|
/** Fish movement speed multiplier (default: 1) */
|
|
18
18
|
speed?: number;
|
|
19
|
-
/** Cursor
|
|
19
|
+
/** Cursor leaves ripples; tap to drop food the koi swim up to eat (default: true) */
|
|
20
20
|
interactive?: boolean;
|
|
21
21
|
/** Show lily pads (default: true) */
|
|
22
22
|
showLilies?: boolean;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
|
|
3
1
|
export interface UseKoiPondOptions {
|
|
4
2
|
fishCount: number;
|
|
5
3
|
fishColor: string;
|
|
@@ -12,4 +10,13 @@ export interface UseKoiPondOptions {
|
|
|
12
10
|
showLilies: boolean;
|
|
13
11
|
caustics: boolean;
|
|
14
12
|
}
|
|
15
|
-
|
|
13
|
+
/** Koi body half-width at u (0 = nose, 1 = tail root), as a fraction of body length. */
|
|
14
|
+
export declare function koiWidth(u: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* A koi pond from above. Koi swim on a flexible 12-point spine with a full silhouette, painted
|
|
17
|
+
* patches, flapping pectoral fins and a trailing butterfly tail, each casting a soft shadow on the
|
|
18
|
+
* pond floor below. Sunlight caustics wash over the bottom, lily pads (some flowering) float
|
|
19
|
+
* above the fish and drift on the ripples. The cursor leaves ripples; tap to drop a food pellet
|
|
20
|
+
* and the koi race up to eat it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useKoiPond(options: UseKoiPondOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|