class AnimatedHeader extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
this.createShapes();
}
createShapes() {
const shapesContainer = this.shadowRoot.getElementById('shapes');
for (let i = 0; i < 50; i++) {
const shape = document.createElement('div');
shape.className = 'shape';
const size = Math.random() * 100 + 20;
const left = Math.random() * 100;
const duration = Math.random() * 20 + 10;
const delay = Math.random() * 20;
shape.style.width = `${size}px`;
shape.style.height = `${size}px`;
shape.style.left = `${left}%`;
shape.style.animationDuration = `${duration}s`;
shape.style.animationDelay = `${delay}s`;
shape.style.opacity = Math.random() * 0.3 + 0.1;
shapesContainer.appendChild(shape);
}
}
}
customElements.define('animated-header', AnimatedHeader);