<div class="loading-box">
<p class="loading-title">Loading</p>
<div class="loading-circle">
<p class="loading-count"><span id="loadingNumber">0</span>%</p>
</div>
</div>
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300&display=swap');
html, body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
body {
background: #1D1E22;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Quicksand';
}
.loading-box {
position: relative;
width: 300px;
height: 400px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #F0F8FF;
border-radius: 12px;
box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.5), -4px -4px 16px rgba(255, 255, 255, 0.05);
}
.loading-title {
font-size: 1.5em;
transform: translateY(-12px);
text-transform: uppercase;
letter-spacing: 4px;
font-weight: 300;
}
.loading-circle {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 180px;
height: 180px;
background: conic-gradient(from 0deg at 50% 50%, rgba(111, 123, 247, 1) 0%, rgba(155, 248, 244, 1) 0%, #101012 0%);
border-radius: 100px;
box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.75), -4px -4px 16px rgba(255, 255, 255, 0.1);
animation: spin 1s infinite linear;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.loading-count {
content: ' ';
display: flex;
justify-content: center;
align-items: center;
top: 3px;
left: 3px;
width: 174px;
height: 174px;
border-radius: 100px;
background: #1D1E22;
box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.75) inset, -4px -4px 16px rgba(255, 255, 255, 0.1) inset;
animation: spin 1s infinite linear reverse;
}
.loading-count #loadingNumber {
font-size: 4em;
}
const loadingNumber = document.querySelector('#loadingNumber');
const loadingCircle = document.querySelector('.loading-circle');
let load = 0;
setInterval(updateLoader, 150);
function updateLoader() {
load += (load < 100);
loadingNumber.innerHTML = load;
loadingCircle.style.background = 'conic-gradient(from 0deg at 50% 50%, rgba(111, 123, 247, 1) 0%, rgba(155, 248, 244, 1) ' + load + '%, #101012 ' + load + '%)'
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.