Spaces:
Running

storeogencro / components /loading-screen.js
donceops's picture
hf download donceops/storeogencro --repo-type=space
6576277 verified
Raw History Blame
2.76 kB
class LoadingScreen extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #111827;
z-index: 9999;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
transition: opacity 0.5s ease;
}
.logo {
font-size: 3.5rem;
font-weight: 900;
margin-bottom: 2rem;
background: linear-gradient(90deg, #f59e0b, #ffffff, #fbbf24);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
opacity: 0;
transform: translateY(20px);
animation:
fadeIn 0.8s ease forwards 0.3s,
textGlow 2s ease infinite 1s;
text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}
@keyframes textGlow {
0% { text-shadow: 0 0 10px rgba(245, 158, 11, 0.3); }
50% { text-shadow: 0 0 20px rgba(245, 158, 11, 0.6); }
100% { text-shadow: 0 0 10px rgba(245, 158, 11, 0.3); }
}
.progress-container {
width: 300px;
height: 3px;
background: rgba(255, 255, 255, 0.1);
border-radius: 3px;
overflow: hidden;
}
.progress-bar {
height: 100%;
width: 0;
background: linear-gradient(90deg, #f59e0b, #fbbf24);
transition: width 0.3s ease;
}
.message {
margin-top: 1rem;
color: #fbbf24;
font-size: 0.9rem;
opacity: 0;
animation: fadeIn 0.5s ease forwards 0.6s;
}
@keyframes fadeIn {
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
<div class="logo">OG ENCRO</div>
<div class="progress-container">
<div class="progress-bar"></div>
</div>
<div class="message">Laster eksklusivt innhold...</div>
`;
// Simulate loading progress
const progressBar = this.shadowRoot.querySelector('.progress-bar');
let progress = 0;
const interval = setInterval(() => {
progress += Math.random() * 10;
progressBar.style.width = `${Math.min(progress, 100)}%`;
if (progress >= 100) {
clearInterval(interval);
setTimeout(() => {
this.style.opacity = '0';
setTimeout(() => {
this.remove();
}, 500);
}, 300);
}
}, 100);
}
}
customElements.define('loading-screen', LoadingScreen);