glitch-countdown/dist/main.css

162 lines
3.2 KiB
CSS
Raw Normal View History

2023-10-30 12:39:00 +00:00
@font-face {
font-family: "SourceCodePro";
src: url('fonts/SourceCodePro-VariableFont_wght.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
* {
font-family: "SourceCodePro", sans-serif;
}
2023-10-29 22:24:20 +00:00
body {
background-color: black;
}
#countdown {
2023-10-30 12:39:00 +00:00
text-align: center;
2023-10-29 22:24:20 +00:00
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
2023-10-30 12:39:00 +00:00
width: 85vw;
height: 30vw;
2023-10-29 22:24:20 +00:00
}
2023-10-29 22:58:26 +00:00
#countdown .part {
2023-10-29 22:24:20 +00:00
display: inline-block;
2023-10-29 22:58:26 +00:00
position: relative;
2023-10-30 12:39:00 +00:00
padding-top: 3vw;
2023-10-29 22:24:20 +00:00
}
#countdown * {
2023-10-30 12:39:00 +00:00
font-size: 9vw;
color: white;
}
#countdown .separator {
font-size: 12vw;
}
#countdown.blink .separator {
opacity: 0;
2023-10-29 22:24:20 +00:00
}
#countdown input {
2023-10-30 12:39:00 +00:00
width: 11.2vw;
text-align: center;
height: 9.6vw;
background: transparent;
border: solid;
font-variant-numeric: tabular-nums;
}
#countdown #days input {
width: 17vw;
}
#countdown button {
position: relative;
display: block;
background-color: #222;
color: white;
margin-top: 4.5vw;
width: 100%;
border-radius: 0.45vw;
border: solid 1px grey;
transition: background-color 0.2s, border 0.2s;
}
#countdown button:hover {
background-color: black;
border: 1px white solid;
text-shadow: 0.05em 0 0 #00fffc, -0.03em -0.04em 0 #fc00ff,
0.025em 0.04em 0 #fffc00;
animation: glitch 725ms infinite;
}
#countdown button .layer {
width: 100%;
text-align: center;
position: absolute;
top: 0;
left: 0;
display: none;
}
#countdown button:hover .layer {
display: inline;
}
#countdown button .layer:first-of-type {
animation: glitch 500ms infinite;
clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
transform: translate(-0.04em, -0.03em);
opacity: 0.75;
}
#countdown button .layer:last-of-type {
animation: glitch 375ms infinite;
clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
transform: translate(0.04em, 0.03em);
opacity: 0.75;
}
#countdown input:disabled {
background: transparent;
2023-10-29 22:58:26 +00:00
}
#countdown .up, #countdown .down {
position: absolute;
2023-10-30 12:39:00 +00:00
line-height: 9vw;
width: 3.5vw;
2023-10-29 22:58:26 +00:00
text-align: center;
2023-10-30 12:39:00 +00:00
left: calc(50% - 1.5vw);
2023-10-29 22:58:26 +00:00
transform: rotate(90deg);
cursor: pointer;
}
#countdown .up {
2023-10-30 12:39:00 +00:00
top: calc(-2.5vw - 0.6vw);
2023-10-29 22:58:26 +00:00
}
#countdown .down {
2023-10-30 12:39:00 +00:00
top: calc(10vw + 0.6vw);
}
#countdown.counting .up, #countdown.counting .down {
display: none;
2023-10-30 12:39:00 +00:00
}
@keyframes glitch {
0% {
text-shadow: 0.05em 0 0 #00fffc, -0.03em -0.04em 0 #fc00ff,
0.025em 0.04em 0 #fffc00;
}
15% {
text-shadow: 0.05em 0 0 #00fffc, -0.03em -0.04em 0 #fc00ff,
0.025em 0.04em 0 #fffc00;
}
16% {
text-shadow: -0.05em -0.025em 0 #00fffc, 0.025em 0.035em 0 #fc00ff,
-0.05em -0.05em 0 #fffc00;
}
49% {
text-shadow: -0.05em -0.025em 0 #00fffc, 0.025em 0.035em 0 #fc00ff,
-0.05em -0.05em 0 #fffc00;
}
50% {
text-shadow: 0.05em 0.035em 0 #00fffc, 0.03em 0 0 #fc00ff,
0 -0.04em 0 #fffc00;
}
99% {
text-shadow: 0.05em 0.035em 0 #00fffc, 0.03em 0 0 #fc00ff,
0 -0.04em 0 #fffc00;
}
100% {
text-shadow: -0.05em 0 0 #00fffc, -0.025em -0.04em 0 #fc00ff,
-0.04em -0.025em 0 #fffc00;
}
}