CSS loading spinner
Created
February 17, 2019 02:51
-
-
Save rrmhearts/aaa03fe52485edd99243d94370d80256 to your computer and use it in GitHub Desktop.
Loading Clock 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="loader"> | |
<div class="inner one"></div> | |
<div class="inner two"></div> | |
<div class="time"> | |
<div id="hour"></div> | |
<div id="minute"></div> | |
<div id="second"></div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clocker() { | |
const fullDate = new Date(); | |
var hour = fullDate.getHours(); | |
if (hour < 10) | |
hour = "0" + hour; | |
var minutes = fullDate.getMinutes(); | |
if (minutes < 10) | |
minutes = "0" + minutes; | |
var seconds = fullDate.getSeconds(); | |
if (seconds < 10) | |
seconds = "0" + seconds; | |
document.getElementById('hour').innerHTML = hour + ""; | |
document.getElementById('minute').innerHTML = minutes + ""; | |
document.getElementById('second').innerHTML = seconds; | |
} | |
setInterval(clocker, 200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
height: 100%; | |
} | |
body { | |
background: #425666; | |
/* background-image: radial-gradient(circle farthest-corner at center, #425666 0%, #1C2620 100%);*/ | |
} | |
.loader { | |
position: absolute; | |
top: calc(40% - 32px); | |
left: calc(40% - 32px); | |
width: 200px; | |
height: 200px; | |
border-radius: 100%; | |
perspective: 800px; | |
} | |
.inner { | |
position: absolute; | |
box-sizing: border-box; | |
width: 100%; | |
height: 100%; | |
border-radius: 100%; | |
} | |
.inner.one { | |
left: 0%; | |
top: 0%; | |
animation: rotate-one 1s linear infinite; | |
border-bottom: 5px solid #EFEFFA; | |
} | |
.inner.two { | |
right: 0%; | |
top: 0%; | |
animation: rotate-two 60s linear infinite; | |
border-right: 5px solid #EFEFFA; | |
} | |
@keyframes rotate-one { | |
0% { | |
transform: rotateX(1deg) rotateY(-1deg) rotateZ(0deg); | |
} | |
100% { | |
transform: rotateX(1deg) rotateY(-1deg) rotateZ(360deg); | |
} | |
} | |
@keyframes rotate-two { | |
0% { | |
transform: rotateX(1deg) rotateY(-1deg) rotateZ(0deg); | |
} | |
100% { | |
transform: rotateX(1deg) rotateY(-1deg) rotateZ(360deg); | |
} | |
} | |
.time { | |
position: relative; | |
top: 38px; | |
left: 0px; | |
text-align: center; | |
font-size: 36px; | |
color: white; | |
height: 100%; | |
text-align: center; | |
opacity: 0.8 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment