@easyv/charts 1.4.29 → 1.4.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/.babelrc +8 -8
  2. package/.husky/commit-msg +3 -3
  3. package/CHANGELOG.md +18 -18
  4. package/commitlint.config.js +1 -1
  5. package/lib/components/AnimateData.js +16 -8
  6. package/lib/components/Axis.js +134 -87
  7. package/lib/components/Background.js +26 -18
  8. package/lib/components/Band.js +98 -72
  9. package/lib/components/BaseLine.js +46 -33
  10. package/lib/components/Brush.js +46 -29
  11. package/lib/components/Carousel.js +40 -13
  12. package/lib/components/CartesianChart.js +146 -97
  13. package/lib/components/Chart.js +38 -24
  14. package/lib/components/ChartContainer.js +27 -18
  15. package/lib/components/ConicalGradient.js +89 -56
  16. package/lib/components/Control.js +28 -12
  17. package/lib/components/ExtentData.js +17 -9
  18. package/lib/components/FilterData.js +27 -16
  19. package/lib/components/Indicator.js +30 -23
  20. package/lib/components/Label.js +126 -96
  21. package/lib/components/Legend.js +66 -41
  22. package/lib/components/Lighter.js +50 -21
  23. package/lib/components/Line.js +59 -39
  24. package/lib/components/LinearGradient.js +22 -16
  25. package/lib/components/Mapping.js +34 -9
  26. package/lib/components/Marquee.js +30 -14
  27. package/lib/components/PieChart.js +420 -318
  28. package/lib/components/StackData.js +18 -8
  29. package/lib/components/StereoBar.js +105 -65
  30. package/lib/components/TextOverflow.js +21 -8
  31. package/lib/components/Tooltip.js +55 -41
  32. package/lib/components/index.js +29 -0
  33. package/lib/components/pieTooltip.js +67 -40
  34. package/lib/context/index.js +2 -0
  35. package/lib/css/index.module.css +42 -42
  36. package/lib/css/piechart.module.css +26 -26
  37. package/lib/element/ConicGradient.js +35 -29
  38. package/lib/element/Line.js +13 -9
  39. package/lib/element/index.js +2 -0
  40. package/lib/formatter/index.js +2 -0
  41. package/lib/formatter/legend.js +41 -30
  42. package/lib/hooks/index.js +9 -0
  43. package/lib/hooks/useAiData.js +20 -12
  44. package/lib/hooks/useAnimateData.js +21 -8
  45. package/lib/hooks/useAxes.js +117 -67
  46. package/lib/hooks/useCarouselAxisX.js +59 -26
  47. package/lib/hooks/useExtentData.js +47 -15
  48. package/lib/hooks/useFilterData.js +34 -13
  49. package/lib/hooks/useStackData.js +35 -12
  50. package/lib/hooks/useTooltip.js +53 -36
  51. package/lib/index.js +15 -0
  52. package/lib/utils/index.js +247 -95
  53. package/package.json +55 -55
  54. package/src/components/Axis.tsx +1 -1
  55. package/src/components/Background.tsx +61 -61
  56. package/src/components/Band.tsx +274 -274
  57. package/src/components/Brush.js +159 -159
  58. package/src/components/CartesianChart.js +1 -0
  59. package/src/components/Chart.js +101 -101
  60. package/src/components/ChartContainer.tsx +71 -71
  61. package/src/components/ConicalGradient.js +258 -258
  62. package/src/components/Control.jsx +51 -51
  63. package/src/components/ExtentData.js +17 -17
  64. package/src/components/Indicator.js +61 -61
  65. package/src/components/Label.js +275 -275
  66. package/src/components/Legend.js +165 -165
  67. package/src/components/Lighter.jsx +173 -173
  68. package/src/components/Line.js +150 -150
  69. package/src/components/LinearGradient.js +29 -29
  70. package/src/components/PieTooltip.jsx +160 -160
  71. package/src/components/StereoBar.tsx +307 -307
  72. package/src/components/index.js +59 -59
  73. package/src/context/index.js +2 -2
  74. package/src/css/index.module.css +42 -42
  75. package/src/css/piechart.module.css +26 -26
  76. package/src/element/ConicGradient.jsx +55 -55
  77. package/src/element/Line.tsx +33 -33
  78. package/src/element/index.ts +3 -3
  79. package/src/formatter/index.js +1 -1
  80. package/src/formatter/legend.js +92 -92
  81. package/src/hooks/index.js +20 -20
  82. package/src/hooks/useAnimateData.ts +67 -67
  83. package/src/hooks/useExtentData.js +1 -1
  84. package/src/hooks/useFilterData.js +72 -72
  85. package/src/hooks/useStackData.js +101 -101
  86. package/src/hooks/useTooltip.ts +100 -100
  87. package/src/index.js +6 -6
  88. package/src/types/index.d.ts +67 -67
  89. package/src/utils/index.js +757 -757
  90. package/tsconfig.json +23 -23
@@ -1,165 +1,165 @@
1
- /**
2
- * 图例
3
- */
4
- import React, { memo, useCallback } from 'react';
5
- import { getIcon, sortPie } from '../utils';
6
- import TextOverflow from './TextOverflow';
7
-
8
- const defaultFont = {
9
- fontStyle: 'normal',
10
- fontWeight: 'normal',
11
- };
12
-
13
- export default memo(
14
- ({
15
- series,
16
- config,
17
- config: {
18
- show,
19
- order = '',
20
- interactive,
21
- maxWidth,
22
- textOverflow,
23
- speed,
24
- layout: {
25
- alignment = 'right center',
26
- gridTemplateColumns,
27
- gridGap: { gridColumnGap, gridRowGap },
28
- translate: { x, y },
29
- },
30
- font: { italic, bold, ...font } = defaultFont,
31
- unselect: { opacity = 1 } = {},
32
- },
33
- filterData,
34
- formatter,
35
- judge
36
- }) => {
37
- if (!show) return null;
38
- const _series = sortPie(series, order);
39
- const [_alignment, position] = alignment.split(' ');
40
- const length = _series.length;
41
-
42
- const onClick = useCallback(
43
- (e) => {
44
- const { dataset } = e.currentTarget;
45
- const { name } = dataset;
46
- filterData && interactive && filterData(name);
47
- },
48
- [interactive, filterData]
49
- );
50
-
51
- if (judge == 0) {
52
- _series.forEach((d) => {
53
- d.percent=0
54
- })
55
- }
56
-
57
- return (
58
- <div
59
- className='__easyv-legend-wrapper'
60
- style={{
61
- position: 'absolute',
62
- height: 'auto',
63
- display: 'flex',
64
- transform: 'translate3d(' + x + 'px, ' + y + 'px, 0px)',
65
- ...getPosition(position, _alignment),
66
- }}
67
- >
68
- <ul
69
- style={{
70
- display: 'grid',
71
- gridGap: gridRowGap + 'px ' + gridColumnGap + 'px',
72
- gridTemplateColumns:
73
- 'repeat(' + Math.min(gridTemplateColumns, length) + ', 1fr)',
74
- }}
75
- >
76
- {_series.map((series, index) => {
77
- const { type, name, displayName, icon, selected } = series;
78
- const _icon = getIcon(type, icon, series?.config?.line?.type);
79
- return (
80
- <li
81
- key={index}
82
- onClick={onClick}
83
- data-name={name}
84
- style={{
85
- display: 'flex',
86
- opacity: selected === false ? opacity / 100 : 1,
87
- alignItems: 'center',
88
- gap: _icon.gap,
89
- }}
90
- >
91
- {formatter ? (
92
- formatter(series, config)
93
- ) : (
94
- <>
95
- <span style={_icon} />
96
- <TextOverflow type={textOverflow} value={displayName || name} style={{
97
- ...font,
98
- width:maxWidth,
99
- fontStyle: italic ? 'italic' : 'normal',
100
- fontWeight: bold ? 'bold' : 'normal',
101
- }} speed={speed}></TextOverflow>
102
-
103
- </>
104
- )}
105
- </li>
106
- );
107
- })}
108
- </ul>
109
- </div>
110
- );
111
- }
112
- );
113
-
114
- const getPosition = (position, alignment) => {
115
- switch (position) {
116
- case 'top':
117
- return {
118
- left: 0,
119
- right: 0,
120
- top: 5,
121
- justifyContent:
122
- alignment === 'center'
123
- ? 'center'
124
- : alignment === 'left'
125
- ? 'flex-start'
126
- : 'flex-end',
127
- };
128
- case 'right':
129
- return {
130
- top: 0,
131
- bottom: 0,
132
- right: 10,
133
- alignItems:
134
- alignment === 'center'
135
- ? 'center'
136
- : alignment === 'left'
137
- ? 'flex-start'
138
- : 'flex-end',
139
- };
140
- case 'left':
141
- return {
142
- top: 0,
143
- bottom: 0,
144
- left: 10,
145
- alignItems:
146
- alignment === 'center'
147
- ? 'center'
148
- : alignment === 'left'
149
- ? 'flex-start'
150
- : 'flex-end',
151
- };
152
- default:
153
- return {
154
- left: 0,
155
- right: 0,
156
- bottom: 5,
157
- justifyContent:
158
- alignment === 'center'
159
- ? 'center'
160
- : alignment === 'left'
161
- ? 'flex-start'
162
- : 'flex-end',
163
- };
164
- }
165
- };
1
+ /**
2
+ * 图例
3
+ */
4
+ import React, { memo, useCallback } from 'react';
5
+ import { getIcon, sortPie } from '../utils';
6
+ import TextOverflow from './TextOverflow';
7
+
8
+ const defaultFont = {
9
+ fontStyle: 'normal',
10
+ fontWeight: 'normal',
11
+ };
12
+
13
+ export default memo(
14
+ ({
15
+ series,
16
+ config,
17
+ config: {
18
+ show,
19
+ order = '',
20
+ interactive,
21
+ maxWidth,
22
+ textOverflow,
23
+ speed,
24
+ layout: {
25
+ alignment = 'right center',
26
+ gridTemplateColumns,
27
+ gridGap: { gridColumnGap, gridRowGap },
28
+ translate: { x, y },
29
+ },
30
+ font: { italic, bold, ...font } = defaultFont,
31
+ unselect: { opacity = 1 } = {},
32
+ },
33
+ filterData,
34
+ formatter,
35
+ judge
36
+ }) => {
37
+ if (!show) return null;
38
+ const _series = sortPie(series, order);
39
+ const [_alignment, position] = alignment.split(' ');
40
+ const length = _series.length;
41
+
42
+ const onClick = useCallback(
43
+ (e) => {
44
+ const { dataset } = e.currentTarget;
45
+ const { name } = dataset;
46
+ filterData && interactive && filterData(name);
47
+ },
48
+ [interactive, filterData]
49
+ );
50
+
51
+ if (judge == 0) {
52
+ _series.forEach((d) => {
53
+ d.percent=0
54
+ })
55
+ }
56
+
57
+ return (
58
+ <div
59
+ className='__easyv-legend-wrapper'
60
+ style={{
61
+ position: 'absolute',
62
+ height: 'auto',
63
+ display: 'flex',
64
+ transform: 'translate3d(' + x + 'px, ' + y + 'px, 0px)',
65
+ ...getPosition(position, _alignment),
66
+ }}
67
+ >
68
+ <ul
69
+ style={{
70
+ display: 'grid',
71
+ gridGap: gridRowGap + 'px ' + gridColumnGap + 'px',
72
+ gridTemplateColumns:
73
+ 'repeat(' + Math.min(gridTemplateColumns, length) + ', 1fr)',
74
+ }}
75
+ >
76
+ {_series.map((series, index) => {
77
+ const { type, name, displayName, icon, selected } = series;
78
+ const _icon = getIcon(type, icon, series?.config?.line?.type);
79
+ return (
80
+ <li
81
+ key={index}
82
+ onClick={onClick}
83
+ data-name={name}
84
+ style={{
85
+ display: 'flex',
86
+ opacity: selected === false ? opacity / 100 : 1,
87
+ alignItems: 'center',
88
+ gap: _icon.gap,
89
+ }}
90
+ >
91
+ {formatter ? (
92
+ formatter(series, config)
93
+ ) : (
94
+ <>
95
+ <span style={_icon} />
96
+ <TextOverflow type={textOverflow} value={displayName || name} style={{
97
+ ...font,
98
+ width:maxWidth,
99
+ fontStyle: italic ? 'italic' : 'normal',
100
+ fontWeight: bold ? 'bold' : 'normal',
101
+ }} speed={speed}></TextOverflow>
102
+
103
+ </>
104
+ )}
105
+ </li>
106
+ );
107
+ })}
108
+ </ul>
109
+ </div>
110
+ );
111
+ }
112
+ );
113
+
114
+ const getPosition = (position, alignment) => {
115
+ switch (position) {
116
+ case 'top':
117
+ return {
118
+ left: 0,
119
+ right: 0,
120
+ top: 5,
121
+ justifyContent:
122
+ alignment === 'center'
123
+ ? 'center'
124
+ : alignment === 'left'
125
+ ? 'flex-start'
126
+ : 'flex-end',
127
+ };
128
+ case 'right':
129
+ return {
130
+ top: 0,
131
+ bottom: 0,
132
+ right: 10,
133
+ alignItems:
134
+ alignment === 'center'
135
+ ? 'center'
136
+ : alignment === 'left'
137
+ ? 'flex-start'
138
+ : 'flex-end',
139
+ };
140
+ case 'left':
141
+ return {
142
+ top: 0,
143
+ bottom: 0,
144
+ left: 10,
145
+ alignItems:
146
+ alignment === 'center'
147
+ ? 'center'
148
+ : alignment === 'left'
149
+ ? 'flex-start'
150
+ : 'flex-end',
151
+ };
152
+ default:
153
+ return {
154
+ left: 0,
155
+ right: 0,
156
+ bottom: 5,
157
+ justifyContent:
158
+ alignment === 'center'
159
+ ? 'center'
160
+ : alignment === 'left'
161
+ ? 'flex-start'
162
+ : 'flex-end',
163
+ };
164
+ }
165
+ };
@@ -1,173 +1,173 @@
1
- /**
2
- * 区域图发光跟踪路径
3
- */
4
- import React, {
5
- useState,
6
- useEffect,
7
- useRef,
8
- useCallback,
9
- useMemo,
10
- } from 'react';
11
- import { scaleLinear } from 'd3v7';
12
- import { getColorList } from '../utils';
13
- import { svgPathProperties } from 'svg-path-properties';
14
-
15
- export default ({
16
- path: d,
17
- config,
18
- config: { length: curveLength, width, fill, unitStep },
19
- }) => {
20
- const pointIndexRef = useRef(0);
21
- const raf = useRef(null);
22
- const [points, setPoints] = useState([]);
23
- const [lighter, setLighter] = useState(null);
24
- const pointLength = points.length;
25
- const totalLength = getLength(pointLength, curveLength);
26
- const easingFunc = easing.linear;
27
-
28
- const interpolateList = useMemo(
29
- () => getColorsInterpolate(getColorList(fill)),
30
- [fill]
31
- );
32
-
33
- const drawLigher = useCallback(() => {
34
- const STEP = 2;
35
- const LOOP = false;
36
- if (lighter && lighter.children) {
37
- const currentPointLength = pointIndexRef.current;
38
- const pointIndex =
39
- currentPointLength >= totalLength
40
- ? LOOP
41
- ? curveLength
42
- : 0
43
- : currentPointLength +
44
- unitStep +
45
- Math.floor(easingFunc(pointIndexRef.current / totalLength) * STEP);
46
-
47
- const overstep = pointIndex - pointLength;
48
- const startIndex = getPointIndex(pointIndex, pointLength, curveLength);
49
- const endIndex = getPointIndex(
50
- pointIndex + curveLength,
51
- pointLength,
52
- curveLength
53
- );
54
- const overstepPoints =
55
- LOOP && overstep > 0 ? points.slice(0, overstep) : [];
56
- drawCircle(
57
- Array.from(lighter.children),
58
- [...points.slice(startIndex, endIndex), ...overstepPoints],
59
- interpolateList
60
- );
61
-
62
- pointIndexRef.current = pointIndex;
63
- }
64
-
65
- raf.current = requestAnimationFrame(drawLigher);
66
- }, [lighter, totalLength, curveLength, unitStep, points, interpolateList]);
67
- useEffect(() => {
68
- const path = new svgPathProperties(d);
69
- const totalLength = path.getTotalLength();
70
- const points = [];
71
- for (let i = 0; i < totalLength; i++) {
72
- const { x, y } = path.getPointAtLength(i);
73
- points.push({
74
- index: i,
75
- x,
76
- y,
77
- });
78
- }
79
- setPoints(points);
80
- }, [d, config]);
81
-
82
- useEffect(() => {
83
- raf.current = requestAnimationFrame(drawLigher);
84
- return () => {
85
- cancelAnimationFrame(raf.current);
86
- };
87
- }, [drawLigher]);
88
- return (
89
- <g ref={setLighter}>
90
- {points.map(({ x, y }, index) => (
91
- <circle cx={x} cy={y} key={index} r={width} fill='none' />
92
- ))}
93
- </g>
94
- );
95
- };
96
-
97
- const drawCircle = (children, points, interpolateList) => {
98
- const pointLength = points.length;
99
- // const [startPoint] = points;
100
- // const startIndex = startPoint ? startPoint.index : 0;
101
- children.forEach((child, index) => {
102
- const pointIndex = points.findIndex(({ index: i }) => i == index);
103
- child.setAttribute(
104
- 'fill',
105
- pointIndex > -1
106
- ? getColor(
107
- pointIndex / pointLength, //TODO: 颜色插值尚需完善
108
- interpolateList
109
- )
110
- : 'none'
111
- );
112
- });
113
- };
114
- const getColor = (x, interpolateList) => {
115
- return interpolateList(x);
116
- };
117
- const getLength = (pointLength, length) => {
118
- if (length > pointLength) {
119
- return pointLength * 2;
120
- }
121
-
122
- return pointLength + length;
123
- };
124
-
125
- const getColorsInterpolate = (colors) => {
126
- const length = colors.length;
127
- if (!!(length < 2))
128
- return scaleLinear()
129
- .domain([0, 1])
130
- .range([colors[0].color || '#000', colors[0].color || '#000']);
131
- const linear = scaleLinear()
132
- .domain(colors.map((d) => d.offset))
133
- .range(colors.map((d) => d.color));
134
- return linear;
135
- };
136
- const easing = {
137
- linear() {
138
- return 0;
139
- },
140
-
141
- easeIn(k) {
142
- return Math.pow(k, 3);
143
- },
144
-
145
- easeOut(k) {
146
- return 1 - easing.easeIn(1 - k);
147
- },
148
-
149
- easeInOut(k) {
150
- return k < 0.5
151
- ? easing.easeIn(k * 2) / 2
152
- : 1 - easing.easeIn(2 - 2 * k) / 2;
153
- },
154
-
155
- easeOutIn(k) {
156
- return k < 0.5
157
- ? 0.5 * (1 - easing.easeIn(1 - 2 * k))
158
- : 0.5 * easing.easeIn(k * 2 - 1) + 0.5;
159
- },
160
- };
161
- const getPointIndex = (pointIndex, pointLength, curveLength) => {
162
- let index = pointIndex - curveLength;
163
-
164
- if (index < 0) {
165
- return 0;
166
- }
167
-
168
- if (index >= pointLength) {
169
- return pointLength - 1;
170
- }
171
-
172
- return index;
173
- };
1
+ /**
2
+ * 区域图发光跟踪路径
3
+ */
4
+ import React, {
5
+ useState,
6
+ useEffect,
7
+ useRef,
8
+ useCallback,
9
+ useMemo,
10
+ } from 'react';
11
+ import { scaleLinear } from 'd3v7';
12
+ import { getColorList } from '../utils';
13
+ import { svgPathProperties } from 'svg-path-properties';
14
+
15
+ export default ({
16
+ path: d,
17
+ config,
18
+ config: { length: curveLength, width, fill, unitStep },
19
+ }) => {
20
+ const pointIndexRef = useRef(0);
21
+ const raf = useRef(null);
22
+ const [points, setPoints] = useState([]);
23
+ const [lighter, setLighter] = useState(null);
24
+ const pointLength = points.length;
25
+ const totalLength = getLength(pointLength, curveLength);
26
+ const easingFunc = easing.linear;
27
+
28
+ const interpolateList = useMemo(
29
+ () => getColorsInterpolate(getColorList(fill)),
30
+ [fill]
31
+ );
32
+
33
+ const drawLigher = useCallback(() => {
34
+ const STEP = 2;
35
+ const LOOP = false;
36
+ if (lighter && lighter.children) {
37
+ const currentPointLength = pointIndexRef.current;
38
+ const pointIndex =
39
+ currentPointLength >= totalLength
40
+ ? LOOP
41
+ ? curveLength
42
+ : 0
43
+ : currentPointLength +
44
+ unitStep +
45
+ Math.floor(easingFunc(pointIndexRef.current / totalLength) * STEP);
46
+
47
+ const overstep = pointIndex - pointLength;
48
+ const startIndex = getPointIndex(pointIndex, pointLength, curveLength);
49
+ const endIndex = getPointIndex(
50
+ pointIndex + curveLength,
51
+ pointLength,
52
+ curveLength
53
+ );
54
+ const overstepPoints =
55
+ LOOP && overstep > 0 ? points.slice(0, overstep) : [];
56
+ drawCircle(
57
+ Array.from(lighter.children),
58
+ [...points.slice(startIndex, endIndex), ...overstepPoints],
59
+ interpolateList
60
+ );
61
+
62
+ pointIndexRef.current = pointIndex;
63
+ }
64
+
65
+ raf.current = requestAnimationFrame(drawLigher);
66
+ }, [lighter, totalLength, curveLength, unitStep, points, interpolateList]);
67
+ useEffect(() => {
68
+ const path = new svgPathProperties(d);
69
+ const totalLength = path.getTotalLength();
70
+ const points = [];
71
+ for (let i = 0; i < totalLength; i++) {
72
+ const { x, y } = path.getPointAtLength(i);
73
+ points.push({
74
+ index: i,
75
+ x,
76
+ y,
77
+ });
78
+ }
79
+ setPoints(points);
80
+ }, [d, config]);
81
+
82
+ useEffect(() => {
83
+ raf.current = requestAnimationFrame(drawLigher);
84
+ return () => {
85
+ cancelAnimationFrame(raf.current);
86
+ };
87
+ }, [drawLigher]);
88
+ return (
89
+ <g ref={setLighter}>
90
+ {points.map(({ x, y }, index) => (
91
+ <circle cx={x} cy={y} key={index} r={width} fill='none' />
92
+ ))}
93
+ </g>
94
+ );
95
+ };
96
+
97
+ const drawCircle = (children, points, interpolateList) => {
98
+ const pointLength = points.length;
99
+ // const [startPoint] = points;
100
+ // const startIndex = startPoint ? startPoint.index : 0;
101
+ children.forEach((child, index) => {
102
+ const pointIndex = points.findIndex(({ index: i }) => i == index);
103
+ child.setAttribute(
104
+ 'fill',
105
+ pointIndex > -1
106
+ ? getColor(
107
+ pointIndex / pointLength, //TODO: 颜色插值尚需完善
108
+ interpolateList
109
+ )
110
+ : 'none'
111
+ );
112
+ });
113
+ };
114
+ const getColor = (x, interpolateList) => {
115
+ return interpolateList(x);
116
+ };
117
+ const getLength = (pointLength, length) => {
118
+ if (length > pointLength) {
119
+ return pointLength * 2;
120
+ }
121
+
122
+ return pointLength + length;
123
+ };
124
+
125
+ const getColorsInterpolate = (colors) => {
126
+ const length = colors.length;
127
+ if (!!(length < 2))
128
+ return scaleLinear()
129
+ .domain([0, 1])
130
+ .range([colors[0].color || '#000', colors[0].color || '#000']);
131
+ const linear = scaleLinear()
132
+ .domain(colors.map((d) => d.offset))
133
+ .range(colors.map((d) => d.color));
134
+ return linear;
135
+ };
136
+ const easing = {
137
+ linear() {
138
+ return 0;
139
+ },
140
+
141
+ easeIn(k) {
142
+ return Math.pow(k, 3);
143
+ },
144
+
145
+ easeOut(k) {
146
+ return 1 - easing.easeIn(1 - k);
147
+ },
148
+
149
+ easeInOut(k) {
150
+ return k < 0.5
151
+ ? easing.easeIn(k * 2) / 2
152
+ : 1 - easing.easeIn(2 - 2 * k) / 2;
153
+ },
154
+
155
+ easeOutIn(k) {
156
+ return k < 0.5
157
+ ? 0.5 * (1 - easing.easeIn(1 - 2 * k))
158
+ : 0.5 * easing.easeIn(k * 2 - 1) + 0.5;
159
+ },
160
+ };
161
+ const getPointIndex = (pointIndex, pointLength, curveLength) => {
162
+ let index = pointIndex - curveLength;
163
+
164
+ if (index < 0) {
165
+ return 0;
166
+ }
167
+
168
+ if (index >= pointLength) {
169
+ return pointLength - 1;
170
+ }
171
+
172
+ return index;
173
+ };