Skip to content

Instantly share code, notes, and snippets.

@priithaamer
Created February 5, 2014 14:18
Show Gist options
  • Save priithaamer/8824488 to your computer and use it in GitHub Desktop.
Save priithaamer/8824488 to your computer and use it in GitHub Desktop.
Super simple CSS spinner generator using SCSS. Requires bourbon.io
<div class="spinner">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
@import 'bourbon';
.spinner {
$lines: 9;
$duration: 1;
$degree: (360 / $lines);
$tick: ($duration / $lines);
width: 200px;
height: 200px;
position: relative;
div {
@include animation-name(spinner-fade);
@include animation-duration(#{$duration}s);
@include animation-direction(liner);
@include animation-iteration-count(infinite);
@include animation-fill-mode(both);
@include animation-timing-function(ease-in-out);
background: #000;
position: absolute;
left: 45%;
top: 38.5%;
border-radius: 5px;
width: 10%;
height: 27%;
}
@for $i from 1 through $lines {
div:nth-child(#{$i}) {
@include transform(rotate(#{(($i - 1) * $degree)}deg) translate(0, -130%));
@include animation-delay(#{-(($duration - $i * $tick))}s);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment