A Pen by Stavan Shah on CodePen.
Created
December 28, 2021 10:46
-
-
Save ShahStavan/ab6fafbb6409d1b3a5d9780b2199d254 to your computer and use it in GitHub Desktop.
RwLxBmX
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="container" id="animation"> | |
<h1 id="headline">ZENZZEN Under Maintenance</h1> | |
<div id="countdown"> | |
<ul> | |
<li><span id="days"></span>days</li> | |
<li><span id="hours"></span>Hours</li> | |
<li><span id="minutes"></span>Minutes</li> | |
<li><span id="seconds"></span>Seconds</li> | |
</ul> | |
</div> | |
</div> | |
<div class="loader"> | |
<div class="inner one"></div> | |
<div class="inner two"></div> | |
<div class="inner three"></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 () { | |
const second = 1000, | |
minute = second * 60, | |
hour = minute * 60, | |
day = hour * 24; | |
//I'm adding this section so I don't have to keep updating this pen every year :-) | |
//remove this if you don't need it | |
let today = new Date(), | |
dd = String(today.getDate()).padStart(2, "0"), | |
mm = String(today.getMonth() + 1).padStart(2, "0"), | |
yyyy = today.getFullYear(), | |
nextYear = yyyy + 1, | |
dayMonth = "01/8/", | |
birthday = dayMonth + yyyy; | |
today = mm + "/" + dd + "/" + yyyy; | |
if (today > birthday) { | |
birthday = dayMonth + nextYear; | |
} | |
//end | |
const countDown = new Date(birthday).getTime(), | |
x = setInterval(function() { | |
const now = new Date().getTime(), | |
distance = countDown - now; | |
document.getElementById("days").innerText = Math.floor(distance / (day)), | |
document.getElementById("hours").innerText = Math.floor((distance % (day)) / (hour)), | |
document.getElementById("minutes").innerText = Math.floor((distance % (hour)) / (minute)), | |
document.getElementById("seconds").innerText = Math.floor((distance % (minute)) / second); | |
//do something later when date is reached | |
if (distance < 0) { | |
document.getElementById("headline").innerText = "It's my birthday!"; | |
document.getElementById("countdown").style.display = "none"; | |
document.getElementById("content").style.display = "block"; | |
clearInterval(x); | |
} | |
//seconds | |
}, 0) | |
}()); |
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
/* general styling */ | |
:root { | |
--smaller: .75; | |
} | |
* { | |
box-sizing: border-box; | |
margin: 0; | |
padding: 0; | |
} | |
#countdown{ | |
margin-top:150px | |
} | |
html, body { | |
height: 100%; | |
margin: 0; | |
} | |
body { | |
align-items: center; | |
background-color: #ffffff; | |
display: flex; | |
font-family: -apple-system, | |
BlinkMacSystemFont, | |
"Segoe UI", | |
Roboto, | |
Oxygen-Sans, | |
Ubuntu, | |
Cantarell, | |
"Helvetica Neue", | |
sans-serif; | |
} | |
.container { | |
color: #333; | |
margin: 0 auto; | |
text-align: center; | |
} | |
h1 { | |
font-weight: normal; | |
letter-spacing: .125rem; | |
text-transform: uppercase; | |
} | |
li { | |
display: inline-block; | |
font-size: 1.5em; | |
list-style-type: none; | |
padding: 1em; | |
text-transform: uppercase; | |
} | |
li span { | |
display: block; | |
font-size: 4.5rem; | |
} | |
.loader { | |
position: absolute; | |
top: calc(50% - 32px); | |
left: calc(50% - 32px); | |
width: 64px; | |
height: 64px; | |
border-radius: 50%; | |
perspective: 800px; | |
} | |
.inner { | |
position: absolute; | |
box-sizing: border-box; | |
width: 100%; | |
height: 100%; | |
border-radius: 50%; | |
} | |
.inner.one { | |
left: 0%; | |
top: 0%; | |
animation: rotate-one 1s linear infinite; | |
border-bottom: 3px solid #EFEFFA; | |
} | |
.inner.two { | |
right: 0%; | |
top: 0%; | |
animation: rotate-two 1s linear infinite; | |
border-right: 3px solid #EFEFFA; | |
} | |
.inner.three { | |
right: 0%; | |
bottom: 0%; | |
animation: rotate-three 1s linear infinite; | |
border-top: 3px solid #EFEFFA; | |
} | |
@keyframes rotate-one { | |
0% { | |
transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg); | |
} | |
100% { | |
transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg); | |
} | |
} | |
@keyframes rotate-two { | |
0% { | |
transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg); | |
} | |
100% { | |
transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg); | |
} | |
} | |
@keyframes rotate-three { | |
0% { | |
transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg); | |
} | |
100% { | |
transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment