Introducing Aceternity UI Pro - 70+ premium component packs and templates to build amazing websites.
Logo

Background Gradient Animation

A smooth and elegant background gradient animation that changes the gradient position over time.

Open in

Gradients X Animations

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 NameTypeDefault ValueDescription
gradientBackgroundStartstring"rgb(108, 0, 162)"The starting color of the background gradient, specified as an RGB value.
gradientBackgroundEndstring"rgb(0, 17, 82)"The ending color of the background gradient, specified as an RGB value.
firstColorstring"18, 113, 255"The first color used in the animation, specified as an RGB value without the rgb tag.
secondColorstring"221, 74, 255"The second color used in the animation, specified as an RGB value without the rgb tag.
thirdColorstring"100, 220, 255"The third color used in the animation, specified as an RGB value without the rgb tag.
fourthColorstring"200, 50, 50"The fourth color used in the animation, specified as an RGB value without the rgb tag.
fifthColorstring"180, 180, 50"The fifth color used in the animation, specified as an RGB value without the rgb tag.
pointerColorstring"140, 100, 255"The color of the pointer, specified as an RGB value without the rgb tag.
sizestring"80%"The size of the animated elements.
blendingValuestring"hard-light"The blending mode used for the animated elements.
childrenReact.ReactNodeundefinedChildren components to be rendered inside the component.
classNamestringundefinedAdditional CSS class for styling.
interactivebooleantrueDetermines if the animation is interactive or not.
containerClassNamestringundefinedAdditional 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

Aceternity UI Pro Demo - Light Mode
A product by Aceternity
Building in public at @mannupaaji