canvas-fractal-grid
cult-ui/canvas-fractal-gridFreeComponent
Interactive canvas-based fractal dot grid with mouse tracking and wave effects
Install it
npx shadcn@latest add https://raw.githubusercontent.com/nolly-studio/cult-ui/HEAD/apps/www/public/r/styles/default/canvas-fractal-grid.jsonSource
1"use client"23import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"4import { AnimatePresence, motion, useAnimation } from "motion/react"56interface GradientStop {7 color: string8 position: number9}1011interface GradientType {12 stops: GradientStop[]13 centerX: number14 centerY: number15}1617interface CanvasFractalGridProps {18 /** Size of each dot in pixels */19 dotSize?: number20 /** Spacing between dots in pixels */21 dotSpacing?: number22 /** Opacity of dots (0-1) */23 dotOpacity?: number24 /** Duration of the background gradient animation in seconds */25 gradientAnimationDuration?: number26 /** Stiffness of mouse tracking (higher values make it more responsive) */27 mouseTrackingStiffness?: number28 /** Damping of mouse tracking (higher values make it less bouncy) */29 mouseTrackingDamping?: number30 /** Intensity of the wave effect when hovering */31 waveIntensity?: number32 /** Radius of the wave effect in pixels */33 waveRadius?: number34 /** Array of gradient configurations for the background */35 gradients?: GradientType[]36 /** Color of the dots (supports any valid CSS color) */37 dotColor?: string38 /** Color of the dot glow effect (supports any valid CSS color) */39 glowColor?: string40 /** Enable or disable the noise overlay */41 enableNoise?: boolean42 /** Opacity of the noise overlay (0-1) */43 noiseOpacity?: number44 /** Enable or disable the mouse glow effect */45 enableMouseGlow?: boolean46 /** Set the initial performance level */47 initialPerformance?: "low" | "medium" | "high"48 /** Enable or disable the gradient animation */49 enableGradient?: boolean50}5152const NoiseSVG = React.memo(() => (53 <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">54 <filter id="noise">55 <feTurbulence56 type="fractalNoise"57 baseFrequency="0.65"58 numOctaves="3"59 stitchTiles="stitch"60 />61 </filter>62 <rect width="100%" height="100%" filter="url(#noise)" />63 </svg>64))6566NoiseSVG.displayName = "NoiseSVG"6768const NoiseOverlay: React.FC<{ opacity: number }> = ({ opacity }) => (69 <div70 className="absolute inset-0 h-full w-full mix-blend-overlay"71 style={{ opacity }}72 >73 <NoiseSVG />74 </div>75)7677const useResponsive = () => {78 const [windowSize, setWindowSize] = useState({79 width: 0,80 height: 0,81 })8283 useEffect(() => {84 if (typeof window === "undefined") return8586 const handleResize = () => {87 setWindowSize({88 width: window.innerWidth,89// … truncated
What it pulls in
npm packages
Files it writes
More from cult/ui
All 157 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-instructionsai-instructions | cult/ui | Components | Free | 2 deps | |
| ai-instructions-demoai-instructions-demo | cult/ui | Components | Free | no deps | |
| animated-numberanimated-number | cult/ui | Components | Free | 1 dep | |
| animated-number-demoanimated-number-demo | cult/ui | Components | Free | no deps | |
| bg-animate-buttonbg-animate-button | cult/ui | Components | Free | no deps | |
| bg-animate-button-demobg-animate-button-demo | cult/ui | Components | Free | no deps | |
| bg-animated-fractal-dot-gridbg-animated-fractal-dot-grid | cult/ui | Components | Free | 1 dep | |
| bg-animated-fractal-dot-grid-demobg-animated-fractal-dot-grid-demo | cult/ui | Components | Free | no deps |
