15 CSS Background Animations 01 / 15

Animated Gradient Backgrounds (Infinite Shifting)

A six-color gradient drifting endlessly across the viewport, layered with blended radial blobs and a fine grain overlay for depth.

Pure CSS MIT licensed
Live Demo Open in tab
Open in playground

The code

<div class="bga-01">
  <div class="bga-01__scene"></div>
</div>
.bga-01, .bga-01 *, .bga-01 *::before, .bga-01 *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.bga-01 {
  min-height: 460px;
  display: grid;
  place-items: stretch;
}

.bga-01__scene {
  width: 100%;
  min-height: 460px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    130deg,
    #ff6b6b,
    #feca57,
    #48dbfb,
    #5f27cd,
    #ff9ff3,
    #00d2d3
  );
  background-size: 400% 400%;
  animation: bga-01-drift 16s ease-in-out infinite;
}

/* Second mesh layer using radial blobs for depth */
.bga-01__scene::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(40% 50% at 20% 30%, rgba(255,255,255,0.45), transparent 60%),
    radial-gradient(45% 45% at 80% 25%, rgba(95,39,205,0.55), transparent 55%),
    radial-gradient(50% 55% at 65% 80%, rgba(0,210,211,0.5), transparent 60%),
    radial-gradient(40% 40% at 25% 75%, rgba(254,202,87,0.5), transparent 55%);
  filter: blur(10px);
  mix-blend-mode: overlay;
  animation: bga-01-meshmove 20s ease-in-out infinite alternate;
}

/* Fine grain overlay */
.bga-01__scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.06;
  pointer-events: none;
  mix-blend-mode: overlay;
}

@keyframes bga-01-drift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes bga-01-meshmove {
  0%   { transform: translate3d(-3%, -2%, 0) rotate(0deg) scale(1.05); }
  100% { transform: translate3d(3%, 2%, 0) rotate(8deg) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .bga-01__scene,
  .bga-01__scene::before,
  .bga-01__scene::after {
    animation: none !important;
  }
}

Search CodeFronts

Loading…