Created
February 5, 2014 14:18
-
-
Save priithaamer/8824488 to your computer and use it in GitHub Desktop.
Super simple CSS spinner generator using SCSS. Requires bourbon.io
This file contains hidden or 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="spinner"> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
<div></div> | |
</div> |
This file contains hidden or 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 '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