Gradient Animation Background
Flowing gradients that dance like aurora in a digital sky. Build mesmerizing React backgrounds with animated orbs, mouse tracking, TypeScript support, and CSS blend modes for Next.js applications with shadcn/ui.
Powered by
Trying to implement gradient animations?
Join our Discord community for help from other developers.
Static gradients are everywhere. CSS linear-gradient this, radial-gradient that. Boring. What if your gradients could move, breathe, respond to your cursor? This React component creates five animated orbs that float around your background, blending colors like paint drops in water, with an extra orb that follows your mouse.
Dynamic flowing gradients
Watch orbs dance with independent movement and mouse interaction:
Built for React applications with TypeScript and Next.js. The orbs use CSS animations with different timing cycles (20-40 seconds), creating organic movement that never repeats exactly. Blend modes make colors interact naturally, and mouse tracking adds that interactive spark.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/background-gradient-animation.json
npx shadcn@latest add https://www.shadcn.io/registry/background-gradient-animation.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/background-gradient-animation.json
bunx shadcn@latest add https://www.shadcn.io/registry/background-gradient-animation.json
Usage
import { BackgroundGradientAnimation } from "@/components/ui/background-gradient-animation";
export default function Hero() {
return (
<BackgroundGradientAnimation
gradientBackgroundStart="rgb(108, 0, 162)"
gradientBackgroundEnd="rgb(0, 17, 82)"
firstColor="18, 113, 255"
secondColor="221, 74, 255"
thirdColor="100, 220, 255"
fourthColor="200, 50, 50"
fifthColor="180, 180, 50"
pointerColor="140, 100, 255"
blendingValue="hard-light"
interactive={true}
>
<div className="absolute z-50 inset-0 flex items-center justify-center text-white font-bold px-4 pointer-events-none text-3xl text-center md:text-4xl lg:text-7xl">
<p className="bg-clip-text text-transparent drop-shadow-2xl bg-gradient-to-b from-white/80 to-white/20">
Gradients in Motion
</p>
</div>
</BackgroundGradientAnimation>
);
}
Why most gradient animations look cheap
Most developers use keyframe animations to shift background-position or hue-rotate. It looks artificial—too smooth, too predictable. Some try JavaScript to animate gradient stops, but that's performance hell. Real organic movement has layers, depth, and unpredictable interactions.
This React component creates depth with five independent orbs, each following different animation paths. CSS blend modes (hard-light, screen, overlay) make colors interact like real light mixing. The mouse-following orb adds interactivity without being distracting. No canvas, no complex calculations—just smart CSS and React working together.
Features
- Five independent animated orbs with 20-40 second movement cycles
- Interactive mouse tracking with smooth cursor-following orb
- CSS blend modes creating natural color mixing (hard-light, screen, overlay, multiply, color-dodge)
- Customizable color system supporting full RGB control for all elements
- Safari optimizations with SVG filter fallbacks for cross-browser support
- TypeScript definitions for all props and color configurations
- Performance optimized using pure CSS animations
- shadcn/ui compatible with proper content layering
API Reference
BackgroundGradientAnimation
Main container component for the gradient animation effect.
Prop | Type | Default | Description |
---|---|---|---|
gradientBackgroundStart | string | "rgb(108, 0, 162)" | Starting color of background gradient |
gradientBackgroundEnd | string | "rgb(0, 17, 82)" | Ending color of background gradient |
firstColor | string | "18, 113, 255" | RGB values for first orb (no rgb() wrapper) |
secondColor | string | "221, 74, 255" | RGB values for second orb (no rgb() wrapper) |
thirdColor | string | "100, 220, 255" | RGB values for third orb (no rgb() wrapper) |
fourthColor | string | "200, 50, 50" | RGB values for fourth orb (no rgb() wrapper) |
fifthColor | string | "180, 180, 50" | RGB values for fifth orb (no rgb() wrapper) |
pointerColor | string | "140, 100, 255" | RGB values for mouse-tracking orb |
size | string | "80%" | Size of the animated orbs |
blendingValue | string | "hard-light" | CSS mix-blend-mode for color mixing |
interactive | boolean | true | Enable mouse tracking for pointer orb |
children | ReactNode | - | Content to display over the animation |
className | string | - | Additional CSS classes for content wrapper |
containerClassName | string | - | Additional CSS classes for main container |
Color Format
// Orb colors: RGB values without rgb() wrapper
firstColor = "255, 0, 128"; // Pink
secondColor = "0, 255, 128"; // Green
// Background colors: Full CSS color values
gradientBackgroundStart = "rgb(45, 212, 191)";
gradientBackgroundEnd = "hsl(240, 100%, 20%)";
Available Blend Modes
hard-light
(default) - Strong color mixingscreen
- Bright, luminous effectoverlay
- Balanced color blendingmultiply
- Darker color mixingcolor-dodge
- Intense bright highlights
Common gotchas
Color format confusion: Orb colors need RGB values without the rgb()
wrapper ("255, 0, 128"), but background gradients use full CSS color syntax ("rgb(255, 0, 128)").
Z-index layering: Your content needs absolute z-50
or higher to appear above the animation. The orbs use lower z-index values for proper layering.
Performance with many props: Each color change triggers a re-render. For dynamic color changing, consider using CSS variables instead of props.
Blend mode browser support: Most blend modes work everywhere, but color-dodge
might not work in very old browsers. hard-light
is the safest default.
Mouse tracking on mobile: Touch devices don't have hover, so the interactive orb won't track touches. The other orbs still animate normally.
You might also like
Explore other flowing background components for React applications:
Aurora
Northern lights effect with smooth gradient animations
Vortex
Swirling particle effects that create mesmerizing depth
Waves
Fluid wave animations for ocean and water themes
Bubble Background
Floating bubbles that merge with liquid physics
Ethereal Shadow
Atmospheric shadows that breathe and distort
Noise
Organic texture patterns with customizable grain
Questions developers actually ask
React Flickering Grid Background
Grid squares that flicker like old CRT monitors having a moment. Build ambient React backgrounds with canvas-based animations, performance optimization, TypeScript support, and subtle visual noise for Next.js applications with shadcn/ui.
React Background Gradient
Animated radial gradients that make product cards pop like premium showcase displays. Build stunning React background components with Framer Motion, hover effects, TypeScript support, and CSS animations for Next.js applications with shadcn/ui.