-
Notifications
You must be signed in to change notification settings - Fork 18
/
md-preloader.less
70 lines (62 loc) · 1.65 KB
/
md-preloader.less
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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 ([email protected])
* 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;
}
}
}