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