1 <svg version=
"1" xmlns=
"http://www.w3.org/2000/svg"
2 xmlns:
xlink=
"http://www.w3.org/1999/xlink"
3 width=
"16px" height=
"16px" viewBox=
"0 0 28 28">
4 <!-- 28= RADIUS*2 + STROKEWIDTH -->
6 <title>Material design circular activity spinner with CSS3 animation
</title>
7 <style type=
"text/css">
8 /**************************/
9 /* STYLES FOR THE SPINNER */
10 /**************************/
16 * ARCSIZE =
270 degrees (amount of circle the arc takes up)
17 * ARCTIME =
1333ms (time it takes to expand and contract arc)
18 * ARCSTARTROT =
216 degrees (how much the start location of the arc
19 * should rotate each time,
216 gives us a
20 *
5 pointed star shape (it's
360/
5 *
2).
21 * For a
7 pointed star, we might do
22 *
360/
7 *
3 =
154.286)
28 width:
28px; /*
2*RADIUS + STROKEWIDTH */
29 height:
28px; /*
2*RADIUS + STROKEWIDTH */
31 .qp-circular-loader-path {
32 stroke-dasharray:
58.9; /*
2*RADIUS*PI * ARCSIZE/
360 */
33 stroke-dashoffset:
58.9; /*
2*RADIUS*PI * ARCSIZE/
360 */
34 /* hides things initially */
37 /* SVG elements seem to have a different default origin */
38 .qp-circular-loader, .qp-circular-loader * {
39 -webkit-transform-origin:
50%
50%;
42 /* Rotating the whole thing */
43 @-webkit-keyframes rotate {
44 from {-webkit-transform: rotate(
0deg);}
45 to {-webkit-transform: rotate(
360deg);}
48 -webkit-animation-name: rotate;
49 -webkit-animation-duration:
1568.63ms; /*
360 * ARCTIME / (ARCSTARTROT + (
360-ARCSIZE)) */
50 -webkit-animation-iteration-count: infinite;
51 -webkit-animation-timing-function: linear;
54 /* Filling and unfilling the arc */
55 @-webkit-keyframes fillunfill {
57 stroke-dashoffset:
58.8 /*
2*RADIUS*PI * ARCSIZE/
360 -
0.1 */
58 /*
0.1 a bit of a magic constant here */
64 stroke-dashoffset: -
58.4 /* -(
2*RADIUS*PI * ARCSIZE/
360 -
0.5) */
65 /*
0.5 a bit of a magic constant here */
68 @-webkit-keyframes rot {
70 -webkit-transform: rotate(
0deg);
73 -webkit-transform: rotate(-
360deg);
76 @-webkit-keyframes colors {
84 .qp-circular-loader-path {
85 -webkit-animation-name: fillunfill, rot, colors;
86 -webkit-animation-duration:
1333ms,
5332ms,
5332ms; /* ARCTIME,
4*ARCTIME,
4*ARCTIME */
87 -webkit-animation-iteration-count: infinite, infinite, infinite;
88 -webkit-animation-timing-function: cubic-bezier(
0.4,
0.0,
0.2,
1), steps(
4), linear;
89 -webkit-animation-play-state: running, running, running;
90 -webkit-animation-fill-mode: forwards;
95 <!-- 3= STROKEWIDTH -->
96 <!-- 14= RADIUS + STROKEWIDTH/2 -->
98 <!-- 1.5= STROKEWIDTH/2 -->
99 <!-- ARCSIZE would affect the 1.5,14 part of this... 1.5,14 is specific to
101 <g class=
"qp-circular-loader">
102 <path class=
"qp-circular-loader-path" fill=
"none"
103 d=
"M 14,1.5 A 12.5,12.5 0 1 1 1.5,14" stroke-width=
"3"
104 stroke-linecap=
"round"></path>