class CustomHero extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = `
REINVENTING REALITY
`; this.createParticles(); this.initParallax(); } createParticles() { const particleCount = 30; const colors = ['rgba(0, 198, 255, 0.5)', 'rgba(0, 114, 255, 0.5)', 'rgba(255, 255, 255, 0.3)']; for (let i = 0; i < particleCount; i++) { const particle = document.createElement('div'); particle.classList.add('particle'); // Random position const x = Math.random() * 100; const y = Math.random() * 100; // Random size const size = Math.random() * 2; // Random color const color = colors[Math.floor(Math.random() * colors.length)]; // Random animation const duration = 20 + Math.random() * 40; const delay = Math.random() * 10; particle.style.left = `${x}%`; particle.style.top = `${y}%`; particle.style.width = `${size}px`; particle.style.height = `${size}px`; particle.style.background = color; particle.style.animation = `float ${duration}s linear ${delay}s infinite`; // Add animation const keyframes = ` @keyframes float { 0% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(${Math.random() * 100 - 50}px, ${Math.random() * 100 - 50}px); opacity: 0; } } `; const style = document.createElement('style'); style.innerHTML = keyframes; this.shadowRoot.appendChild(style); this.shadowRoot.appendChild(particle); } } initParallax() { const logoContainer = this.shadowRoot.querySelector('.logo-container'); const tagline = this.shadowRoot.querySelector('.tagline'); const ctaContainer = this.shadowRoot.querySelector('.cta-container'); const scrollIndicator = this.shadowRoot.querySelector('.scroll-indicator'); window.addEventListener('scroll', () => { const scrollY = window.scrollY; const rotation = scrollY * 0.05; const translateY = scrollY * 0.1; if (logoContainer) logoContainer.style.transform = `translate(-50%, calc(-50% + ${translateY}px)) rotate(${rotation}deg)`; if (tagline) tagline.style.transform = `translate(-50%, calc(-50% + ${translateY}px))`; if (ctaContainer) ctaContainer.style.transform = `translate(-50%, calc(-50% + ${translateY * 0.8}px))`; if (scrollIndicator) scrollIndicator.style.opacity = `${1 - scrollY * 0.01}`; }); } } `; } } customElements.define('custom-hero', CustomHero);