bg-animated-fractal-dot-grid
cult-ui/bg-animated-fractal-dot-gridFreeComponent
Background animated fractal dot grid with performance optimization and responsive design
Install it
npx shadcn@latest add https://raw.githubusercontent.com/nolly-studio/cult-ui/HEAD/apps/www/public/r/styles/default/bg-animated-fractal-dot-grid.jsonSource
1"use client"23import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"4import { AnimatePresence, motion } from "motion/react"56interface FractalDotGridProps {7 /** Size of each dot in pixels */8 dotSize?: number9 /** Spacing between dots in pixels */10 dotSpacing?: number11 /** Opacity of dots (0-1) */12 dotOpacity?: number13 /** Intensity of the wave effect when hovering */14 waveIntensity?: number15 /** Radius of the wave effect in pixels */16 waveRadius?: number17 /** Color of the dots (supports any valid CSS color) */18 dotColor?: string19 /** Color of the dot glow effect (supports any valid CSS color) */20 glowColor?: string21 /** Enable or disable the noise overlay */22 enableNoise?: boolean23 /** Opacity of the noise overlay (0-1) */24 noiseOpacity?: number25 /** Enable or disable the mouse glow effect */26 enableMouseGlow?: boolean27 /** Set the initial performance level */28 initialPerformance?: "low" | "medium" | "high"29}3031const NoiseSVG = React.memo(() => (32 <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">33 <filter id="noise">34 <feTurbulence35 type="fractalNoise"36 baseFrequency="0.65"37 numOctaves="3"38 stitchTiles="stitch"39 />40 </filter>41 <rect width="100%" height="100%" filter="url(#noise)" />42 </svg>43))4445NoiseSVG.displayName = "NoiseSVG"4647const NoiseOverlay: React.FC<{ opacity: number }> = ({ opacity }) => (48 <div49 className="absolute inset-0 h-full w-full mix-blend-overlay"50 style={{ opacity }}51 >52 <NoiseSVG />53 </div>54)5556const useResponsive = () => {57 const [windowSize, setWindowSize] = useState({58 width: typeof window !== "undefined" ? window.innerWidth : 0,59 height: typeof window !== "undefined" ? window.innerHeight : 0,60 })6162 useEffect(() => {63 const handleResize = () => {64 setWindowSize({65 width: window.innerWidth,66 height: window.innerHeight,67 })68 }6970 window.addEventListener("resize", handleResize)71 return () => window.removeEventListener("resize", handleResize)72 }, [])7374 return {75 isMobile: windowSize.width < 768,76 isTablet: windowSize.width >= 768 && windowSize.width < 1024,77 isDesktop: windowSize.width >= 1024,78 }79}8081const usePerformance = (82 initialPerformance: "low" | "medium" | "high" = "medium"83) => {84 const [performance, setPerformance] = useState(initialPerformance)85 const [fps, setFps] = useState(60)8687 useEffect(() => {88 let frameCount = 089// … 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-grid-demobg-animated-fractal-dot-grid-demo | cult/ui | Components | Free | no deps | |
| bg-animated-gradientbg-animated-gradient | cult/ui | Components | Free | 1 dep |
