Skip to content

Commit

Permalink
Add SCSS source
Browse files Browse the repository at this point in the history
  • Loading branch information
princeofpensia authored Jun 13, 2016
1 parent 7df22d9 commit 51500a3
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions md-preloader.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* Google Material Design Preloader
*
* CSS animated SVG implementation of the Google Material Design preloader
*
* Reference: http://goo.gl/ZfulRH
* License: MIT
* Author: Rudi Theunissen (rudolf.theunissen$gmail.com)
* Version: 1.1.1
*/
.md-preloader {
$easing: cubic-bezier(.8,.0,.4,.8);

$speed: 1320ms; // animation time for each loop
$color: #448AFF; // Blue A200 in the Material Design color palette
$linecap: square; // could be 'round', but the official one is square
$loops: 5; // number of points where the arc meets
$arc: 0.72; // fraction of the circumference that the arc grows to
$perimeter: 67px * pi(); // circumference of the raw svg inner cricle

// measure to prevent inline block spacing from affecting the outer rotation
font-size: 0;

display: inline-block;
animation: outer $speed * $loops linear infinite;

svg {
animation: inner $speed linear infinite;

circle {
fill: none;
stroke: $color;
stroke-linecap: $linecap;
animation: arc $speed $easing infinite;
}
}

@keyframes outer {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}

@keyframes inner {
0% {
transform: rotate(-360deg * (1 - $arc));
}
100% {
transform: rotate(0);
}
}

@keyframes arc {
0% {
stroke-dasharray: 1 $perimeter;
stroke-dashoffset: 0;
}
40% {
stroke-dasharray: $arc * $perimeter, $perimeter;
stroke-dashoffset: 0;
}
100% {
stroke-dasharray: 1 $perimeter;
stroke-dashoffset: -$arc * $perimeter;
}
}
}

0 comments on commit 51500a3

Please sign in to comment.