bg-animated-gradient
cult-ui/bg-animated-gradientUnverifiedComponent
Animated gradient background component with customizable color transitions
Install it
npx shadcn@latest add https://raw.githubusercontent.com/nolly-studio/cult-ui/HEAD/apps/www/bg-animated-gradient.jsonSource
1"use client"23import React, { useEffect } from "react"4import { motion, useAnimation } from "motion/react"56interface GradientStop {7 color: string8 position: number9}1011interface GradientType {12 stops: GradientStop[]13 centerX: number14 centerY: number15}1617interface GradientAnimationProps {18 gradients: GradientType[]19 animationDuration: number20 className?: string21}2223export const GradientAnimation: React.FC<GradientAnimationProps> = ({24 gradients,25 animationDuration,26 className = "",27}) => {28 const controls = useAnimation()2930 useEffect(() => {31 controls.start({32 background: gradients.map(33 (g) =>34 `radial-gradient(circle at ${g.centerX}% ${g.centerY}%, ${g.stops35 .map((s) => `${s.color} ${s.position}%`)36 .join(", ")})`37 ),38 transition: {39 duration: animationDuration,40 repeat: Infinity,41 repeatType: "reverse",42 ease: "linear",43 },44 })45 }, [controls, gradients, animationDuration])4647 return (48 <motion.div49 className={`absolute inset-0 h-full w-full ${className}`}50 animate={controls}51 />52 )53}5455export default React.memo(GradientAnimation)
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 | Unverified | 2 deps | |
| ai-instructions-demoai-instructions-demo | cult/ui | Components | Unverified | no deps | |
| animated-numberanimated-number | cult/ui | Components | Unverified | 1 dep | |
| animated-number-demoanimated-number-demo | cult/ui | Components | Unverified | no deps | |
| bg-animate-buttonbg-animate-button | cult/ui | Components | Unverified | no deps | |
| bg-animate-button-demobg-animate-button-demo | cult/ui | Components | Unverified | no deps | |
| bg-animated-fractal-dot-gridbg-animated-fractal-dot-grid | cult/ui | Components | Unverified | 1 dep | |
| bg-animated-fractal-dot-grid-demobg-animated-fractal-dot-grid-demo | cult/ui | Components | Unverified | no deps |
