class FloatingElements extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` `; // Create floating elements this.createFloatingElements(); } createFloatingElements() { const colors = [ 'rgba(59, 130, 246, 0.15)', 'rgba(16, 185, 129, 0.15)', 'rgba(139, 92, 246, 0.15)', 'rgba(239, 68, 68, 0.15)', 'rgba(245, 158, 11, 0.15)' ]; for (let i = 0; i < 8; i++) { const element = document.createElement('div'); element.className = 'floating-element'; // Random properties const size = Math.random() * 300 + 100; const color = colors[Math.floor(Math.random() * colors.length)]; const left = Math.random() * 100; const top = Math.random() * 100; const delay = Math.random() * 20; const duration = 20 + Math.random() * 20; element.style.width = `${size}px`; element.style.height = `${size}px`; element.style.background = color; element.style.left = `${left}%`; element.style.top = `${top}%`; element.style.animationDelay = `${delay}s`; element.style.animationDuration = `${duration}s`; this.shadowRoot.appendChild(element); } } } customElements.define('floating-elements', FloatingElements);