own-the-canvas 2.0.0 → 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 +33 -1
- package/README.md +34 -17
- 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 +2 -2
- 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
|
@@ -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;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type KomorebiPreset = "default" | "morning" | "forest" | "golden-hour" | "moonlight" | "monochrome";
|
|
4
|
+
interface KomorebiPresetValues {
|
|
5
|
+
lightColor?: string;
|
|
6
|
+
shadowColor?: string;
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
sunHeight?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const PRESETS: Record<KomorebiPreset, KomorebiPresetValues>;
|
|
11
|
+
export interface KomorebiProps extends BaseCanvasProps {
|
|
12
|
+
/** Sunlight color (default: "#ffd9a0") */
|
|
13
|
+
lightColor?: string;
|
|
14
|
+
/** Leaf shade tint (default: "#3a4a3a") */
|
|
15
|
+
shadowColor?: string;
|
|
16
|
+
/** The wall the light falls on; "transparent" drops it (default: "#c9b49a") */
|
|
17
|
+
backgroundColor?: string;
|
|
18
|
+
/** Light spot density multiplier (default: 1) */
|
|
19
|
+
density?: number;
|
|
20
|
+
/** Canopy sway strength (default: 1) */
|
|
21
|
+
wind?: number;
|
|
22
|
+
/** Sun height 0..1: lower suns stretch the spots into ovals (default: 0.7) */
|
|
23
|
+
sunHeight?: number;
|
|
24
|
+
/** The cursor is a breeze that stirs the leaves; a tap sends a gust rippling out (default: true) */
|
|
25
|
+
interactive?: boolean;
|
|
26
|
+
/** Fixed full-viewport, click-through layer that dapples the page (default: false) */
|
|
27
|
+
overlay?: boolean;
|
|
28
|
+
/** Overlay z-index (default: 10) */
|
|
29
|
+
zIndex?: number;
|
|
30
|
+
/** Named preset: "default" | "morning" | "forest" | "golden-hour" | "moonlight" | "monochrome" */
|
|
31
|
+
preset?: KomorebiPreset | string;
|
|
32
|
+
}
|
|
33
|
+
export declare const Komorebi: import('react').ForwardRefExoticComponent<KomorebiProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface UseKomorebiOptions {
|
|
2
|
+
lightColor: string;
|
|
3
|
+
shadowColor: string;
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
density: number;
|
|
6
|
+
wind: number;
|
|
7
|
+
sunHeight: number;
|
|
8
|
+
interactive: boolean;
|
|
9
|
+
overlay: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Shape of each light spot: every gap in the canopy is a pinhole camera projecting the sun, so
|
|
13
|
+
* spots are discs stretched along the light direction as the sun gets lower.
|
|
14
|
+
*/
|
|
15
|
+
export declare function spotStretch(sunHeight: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Komorebi: sunlight filtering through leaves onto a wall. Light spots (pinhole images of the
|
|
18
|
+
* sun, stretched as it gets lower) open, close and drift as the unseen canopy sways, under the
|
|
19
|
+
* soft moving shadows of nearer leaves. Your cursor is a breeze that stirs the leaves around it;
|
|
20
|
+
* a tap sends a gust rippling outward. As an overlay it dapples the whole page.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useKomorebi(options: UseKomorebiOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -27,7 +27,7 @@ export interface LightningProps extends BaseCanvasProps {
|
|
|
27
27
|
branchChance?: number;
|
|
28
28
|
/** Energy multiplier for sub-branches. (default: 0.6) */
|
|
29
29
|
branchDecay?: number;
|
|
30
|
-
/**
|
|
30
|
+
/** Return strokes per strike: the same channel relights this many times. (default: 3) */
|
|
31
31
|
flickerCount?: number;
|
|
32
32
|
/** Glow shadow blur radius. (default: 20) */
|
|
33
33
|
glowBlur?: number;
|
|
@@ -16,4 +16,11 @@ export interface UseLightningOptions {
|
|
|
16
16
|
startY: number;
|
|
17
17
|
endY: number;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* A night thunderstorm. A low cloud deck drifts over dark hills; each strike starts as a
|
|
21
|
+
* faint stepped leader crawling down from the cloud base, then the return stroke slams the
|
|
22
|
+
* channel white-hot and lights the clouds from inside. The same channel restrikes a few
|
|
23
|
+
* times (flickerCount) before fading, while its forks die after the first stroke. Between
|
|
24
|
+
* strikes, sheet lightning glows inside the clouds. Click to strike at the cursor.
|
|
25
|
+
*/
|
|
19
26
|
export declare function useLightning(canvasRef: RefObject<HTMLCanvasElement | null>, options: UseLightningOptions): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type OctopusPreset = "default" | "blue-ringed" | "ghost" | "abyss" | "sand" | "monochrome";
|
|
4
|
+
interface OctopusPresetValues {
|
|
5
|
+
skinColor?: string;
|
|
6
|
+
spotColor?: string;
|
|
7
|
+
suckerColor?: string;
|
|
8
|
+
eyeColor?: string;
|
|
9
|
+
inkColor?: string;
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const PRESETS: Record<OctopusPreset, OctopusPresetValues>;
|
|
13
|
+
export interface OctopusProps extends BaseCanvasProps {
|
|
14
|
+
/** Skin color; it deepens when excited and blanches when startled (default: "#c4553a") */
|
|
15
|
+
skinColor?: string;
|
|
16
|
+
/** Chromatophore ring color; rings flare when excited (default: "#7a2a1c") */
|
|
17
|
+
spotColor?: string;
|
|
18
|
+
/** Sucker color (default: "#f2c4a8") */
|
|
19
|
+
suckerColor?: string;
|
|
20
|
+
/** Eye color (default: "#e8c25a") */
|
|
21
|
+
eyeColor?: string;
|
|
22
|
+
/** Ink cloud color (default: "#140b12") */
|
|
23
|
+
inkColor?: string;
|
|
24
|
+
/** Water color; "transparent" drops the scene (default: "#04131c") */
|
|
25
|
+
backgroundColor?: string;
|
|
26
|
+
/** Octopus scale (default: 1) */
|
|
27
|
+
size?: number;
|
|
28
|
+
/** Arm length multiplier (default: 1) */
|
|
29
|
+
tentacleLength?: number;
|
|
30
|
+
/** Swim toward the cursor and coil the nearest arms around it (default: true) */
|
|
31
|
+
followCursor?: boolean;
|
|
32
|
+
/** Tap to make it squirt ink and jet away (default: true) */
|
|
33
|
+
interactive?: boolean;
|
|
34
|
+
/** Fixed full-viewport, click-through layer over the page (default: false) */
|
|
35
|
+
overlay?: boolean;
|
|
36
|
+
/** Arms grab the edges of elements marked `data-otc-solid` (default: false) */
|
|
37
|
+
collide?: boolean;
|
|
38
|
+
/** Overlay z-index (default: 10) */
|
|
39
|
+
zIndex?: number;
|
|
40
|
+
/** Named preset: "default" | "blue-ringed" | "ghost" | "abyss" | "sand" | "monochrome" */
|
|
41
|
+
preset?: OctopusPreset | string;
|
|
42
|
+
}
|
|
43
|
+
export declare const Octopus: import('react').ForwardRefExoticComponent<OctopusProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Solid } from '../../runtime/physics';
|
|
2
|
+
|
|
3
|
+
export interface UseOctopusOptions {
|
|
4
|
+
skinColor: string;
|
|
5
|
+
spotColor: string;
|
|
6
|
+
suckerColor: string;
|
|
7
|
+
eyeColor: string;
|
|
8
|
+
inkColor: string;
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
size: number;
|
|
11
|
+
tentacleLength: number;
|
|
12
|
+
followCursor: boolean;
|
|
13
|
+
interactive: boolean;
|
|
14
|
+
overlay: boolean;
|
|
15
|
+
collide: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface Pt {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}
|
|
21
|
+
/** FABRIK: bends a chain of `seg`-long links rooted at `root` so its tip reaches toward `target`. */
|
|
22
|
+
export declare function fabrik(P: Pt[], root: Pt, target: Pt, seg: number, iterations?: number): void;
|
|
23
|
+
/** Closest point on a solid's outline to `p`. */
|
|
24
|
+
export declare function edgePoint(s: Solid, p: Pt): Pt;
|
|
25
|
+
/**
|
|
26
|
+
* An octopus drifting in deep water. Eight tapered arms, webbed at the base, ripple and
|
|
27
|
+
* coil and uncoil on their own, now and then one wandering off to explore; the nearest
|
|
28
|
+
* ones reach out and wrap the cursor, and with `collide` arm tips latch onto the edges of
|
|
29
|
+
* `data-otc-solid` elements and pull the body along. It breathes through its siphon and
|
|
30
|
+
* swims in jet pulses, mantle first. Its pupils stay level whichever way it turns, dark
|
|
31
|
+
* "passing cloud" waves ripple over its skin when it is excited, and a tap makes it blanch,
|
|
32
|
+
* shoot a stream of ink from the siphon and jet away.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useOctopus(options: UseOctopusOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type OwlPreset = "default" | "tawny" | "snowy" | "barn" | "spirit" | "monochrome";
|
|
4
|
+
interface OwlPresetValues {
|
|
5
|
+
featherColor?: string;
|
|
6
|
+
bellyColor?: string;
|
|
7
|
+
faceColor?: string;
|
|
8
|
+
eyeColor?: string;
|
|
9
|
+
beakColor?: string;
|
|
10
|
+
branchColor?: string;
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
earTufts?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const PRESETS: Record<OwlPreset, OwlPresetValues>;
|
|
15
|
+
export interface OwlProps extends BaseCanvasProps {
|
|
16
|
+
/** Back, wing and head feathers (default: "#6b4a33") */
|
|
17
|
+
featherColor?: string;
|
|
18
|
+
/** Barred chest feathers (default: "#d9bf9a") */
|
|
19
|
+
bellyColor?: string;
|
|
20
|
+
/** Facial disc (default: "#c48a52") */
|
|
21
|
+
faceColor?: string;
|
|
22
|
+
/** Iris color (default: "#f2a516") */
|
|
23
|
+
eyeColor?: string;
|
|
24
|
+
/** Beak color; talons are a tint of it (default: "#3a3330") */
|
|
25
|
+
beakColor?: string;
|
|
26
|
+
/** Branch color (default: "#3b2a1e") */
|
|
27
|
+
branchColor?: string;
|
|
28
|
+
/** Night sky color; "transparent" drops the scene (default: "#070a12") */
|
|
29
|
+
backgroundColor?: string;
|
|
30
|
+
/** Feather "horns" on the head (default: true) */
|
|
31
|
+
earTufts?: boolean;
|
|
32
|
+
/** Owl scale (default: 1) */
|
|
33
|
+
size?: number;
|
|
34
|
+
/** The head turns to follow the cursor; off = it looks around by itself (default: true) */
|
|
35
|
+
followCursor?: boolean;
|
|
36
|
+
/** Average ms between blinks; 0 = never (default: 5000) */
|
|
37
|
+
blinkInterval?: number;
|
|
38
|
+
/** Fixed full-viewport, click-through layer over the page (default: false) */
|
|
39
|
+
overlay?: boolean;
|
|
40
|
+
/** Perch on top of an element marked `data-otc-solid` instead of a branch (default: false) */
|
|
41
|
+
collide?: boolean;
|
|
42
|
+
/** Overlay z-index (default: 10) */
|
|
43
|
+
zIndex?: number;
|
|
44
|
+
/** Named preset: "default" | "tawny" | "snowy" | "barn" | "spirit" | "monochrome" */
|
|
45
|
+
preset?: OwlPreset | string;
|
|
46
|
+
}
|
|
47
|
+
export declare const Owl: import('react').ForwardRefExoticComponent<OwlProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Solid } from '../../runtime/physics';
|
|
2
|
+
|
|
3
|
+
export interface UseOwlOptions {
|
|
4
|
+
featherColor: string;
|
|
5
|
+
bellyColor: string;
|
|
6
|
+
faceColor: string;
|
|
7
|
+
eyeColor: string;
|
|
8
|
+
beakColor: string;
|
|
9
|
+
branchColor: string;
|
|
10
|
+
backgroundColor: string;
|
|
11
|
+
earTufts: boolean;
|
|
12
|
+
size: number;
|
|
13
|
+
followCursor: boolean;
|
|
14
|
+
blinkInterval: number;
|
|
15
|
+
overlay: boolean;
|
|
16
|
+
collide: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Owl blink closure 0..1, `s` seconds in: slower and heavier-lidded than a human blink. */
|
|
19
|
+
export declare function owlBlink(s: number): number;
|
|
20
|
+
/** The solid an owl of height `need` can perch on: top edge inside the canvas, nearest the middle. */
|
|
21
|
+
export declare function pickPerch(solids: readonly Solid[], w: number, h: number, need: number): Solid | null;
|
|
22
|
+
/**
|
|
23
|
+
* An owl on its perch. Owls can't move their eyes, so the whole head snaps to follow the
|
|
24
|
+
* cursor (a held fixation, then a quick turn); it cocks its head when the cursor goes still,
|
|
25
|
+
* bobs to judge distance when something moves fast nearby, blinks slowly, grows drowsy when
|
|
26
|
+
* ignored and fluffs up when tapped. Pupils narrow as the cursor comes close. With `collide`
|
|
27
|
+
* it perches on top of a `data-otc-solid` element instead of a branch.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useOwl(options: UseOwlOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -38,6 +38,8 @@ export interface RainProps extends BaseCanvasProps {
|
|
|
38
38
|
showSplashes?: boolean;
|
|
39
39
|
/** Canvas background color. (default: "#0b1424") */
|
|
40
40
|
backgroundColor?: string;
|
|
41
|
+
/** Draw the night-street scene (sky, city, lamps, wet ground). false = rain only, over a plain backgroundColor fill ("transparent" to overlay). (default: true) */
|
|
42
|
+
showBackground?: boolean;
|
|
41
43
|
/** Number of background stars (default: 0) */
|
|
42
44
|
starCount?: number;
|
|
43
45
|
/** Star color (default: "#ffffff") */
|
|
@@ -20,7 +20,7 @@ export interface ReactionDiffusionProps extends BaseCanvasProps {
|
|
|
20
20
|
colorB?: string;
|
|
21
21
|
/** Canvas background color (default: "#04121f") */
|
|
22
22
|
backgroundColor?: string;
|
|
23
|
-
/**
|
|
23
|
+
/** Hovering seeds a trail of chemical (thicker while pressed), taps drop a blob (default: true) */
|
|
24
24
|
interactive?: boolean;
|
|
25
25
|
/** Named preset */
|
|
26
26
|
preset?: ReactionDiffusionPreset | string;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
|
|
3
1
|
export interface UseReactionDiffusionOptions {
|
|
4
2
|
feedRate: number;
|
|
5
3
|
killRate: number;
|
|
@@ -12,4 +10,12 @@ export interface UseReactionDiffusionOptions {
|
|
|
12
10
|
backgroundColor: string;
|
|
13
11
|
interactive: boolean;
|
|
14
12
|
}
|
|
15
|
-
|
|
13
|
+
/** Seed a soft disc of V (the autocatalyst) at grid cell (cx, cy), wrapping at the edges. */
|
|
14
|
+
export declare function seedDisc(u: Float32Array, v: Float32Array, gw: number, gh: number, cx: number, cy: number, r: number): void;
|
|
15
|
+
/**
|
|
16
|
+
* Gray-Scott reaction-diffusion, lit like a wet relief. Feed and kill rates drift slowly across
|
|
17
|
+
* the canvas around the chosen values, so spots, stripes and mazes meet and keep morphing into
|
|
18
|
+
* each other instead of freezing. Hovering seeds a trail of chemical, taps drop a blob, and an
|
|
19
|
+
* exhausted field reseeds itself.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useReactionDiffusion(options: UseReactionDiffusionOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type SnailPreset = "default" | "amber" | "forest" | "candy" | "nocturne" | "monochrome";
|
|
4
|
+
interface SnailPresetValues {
|
|
5
|
+
shellColor?: string;
|
|
6
|
+
bodyColor?: string;
|
|
7
|
+
trailColor?: string;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const PRESETS: Record<SnailPreset, SnailPresetValues>;
|
|
11
|
+
export interface SnailProps extends BaseCanvasProps {
|
|
12
|
+
/** Shell color (default: "#b5773f") */
|
|
13
|
+
shellColor?: string;
|
|
14
|
+
/** Body (foot, head and stalks) color (default: "#a8988a") */
|
|
15
|
+
bodyColor?: string;
|
|
16
|
+
/** Slime trail glint (default: "#cfe6ff") */
|
|
17
|
+
trailColor?: string;
|
|
18
|
+
/** Garden color; "transparent" drops the scene (default: "#0f1a12") */
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
/** Snail scale (default: 1) */
|
|
21
|
+
size?: number;
|
|
22
|
+
/** Crawl speed multiplier (default: 1) */
|
|
23
|
+
speed?: number;
|
|
24
|
+
/** Leave a slime trail that slowly dries (default: true) */
|
|
25
|
+
trail?: boolean;
|
|
26
|
+
/** Eye stalks follow the cursor; poke them, move fast or tap and it hides in its shell (default: true) */
|
|
27
|
+
interactive?: boolean;
|
|
28
|
+
/** Fixed full-viewport, click-through layer over the page (default: false) */
|
|
29
|
+
overlay?: boolean;
|
|
30
|
+
/** Crawl along the top of an element marked `data-otc-solid` (default: false) */
|
|
31
|
+
collide?: boolean;
|
|
32
|
+
/** Overlay z-index (default: 10) */
|
|
33
|
+
zIndex?: number;
|
|
34
|
+
/** Named preset: "default" | "amber" | "forest" | "candy" | "nocturne" | "monochrome" */
|
|
35
|
+
preset?: SnailPreset | string;
|
|
36
|
+
}
|
|
37
|
+
export declare const Snail: import('react').ForwardRefExoticComponent<SnailProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface UseSnailOptions {
|
|
2
|
+
shellColor: string;
|
|
3
|
+
bodyColor: string;
|
|
4
|
+
trailColor: string;
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
size: number;
|
|
7
|
+
speed: number;
|
|
8
|
+
trail: boolean;
|
|
9
|
+
interactive: boolean;
|
|
10
|
+
overlay: boolean;
|
|
11
|
+
collide: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Direction after a step: turns around at either end of the surface [lo, hi]. */
|
|
14
|
+
export declare function turnAt(x: number, dir: number, lo: number, hi: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* A garden snail gliding along the ground (or the top of a `data-otc-solid` element with
|
|
17
|
+
* `collide`) on rippling pedal waves, leaving a glistening slime trail that slowly dries. Its eye
|
|
18
|
+
* stalks lean toward the cursor out of curiosity; poke an eye, move fast nearby or tap it and it
|
|
19
|
+
* pulls everything into its shell, then cautiously comes back out.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useSnail(options: UseSnailOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -31,6 +31,10 @@ export interface SpiderWebProps extends BaseCanvasProps {
|
|
|
31
31
|
interactive?: boolean;
|
|
32
32
|
/** Show spider (default: true) */
|
|
33
33
|
showSpider?: boolean;
|
|
34
|
+
/** Show the moon and its halo in the sky (default: true) */
|
|
35
|
+
showMoon?: boolean;
|
|
36
|
+
/** Moon color; also tints its halo (default: a pale tint of glowColor) */
|
|
37
|
+
moonColor?: string;
|
|
34
38
|
/** Named preset */
|
|
35
39
|
preset?: SpiderWebPreset | string;
|
|
36
40
|
}
|
|
@@ -12,6 +12,9 @@ export interface UseSpiderWebOptions {
|
|
|
12
12
|
disturbRadius: number;
|
|
13
13
|
interactive: boolean;
|
|
14
14
|
showSpider: boolean;
|
|
15
|
+
showMoon: boolean;
|
|
16
|
+
/** "" = derive a pale tint from glowColor */
|
|
17
|
+
moonColor: string;
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
20
|
* An orb weaver's web at night. Irregular frame silk is bridged to the edges, radii run
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
|
|
3
1
|
export type StarfieldPerspective = "2D" | "3D";
|
|
4
2
|
export interface UseStarfieldOptions {
|
|
5
3
|
starCount: number;
|
|
@@ -19,4 +17,13 @@ export interface UseStarfieldOptions {
|
|
|
19
17
|
shootingStarLength: number;
|
|
20
18
|
shootingStarLifetime: number;
|
|
21
19
|
}
|
|
22
|
-
|
|
20
|
+
/** Pick a temperature tint 0..4: mostly sun-like, a few hot blue and cool orange stars. */
|
|
21
|
+
export declare function starTint(r: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* A deep-sky vista. In 2D: a Milky Way band with glowing star clouds, dark dust lanes and faint
|
|
24
|
+
* nebulae (painted once into a cached layer), under three parallax layers of temperature-tinted
|
|
25
|
+
* stars that drift slowly and shift as the cursor looks around; the brightest carry diffraction
|
|
26
|
+
* spikes, small ones scintillate, and tapered meteors streak across now and then. In 3D: a warp
|
|
27
|
+
* tunnel with motion-streaked stars that the cursor steers.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useStarfield(options: UseStarfieldOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type SunflowersPreset = "default" | "dawn" | "dusk" | "velvet" | "moonlight" | "monochrome";
|
|
4
|
+
interface SunflowersPresetValues {
|
|
5
|
+
petalColor?: string;
|
|
6
|
+
centerColor?: string;
|
|
7
|
+
stemColor?: string;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const PRESETS: Record<SunflowersPreset, SunflowersPresetValues>;
|
|
11
|
+
export interface SunflowersProps extends BaseCanvasProps {
|
|
12
|
+
/** Number of sunflowers (default: 5) */
|
|
13
|
+
count?: number;
|
|
14
|
+
/** Petal color (default: "#f6b51e") */
|
|
15
|
+
petalColor?: string;
|
|
16
|
+
/** Seed disc color (default: "#4a2a12") */
|
|
17
|
+
centerColor?: string;
|
|
18
|
+
/** Stems and leaves (default: "#4f7a2a") */
|
|
19
|
+
stemColor?: string;
|
|
20
|
+
/** Sky color at the sun's height; "transparent" drops the scene (default: "#f0a868") */
|
|
21
|
+
backgroundColor?: string;
|
|
22
|
+
/** Wind strength (default: 1) */
|
|
23
|
+
wind?: number;
|
|
24
|
+
/** Your cursor is the sun and the heads turn to face it; off = the sun crosses the sky by itself (default: true) */
|
|
25
|
+
followCursor?: boolean;
|
|
26
|
+
/** The cursor's wake pushes stems; tap a head to shake petals loose (default: true) */
|
|
27
|
+
interactive?: boolean;
|
|
28
|
+
/** Fixed full-viewport, click-through layer over the page (default: false) */
|
|
29
|
+
overlay?: boolean;
|
|
30
|
+
/** Overlay z-index (default: 10) */
|
|
31
|
+
zIndex?: number;
|
|
32
|
+
/** Named preset: "default" | "dawn" | "dusk" | "velvet" | "moonlight" | "monochrome" */
|
|
33
|
+
preset?: SunflowersPreset | string;
|
|
34
|
+
}
|
|
35
|
+
export declare const Sunflowers: import('react').ForwardRefExoticComponent<SunflowersProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface UseSunflowersOptions {
|
|
2
|
+
count: number;
|
|
3
|
+
petalColor: string;
|
|
4
|
+
centerColor: string;
|
|
5
|
+
stemColor: string;
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
wind: number;
|
|
8
|
+
followCursor: boolean;
|
|
9
|
+
interactive: boolean;
|
|
10
|
+
overlay: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Head orientation that faces a sun at (sx, sy) from a head at (hx, hy): yaw right +, pitch down +. */
|
|
13
|
+
export declare function faceToward(hx: number, hy: number, sx: number, sy: number, w: number, h: number): {
|
|
14
|
+
yaw: number;
|
|
15
|
+
pitch: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A row of sunflowers at golden hour. Each heavy head turns to face the sun (your cursor, or
|
|
19
|
+
* the sun arcing across the sky on its own) with a lagging, springy follow, foreshortened in
|
|
20
|
+
* 3D, seeds packed in a golden-angle Fibonacci spiral. Stems sway in gusts and in the cursor's
|
|
21
|
+
* wake; tap a head to shake loose a few petals.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useSunflowers(options: UseSunflowersOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseCanvasProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
type TidePoolPreset = "default" | "tropical" | "kelp-coast" | "sunset" | "night" | "monochrome";
|
|
4
|
+
interface TidePoolPresetValues {
|
|
5
|
+
waterColor?: string;
|
|
6
|
+
rockColor?: string;
|
|
7
|
+
anemoneColor?: string;
|
|
8
|
+
starfishColor?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const PRESETS: Record<TidePoolPreset, TidePoolPresetValues>;
|
|
11
|
+
export interface TidePoolProps extends BaseCanvasProps {
|
|
12
|
+
/** Water tint (default: "#2a8a8f") */
|
|
13
|
+
waterColor?: string;
|
|
14
|
+
/** Rocks and sand on the pool floor (default: "#6e6457") */
|
|
15
|
+
rockColor?: string;
|
|
16
|
+
/** Sea anemone color (default: "#5fbf7a") */
|
|
17
|
+
anemoneColor?: string;
|
|
18
|
+
/** Starfish color (default: "#e0702e") */
|
|
19
|
+
starfishColor?: string;
|
|
20
|
+
/** Number of small fish (default: 7) */
|
|
21
|
+
fishCount?: number;
|
|
22
|
+
/** Number of sea anemones (default: 5) */
|
|
23
|
+
anemoneCount?: number;
|
|
24
|
+
/** Sunlight caustics strength, 0..2 (default: 1) */
|
|
25
|
+
causticIntensity?: number;
|
|
26
|
+
/** Anemones close and fish flee from the cursor; moving it ripples the water, taps splash (default: true) */
|
|
27
|
+
interactive?: boolean;
|
|
28
|
+
/** Named preset: "default" | "tropical" | "kelp-coast" | "sunset" | "night" | "monochrome" */
|
|
29
|
+
preset?: TidePoolPreset | string;
|
|
30
|
+
}
|
|
31
|
+
export declare const TidePool: import('react').ForwardRefExoticComponent<TidePoolProps & import('react').RefAttributes<HTMLCanvasElement>>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface UseTidePoolOptions {
|
|
2
|
+
waterColor: string;
|
|
3
|
+
rockColor: string;
|
|
4
|
+
anemoneColor: string;
|
|
5
|
+
starfishColor: string;
|
|
6
|
+
fishCount: number;
|
|
7
|
+
anemoneCount: number;
|
|
8
|
+
causticIntensity: number;
|
|
9
|
+
interactive: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Anemone hysteresis: shut when something comes within 1.4 radii, reopen only once it is
|
|
13
|
+
* past 2.2 radii, so a cursor resting on the edge doesn't make it flutter.
|
|
14
|
+
*/
|
|
15
|
+
export declare function anemoneShut(d: number, r: number, shut: boolean): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A rock pool seen from above: sunlight caustics ripple over pebbles, sea anemones sway their
|
|
18
|
+
* tentacles and snap shut when the cursor comes close, starfish slowly curl their arms and
|
|
19
|
+
* little fish dart away from your hand. Moving the cursor stirs ripples; tapping splashes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useTidePool(options: UseTidePoolOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
|