Another CSS3 loading animation
Created
July 20, 2020 09:23
-
-
Save tpfwrz/5ed1f33ec7fb7d78470c649e89f4acff to your computer and use it in GitHub Desktop.
CSS3 Loading Animation
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"> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
<span></span> | |
</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
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> |
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
@import "compass/css3"; | |
$speed: 2.5s; | |
* { | |
margin: 0px; | |
padding: 0px; | |
border: 0px; | |
} | |
html, body { | |
min-height: 100%; | |
} | |
body { | |
background: radial-gradient(#eee,#444); | |
} | |
.loader { | |
position: absolute; | |
top: 0px; | |
bottom: 0px; | |
left: 0px; | |
right: 0px; | |
margin: auto; | |
width: 175px; | |
height: 100px; | |
span { | |
display: block; | |
background: #ccc; | |
width: 7px; | |
height: 10%; | |
border-radius: 14px; | |
margin-right: 5px; | |
float: left; | |
margin-top: 25%; | |
&:last-child { | |
margin-right: 0px; | |
} | |
&:nth-child(1) { | |
animation: load $speed 1.4s infinite linear; | |
} | |
&:nth-child(2) { | |
animation: load $speed 1.2s infinite linear; | |
} | |
&:nth-child(3) { | |
animation: load $speed 1s infinite linear; | |
} | |
&:nth-child(4) { | |
animation: load $speed 0.8s infinite linear; | |
} | |
&:nth-child(5) { | |
animation: load $speed 0.6s infinite linear; | |
} | |
&:nth-child(6) { | |
animation: load $speed 0.4s infinite linear; | |
} | |
&:nth-child(7) { | |
animation: load $speed 0.2s infinite linear; | |
} | |
&:nth-child(8) { | |
animation: load $speed 0s infinite linear; | |
} | |
&:nth-child(9) { | |
animation: load $speed 0.2s infinite linear; | |
} | |
&:nth-child(10) { | |
animation: load $speed 0.4s infinite linear; | |
} | |
&:nth-child(11) { | |
animation: load $speed 0.6s infinite linear; | |
} | |
&:nth-child(12) { | |
animation: load $speed 0.8s infinite linear; | |
} | |
&:nth-child(13) { | |
animation: load $speed 1s infinite linear; | |
} | |
&:nth-child(14) { | |
animation: load $speed 1.2s infinite linear; | |
} | |
&:nth-child(15) { | |
animation: load $speed 1.4s infinite linear; | |
} | |
} | |
} | |
@keyframes load { | |
0% { | |
background: #ccc; | |
margin-top: 25%; | |
height: 10%; | |
} | |
50% { | |
background: #444; | |
height: 100%; | |
margin-top: 0%; | |
} | |
100% { | |
background: #ccc; | |
height: 10%; | |
margin-top: 25%; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment