UNPKG

1.43 kBJavaScriptView Raw
1import { jsx } from '@antv/f-engine';
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 cx: x,
15 cy: y,
16 r: r,
17 startAngle: "".concat(startAngle, " rad"),
18 endAngle: "".concat(endAngle, " rad"),
19 lineWidth: '20px',
20 lineCap: 'round',
21 stroke: '#e7e7e7'
22 }
23 }), jsx("arc", {
24 attrs: {
25 cx: x,
26 cy: y,
27 r: r,
28 startAngle: "".concat(startAngle, " rad"),
29 endAngle: "".concat(startAngle, " rad"),
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: "".concat(startAngle, " rad")
41 },
42 end: {
43 endAngle: "".concat(startAngle + diff * percent, " rad")
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