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