UNPKG

1.31 kBJavaScriptView Raw
1import { jsx } from '../../jsx';
2export default (function (props) {
3 var center = props.center,
4 startAngle = props.startAngle,
5 endAngle = props.endAngle,
6 r = props.r,
7 percent = props.percent,
8 ticks = props.ticks;
9 var x = center.x,
10 y = center.y;
11 var diff = endAngle - startAngle;
12 return jsx("group", null, jsx("arc", {
13 attrs: {
14 x: x,
15 y: y,
16 r: r,
17 startAngle: startAngle,
18 endAngle: endAngle,
19 lineWidth: '20px',
20 lineCap: 'round',
21 stroke: '#e7e7e7'
22 }
23 }), jsx("arc", {
24 attrs: {
25 x: x,
26 y: y,
27 r: r,
28 startAngle: startAngle,
29 endAngle: startAngle,
30 lineWidth: '40px',
31 lineCap: 'round',
32 stroke: '#0075ff'
33 },
34 animation: {
35 appear: {
36 easing: 'linear',
37 duration: 500,
38 property: ['endAngle'],
39 start: {
40 endAngle: startAngle
41 },
42 end: {
43 endAngle: startAngle + diff * percent
44 }
45 }
46 }
47 }), ticks.map(function (tick) {
48 var start = tick.start,
49 end = tick.end;
50 return jsx("line", {
51 attrs: {
52 x1: start.x,
53 y1: start.y,
54 x2: end.x,
55 y2: end.y,
56 lineWidth: '6px',
57 lineCap: 'round',
58 stroke: '#e7e7e7'
59 }
60 });
61 }));
62});
\No newline at end of file