Spaces:
Running
Running
| class CustomPreloader extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| background: rgba(var(--color-dark), 1); | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: center; | |
| align-items: center; | |
| z-index: 9999; | |
| transition: opacity 0.8s cubic-bezier(0.77, 0, 0.175, 1); | |
| } | |
| .loader { | |
| width: 80px; | |
| height: 80px; | |
| position: relative; | |
| } | |
| .loader-circle { | |
| position: absolute; | |
| width: 100%; | |
| height: 100%; | |
| border: 3px solid transparent; | |
| border-top-color: rgba(var(--color-primary), 1); | |
| border-radius: 50%; | |
| animation: spin 1.5s cubic-bezier(0.65, 0.05, 0.36, 1) infinite; | |
| } | |
| .loader-circle:nth-child(2) { | |
| border-top-color: rgba(var(--color-secondary), 1); | |
| animation-delay: 0.3s; | |
| width: 70%; | |
| height: 70%; | |
| top: 15%; | |
| left: 15%; | |
| } | |
| .loader-circle:nth-child(3) { | |
| border-top-color: rgba(var(--color-accent), 1); | |
| animation-delay: 0.6s; | |
| width: 50%; | |
| height: 50%; | |
| top: 25%; | |
| left: 25%; | |
| } | |
| @keyframes spin { | |
| 0% { transform: rotate(0deg); } | |
| 100% { transform: rotate(360deg); } | |
| } | |
| .progress-text { | |
| margin-top: 2rem; | |
| font-family: var(--font-mono); | |
| font-size: 0.875rem; | |
| color: rgba(255,255,255,0.7); | |
| letter-spacing: 0.1em; | |
| } | |
| </style> | |
| <div class="loader"> | |
| <div class="loader-circle"></div> | |
| <div class="loader-circle"></div> | |
| <div class="loader-circle"></div> | |
| </div> | |
| <div class="progress-text">LOADING PORTFOLIO</div> | |
| `; | |
| // Simulate loading | |
| setTimeout(() => { | |
| this.style.opacity = '0'; | |
| setTimeout(() => { | |
| this.remove(); | |
| }, 800); | |
| }, 2000); | |
| } | |
| } | |
| customElements.define('custom-preloader', CustomPreloader); |