JSFiddle - React, Tailwind, and code Playground

by kthornbloom

HTML

<div class="background-layer"></div>
<div class="background-layer"></div>
<div class="background-layer"></div>

CSS

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: #1c2526; /* Darker base to enhance contrast */
  display: flex;
  justify-content: center;
  align-items: center;
  color: white; /* Optional: for text overlay */
}

.background-layer {
  position: absolute;
  width: 120%;
  height: 120%;
  background: radial-gradient(circle, rgba(75, 0, 130, 0.4), rgba(0, 0, 0, 0));
  filter: blur(60px);
  mix-blend-mode: overlay; /* Creates color interaction */
  animation: floatAndFade 20s infinite ease-in-out;
}

.background-layer:nth-child(2) {
  animation-delay: 6s;
  background: radial-gradient(
    circle,
    rgba(255, 105, 180, 0.4),
    rgba(0, 0, 0, 0)
  );
}

.background-layer:nth-child(3) {
  animation-delay: 12s;
  background: radial-gradient(circle, rgba(0, 128, 0, 0.4), rgba(0, 0, 0, 0));
}

@keyframes floatAndFade {
  0% {
    transform: translate(-50px, -50px) scale(1);
    opacity: 0.6;
  }
  25% {
    transform: translate(50px, 50px) scale(1.2);
    opacity: 0.8;
  }
  50% {
    transform: translate(-30px, 30px) scale(1.1);
    opacity: 0.7;
  }
  75% {
    transform: translate(30px, -30px) scale(1.3);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50px, -50px) scale(1);
    opacity: 0.6;
  }
}