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.
Files changed (70) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/README.md +34 -17
  3. package/lib/components/AuroraBorealis/AuroraBorealis.d.ts +5 -3
  4. package/lib/components/AuroraBorealis/useAuroraBorealis.d.ts +14 -3
  5. package/lib/components/ButterflySwarm/useButterflySwarm.d.ts +7 -0
  6. package/lib/components/Candle/Candle.d.ts +35 -0
  7. package/lib/components/Candle/index.d.ts +2 -0
  8. package/lib/components/Candle/useCandle.d.ts +18 -0
  9. package/lib/components/Cat/Cat.d.ts +42 -0
  10. package/lib/components/Cat/index.d.ts +2 -0
  11. package/lib/components/Cat/useCat.d.ts +22 -0
  12. package/lib/components/Eye/Eye.d.ts +46 -0
  13. package/lib/components/Eye/index.d.ts +3 -0
  14. package/lib/components/Eye/useEye.d.ts +29 -0
  15. package/lib/components/Fireworks/Fireworks.d.ts +2 -0
  16. package/lib/components/Fireworks/useFireworks.d.ts +1 -0
  17. package/lib/components/FluidSimulation/useFluidSimulation.d.ts +9 -3
  18. package/lib/components/GameOfLife/GameOfLife.d.ts +2 -2
  19. package/lib/components/GameOfLife/useGameOfLife.d.ts +10 -1
  20. package/lib/components/Hummingbird/Hummingbird.d.ts +43 -0
  21. package/lib/components/Hummingbird/index.d.ts +2 -0
  22. package/lib/components/Hummingbird/useHummingbird.d.ts +35 -0
  23. package/lib/components/Jellyfish/Jellyfish.d.ts +37 -0
  24. package/lib/components/Jellyfish/index.d.ts +2 -0
  25. package/lib/components/Jellyfish/useJellyfish.d.ts +20 -0
  26. package/lib/components/KoiPond/KoiPond.d.ts +2 -2
  27. package/lib/components/KoiPond/useKoiPond.d.ts +10 -3
  28. package/lib/components/Komorebi/Komorebi.d.ts +34 -0
  29. package/lib/components/Komorebi/index.d.ts +2 -0
  30. package/lib/components/Komorebi/useKomorebi.d.ts +22 -0
  31. package/lib/components/Lightning/Lightning.d.ts +1 -1
  32. package/lib/components/Lightning/useLightning.d.ts +7 -0
  33. package/lib/components/Octopus/Octopus.d.ts +44 -0
  34. package/lib/components/Octopus/index.d.ts +2 -0
  35. package/lib/components/Octopus/useOctopus.d.ts +35 -0
  36. package/lib/components/Owl/Owl.d.ts +48 -0
  37. package/lib/components/Owl/index.d.ts +2 -0
  38. package/lib/components/Owl/useOwl.d.ts +29 -0
  39. package/lib/components/Rain/Rain.d.ts +2 -0
  40. package/lib/components/Rain/useRain.d.ts +1 -0
  41. package/lib/components/ReactionDiffusion/ReactionDiffusion.d.ts +1 -1
  42. package/lib/components/ReactionDiffusion/useReactionDiffusion.d.ts +9 -3
  43. package/lib/components/Snail/Snail.d.ts +38 -0
  44. package/lib/components/Snail/index.d.ts +2 -0
  45. package/lib/components/Snail/useSnail.d.ts +21 -0
  46. package/lib/components/SpiderWeb/SpiderWeb.d.ts +4 -0
  47. package/lib/components/SpiderWeb/useSpiderWeb.d.ts +3 -0
  48. package/lib/components/Starfield/useStarfield.d.ts +10 -3
  49. package/lib/components/Sunflowers/Sunflowers.d.ts +36 -0
  50. package/lib/components/Sunflowers/index.d.ts +2 -0
  51. package/lib/components/Sunflowers/useSunflowers.d.ts +23 -0
  52. package/lib/components/TidePool/TidePool.d.ts +32 -0
  53. package/lib/components/TidePool/index.d.ts +2 -0
  54. package/lib/components/TidePool/useTidePool.d.ts +21 -0
  55. package/lib/components/WaveInterference/WaveInterference.d.ts +2 -0
  56. package/lib/components/WaveInterference/useWaveInterference.d.ts +20 -3
  57. package/lib/index.cjs.js +1 -1
  58. package/lib/index.d.ts +22 -6
  59. package/lib/index.es.js +11154 -9467
  60. package/lib/runtime/caustics.d.ts +16 -0
  61. package/package.json +2 -2
  62. package/lib/components/DeepSeaBioluminescence/DeepSeaBioluminescence.d.ts +0 -29
  63. package/lib/components/DeepSeaBioluminescence/index.d.ts +0 -2
  64. package/lib/components/DeepSeaBioluminescence/useDeepSeaBioluminescence.d.ts +0 -18
  65. package/lib/components/FrostGlass/FrostGlass.d.ts +0 -33
  66. package/lib/components/FrostGlass/index.d.ts +0 -2
  67. package/lib/components/FrostGlass/useFrostGlass.d.ts +0 -38
  68. package/lib/components/LSystem/LSystem.d.ts +0 -33
  69. package/lib/components/LSystem/index.d.ts +0 -2
  70. package/lib/components/LSystem/useLSystem.d.ts +0 -23
@@ -0,0 +1,16 @@
1
+ export interface CausticCache {
2
+ c: HTMLCanvasElement;
3
+ g: CanvasRenderingContext2D;
4
+ img: ImageData;
5
+ }
6
+ /**
7
+ * Draws caustics over (0, 0, w, h) with "lighter". `rgb` is "r,g,b"; `intensity` 0..2;
8
+ * `scale` = cells across the width; `ripple` (canvas px) bends the web around a point.
9
+ * ponytail: CPU per-pixel at ~192 px wide; move to a shader if it ever needs full resolution.
10
+ */
11
+ export declare function drawCaustics(ctx: CanvasRenderingContext2D, cache: {
12
+ current: CausticCache | null;
13
+ }, w: number, h: number, t: number, rgb: string, intensity: number, quality: number, scale?: number, ripple?: {
14
+ x: number;
15
+ y: number;
16
+ } | null): void;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "own-the-canvas",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Beautiful, responsive, fully customizable HTML canvas-based React visual components",
5
5
  "author": "Jabid Hasan",
6
6
  "homepage": "https://own-the-canvas.vercel.app",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/jabid-19/own-the-canvas"
9
+ "url": "git+https://github.com/jabid-19/own-the-canvas.git"
10
10
  },
11
11
  "bugs": {
12
12
  "url": "https://github.com/jabid-19/own-the-canvas/issues"
@@ -1,29 +0,0 @@
1
- import { BaseCanvasProps } from '../../types';
2
-
3
- type DeepSeaBioluminescencePreset = "default" | "abyssal" | "coral" | "aurora" | "crimson" | "monochrome";
4
- interface DeepSeaBioluminescencePresetValues {
5
- jellyfishColor?: string;
6
- glowColor?: string;
7
- waterColor?: string;
8
- }
9
- export declare const PRESETS: Record<DeepSeaBioluminescencePreset, DeepSeaBioluminescencePresetValues>;
10
- export interface DeepSeaBioluminescenceProps extends BaseCanvasProps {
11
- /** Number of jellyfish (default: 5) */
12
- jellyfishCount?: number;
13
- /** Number of plankton particles (default: 200) */
14
- planktonCount?: number;
15
- /** Jellyfish bell color (default: "#7fd8ff") */
16
- jellyfishColor?: string;
17
- /** Bioluminescent glow color (default: "#3fe0d0") */
18
- glowColor?: string;
19
- /** Background water color (default: "#020a16") */
20
- waterColor?: string;
21
- /** Cursor movement spawns bioluminescent ripples (default: true) */
22
- interactive?: boolean;
23
- /** Overall animation speed multiplier (default: 1) */
24
- speed?: number;
25
- /** Named preset */
26
- preset?: DeepSeaBioluminescencePreset | string;
27
- }
28
- export declare const DeepSeaBioluminescence: import('react').ForwardRefExoticComponent<DeepSeaBioluminescenceProps & import('react').RefAttributes<HTMLCanvasElement>>;
29
- export {};
@@ -1,2 +0,0 @@
1
- export { DeepSeaBioluminescence, PRESETS } from './DeepSeaBioluminescence';
2
- export type { DeepSeaBioluminescenceProps } from './DeepSeaBioluminescence';
@@ -1,18 +0,0 @@
1
- import { RefObject } from 'react';
2
-
3
- export interface UseDeepSeaBioluminescenceOptions {
4
- jellyfishCount: number;
5
- planktonCount: number;
6
- jellyfishColor: string;
7
- glowColor: string;
8
- waterColor: string;
9
- interactive: boolean;
10
- speed: number;
11
- }
12
- /**
13
- * The deep sea at night: translucent jellyfish at different depths pulse their bells to swim,
14
- * trailing frilly oral arms and long tentacles; rim lights chase around each bell. Marine
15
- * snow drifts down, faint light shafts sway from above, and moving the cursor stirs the
16
- * water into luminous sparks that make nearby plankton and jellyfish flash.
17
- */
18
- export declare function useDeepSeaBioluminescence(canvasRef: RefObject<HTMLCanvasElement | null>, options: UseDeepSeaBioluminescenceOptions): void;
@@ -1,33 +0,0 @@
1
- import { BaseCanvasProps } from '../../types';
2
-
3
- type FrostGlassPreset = "default" | "winter-window" | "ice-blue" | "silver" | "rose" | "monochrome";
4
- export interface FrostGlassProps extends BaseCanvasProps {
5
- /** Frost crystal color (default: "#e0f2fe") */
6
- color?: string;
7
- /** Condensation haze color (default: "#cbd5e1") */
8
- fogColor?: string;
9
- /** What's behind the glass; ignored in overlay mode (default: "#0b1220") */
10
- backgroundColor?: string;
11
- /** Fraction of the glass the frost grows to cover (default: 0.32) */
12
- coverage?: number;
13
- /** Growth speed multiplier (default: 1) */
14
- growthSpeed?: number;
15
- /** Chance per step that a crystal splits off a side branch (default: 0.05) */
16
- branching?: number;
17
- /** Radius of the patch your cursor melts, px (default: 46) */
18
- breathRadius?: number;
19
- /** Condensation haze opacity, 0..1 (default: 0.12) */
20
- fog?: number;
21
- /** Cursor melts frost and clears fog (default: true) */
22
- interactive?: boolean;
23
- /** Named preset */
24
- preset?: FrostGlassPreset | string;
25
- /** Fixed full-viewport, click-through layer over the page (default: false) */
26
- overlay?: boolean;
27
- /** Frost also nucleates on the edges of elements marked `data-otc-solid` and grows outward (default: false) */
28
- collide?: boolean;
29
- /** Overlay z-index (default: 10) */
30
- zIndex?: number;
31
- }
32
- export declare const FrostGlass: import('react').ForwardRefExoticComponent<FrostGlassProps & import('react').RefAttributes<HTMLCanvasElement>>;
33
- export {};
@@ -1,2 +0,0 @@
1
- export { FrostGlass } from './FrostGlass';
2
- export type { FrostGlassProps } from './FrostGlass';
@@ -1,38 +0,0 @@
1
- export interface UseFrostGlassOptions {
2
- color: string;
3
- fogColor: string;
4
- backgroundColor: string;
5
- coverage: number;
6
- growthSpeed: number;
7
- branching: number;
8
- breathRadius: number;
9
- fog: number;
10
- interactive: boolean;
11
- overlay: boolean;
12
- collide: boolean;
13
- }
14
- export interface Tip {
15
- x: number;
16
- y: number;
17
- angle: number;
18
- /** Remaining length in px. */
19
- left: number;
20
- width: number;
21
- gen: number;
22
- }
23
- export interface FrostGrid {
24
- cols: number;
25
- rows: number;
26
- cell: number;
27
- /** 1 = frosted. */
28
- cells: Uint8Array;
29
- }
30
- export declare function makeGrid(w: number, h: number, cell?: number): FrostGrid;
31
- /**
32
- * Advance one crystal tip by a segment. Ice branches at 60°: side branches
33
- * split off at ±60° (with slight jitter) and get shorter each generation.
34
- * A tip dies when it leaves the glass, runs out of length, or would cross
35
- * existing frost (crystals never overlap). Returns the segment drawn, or null.
36
- */
37
- export declare function stepTip(tip: Tip, grid: FrostGrid, branching: number, spawn: (t: Tip) => void): [number, number, number, number] | null;
38
- export declare function useFrostGlass(options: UseFrostGlassOptions): import('../../hooks/useCanvasSetup').CanvasSetupResult;
@@ -1,33 +0,0 @@
1
- import { BaseCanvasProps } from '../../types';
2
-
3
- type LSystemPreset = "default" | "fern" | "dragon" | "sierpinski" | "bush" | "snowflake";
4
- export interface LSystemProps extends BaseCanvasProps {
5
- /** Starting L-system axiom string */
6
- axiom?: string;
7
- /** Production rules map — e.g. { F: "F+F-F" } */
8
- rules?: Record<string, string>;
9
- /** Number of rewriting iterations (default: 4) */
10
- iterations?: number;
11
- /** Turtle turning angle in degrees (default: 25) */
12
- angle?: number;
13
- /** Stroke line width (default: 1) */
14
- lineWidth?: number;
15
- /** Branch stroke color (default: "#86efac") */
16
- color?: string;
17
- /** Canvas background color (default: "#06120a") */
18
- backgroundColor?: string;
19
- /** Segments drawn per animation frame (default: 5) */
20
- speed?: number;
21
- /** Restart animation after full draw (default: true) */
22
- autoReset?: boolean;
23
- /** Opacity of the previous cycle's ghost while the next regrows — 0 = hard clear (default: 0) */
24
- trailFade?: number;
25
- /** Enable glow shadow on branches (default: false) */
26
- glowEffect?: boolean;
27
- /** Glow radius in px when glowEffect is enabled (default: 8) */
28
- glowBlur?: number;
29
- /** Named preset: "default" | "fern" | "dragon" | "sierpinski" | "bush" | "snowflake" */
30
- preset?: LSystemPreset | string;
31
- }
32
- export declare const LSystem: import('react').ForwardRefExoticComponent<LSystemProps & import('react').RefAttributes<HTMLCanvasElement>>;
33
- export {};
@@ -1,2 +0,0 @@
1
- export { LSystem } from './LSystem';
2
- export type { LSystemProps } from './LSystem';
@@ -1,23 +0,0 @@
1
- import { RefObject } from 'react';
2
-
3
- export interface UseLSystemOptions {
4
- axiom: string;
5
- rules: Record<string, string>;
6
- iterations: number;
7
- angle: number;
8
- lineWidth: number;
9
- color: string;
10
- backgroundColor: string;
11
- speed: number;
12
- autoReset: boolean;
13
- trailFade: number;
14
- glowEffect: boolean;
15
- glowBlur: number;
16
- }
17
- /**
18
- * Grows an L-system as a living plant. Branches remember how deep they sit, so trunks are
19
- * thick bark and twigs are thin and bright; leaves (and the odd blossom) sit at branch tips;
20
- * an upright plant sways in the wind on a mound of grass while petals drift past. Flat
21
- * fractals (dragon curve, snowflake) are drawn with a colour gradient along the curve.
22
- */
23
- export declare function useLSystem(canvasRef: RefObject<HTMLCanvasElement | null>, options: UseLSystemOptions): void;