Background Gradient Animation
A smooth and elegant background gradient animation that changes the gradient position over time.
Installation
Run the following command
npx shadcn@latest add @aceternity/background-gradient-animation
Add animations to your CSS
Add these animations to your CSS file:
@import "tailwindcss";
@theme inline {
--animate-first: moveVertical 30s ease infinite;
--animate-second: moveInCircle 20s reverse infinite;
--animate-third: moveInCircle 40s linear infinite;
--animate-fourth: moveHorizontal 40s ease infinite;
--animate-fifth: moveInCircle 20s ease infinite;
}
@keyframes moveHorizontal {
0% {
transform: translateX(-50%) translateY(-10%);
}
50% {
transform: translateX(50%) translateY(10%);
}
100% {
transform: translateX(-50%) translateY(-10%);
}
}
@keyframes moveInCircle {
0% {
transform: rotate(0deg);
}
50% {
transform: rotate(180deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes moveVertical {
0% {
transform: translateY(-50%);
}
50% {
transform: translateY(50%);
}
100% {
transform: translateY(-50%);
}
}
Props
Prop Name | Type | Default Value | Description |
---|---|---|---|
gradientBackgroundStart | string | "rgb(108, 0, 162)" | The starting color of the background gradient, specified as an RGB value. |
gradientBackgroundEnd | string | "rgb(0, 17, 82)" | The ending color of the background gradient, specified as an RGB value. |
firstColor | string | "18, 113, 255" | The first color used in the animation, specified as an RGB value without the rgb tag. |
secondColor | string | "221, 74, 255" | The second color used in the animation, specified as an RGB value without the rgb tag. |
thirdColor | string | "100, 220, 255" | The third color used in the animation, specified as an RGB value without the rgb tag. |
fourthColor | string | "200, 50, 50" | The fourth color used in the animation, specified as an RGB value without the rgb tag. |
fifthColor | string | "180, 180, 50" | The fifth color used in the animation, specified as an RGB value without the rgb tag. |
pointerColor | string | "140, 100, 255" | The color of the pointer, specified as an RGB value without the rgb tag. |
size | string | "80%" | The size of the animated elements. |
blendingValue | string | "hard-light" | The blending mode used for the animated elements. |
children | React.ReactNode | undefined | Children components to be rendered inside the component. |
className | string | undefined | Additional CSS class for styling. |
interactive | boolean | true | Determines if the animation is interactive or not. |
containerClassName | string | undefined | Additional CSS class for the container. |
Special thanks to this video that inspired this component.
Build websites faster and 10x better than your competitors with
Aceternity UI Pro
Next.js 15, Tailwind CSS v4 and Motion for react powered templates
70+ templates and component blocks combined
Ready to copy paste component blocks, save days of development time

