Colorful Orb Animation
Home
Snippets
Colorful Orb Animation
HTML
CSS
JS
<body></body>
* { margin: 0; padding: 0; box-sizing: border-box; } body { height: 100vh; background-color: #0e0e0e; overflow: hidden; display: flex; justify-content: center; align-items: center; } .orb { position: absolute; width: 70px; height: 70px; background: radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent 70%); border-radius: 50%; box-shadow: 0px 0px 20px rgba(255, 255, 255, 0.7); animation: float 6s ease-in-out infinite; } @keyframes float { 0% { transform: translate(0, 0) scale(1); } 25% { transform: translate(80px, -100px) scale(1.1); } 50% { transform: translate(-150px, 50px) scale(0.9); } 75% { transform: translate(100px, -30px) scale(1.2); } 100% { transform: translate(0, 0) scale(1); } }
const createOrb = (color) => { const orb = document.createElement('div'); orb.classList.add('orb'); orb.style.background = `radial-gradient(circle, ${color}, transparent 70%)`; orb.style.left = `${Math.random() * 100}vw`; orb.style.top = `${Math.random() * 100}vh`; orb.style.animationDelay = `${Math.random() * 3}s`; document.body.appendChild(orb); }; const colors = [ 'rgba(255, 99, 71, 0.8)', 'rgba(135, 206, 235, 0.8)', 'rgba(255, 215, 0, 0.8)', 'rgba(152, 251, 152, 0.8)', 'rgba(238, 130, 238, 0.8)', 'rgba(70, 130, 180, 0.8)' ]; colors.forEach(color => createOrb(color));
Ad #1
Ad #2
Scroll to Top