Skip to content

Instantly share code, notes, and snippets.

@brian224
Created June 4, 2015 10:45
Show Gist options
  • Select an option

  • Save brian224/c471b3b7ae4393fd5353 to your computer and use it in GitHub Desktop.

Select an option

Save brian224/c471b3b7ae4393fd5353 to your computer and use it in GitHub Desktop.
gpmdJR
<div class="loading">
<ul class="animated">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul class="animated">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul class="animated">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul class="animated">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
@import "compass";
@import "compass/reset";
$unit : 10px;
body {
background : #333;
}
.loading {
width : 300px;
height : 300px;
position : relative;
}
ul {
margin : (-$unit*9) 0 0 (-$unit*9);
width : $unit*18;
height : $unit*18;
position : absolute;
top : 50%;
left : 50%;
&:first-child {
-webkit-animation-name : moveTop;
animation-name : moveTop;
}
&:nth-child(2) {
-webkit-animation-name : moveRight;
animation-name : moveRight;
}
&:nth-child(3) {
-webkit-animation-name : moveBottom;
animation-name : moveBottom;
}
&:nth-child(4) {
-webkit-animation-name : moveLeft;
animation-name : moveLeft;
}
}
li {
@include box-sizing(border-box);
display : block;
position : absolute;
top : 50%;
left : 50%;
border : 5px solid #e6e6dc;
border-radius : 50%;
@for $i from 1 through 9 {
&:nth-child(#{$i}) {
margin : (-$unit*$i) 0 0 (-$unit*$i);
width : $unit*$i*2;
height : $unit*$i*2;
}
}
}
.animated {
-webkit-animation-duration : 1.5s;
animation-duration : 1.5s;
-webkit-animation-fill-mode : both;
animation-fill-mode : both;
-webkit-animation : 2.5s infinite ease-in-out;
animation : 2.5s infinite ease-in-out;
}
@-webkit-keyframes moveTop {
0% {
top : 50%;
}
40% {
top : 40%;
}
60% {
top : 40%;
}
100% {
top : 50%;
}
}
@keyframes moveTop {
0% {
top : 50%;
}
40% {
top : 40%;
}
60% {
top : 40%;
}
100% {
top : 50%;
}
}
@-webkit-keyframes moveRight {
0% {
left : 50%;
}
40% {
left : 60%;
}
60% {
left : 60%;
}
100% {
left : 50%;
}
}
@keyframes moveRight {
0% {
left : 50%;
}
40% {
left : 60%;
}
60% {
left : 60%;
}
100% {
left : 50%;
}
}
@-webkit-keyframes moveBottom {
0% {
top : 50%;
}
40% {
top : 60%;
}
60% {
top : 60%;
}
100% {
top : 50%;
}
}
@keyframes moveBottom {
0% {
top : 50%;
}
40% {
top : 60%;
}
60% {
top : 60%;
}
100% {
top : 50%;
}
}
@-webkit-keyframes moveLeft {
0% {
left : 50%;
}
40% {
left : 40%;
}
60% {
left : 40%;
}
100% {
left : 50%;
}
}
@keyframes moveLeft {
0% {
left : 50%;
}
40% {
left : 40%;
}
60% {
left : 40%;
}
100% {
left : 50%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment