@easyv/charts 1.2.1 → 1.2.2

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.
@@ -1,59 +1,59 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
- var _react = _interopRequireWildcard(require("react"));
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
-
20
- var event = function event() {};
21
-
22
- var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
23
- var width = _ref.width,
24
- height = _ref.height,
25
- marginLeft = _ref.marginLeft,
26
- marginTop = _ref.marginTop,
27
- style = _ref.style,
28
- children = _ref.children,
29
- _ref$onMouseEnter = _ref.onMouseEnter,
30
- onMouseEnter = _ref$onMouseEnter === void 0 ? event : _ref$onMouseEnter,
31
- _ref$onMouseLeave = _ref.onMouseLeave,
32
- onMouseLeave = _ref$onMouseLeave === void 0 ? event : _ref$onMouseLeave,
33
- _ref$onClick = _ref.onClick,
34
- onClick = _ref$onClick === void 0 ? event : _ref$onClick,
35
- _ref$onMouseMove = _ref.onMouseMove,
36
- onMouseMove = _ref$onMouseMove === void 0 ? event : _ref$onMouseMove,
37
- _ref$onMouseOut = _ref.onMouseOut,
38
- onMouseOut = _ref$onMouseOut === void 0 ? event : _ref$onMouseOut;
39
- return /*#__PURE__*/_react["default"].createElement("svg", {
40
- className: "__easyv-svg",
41
- width: width,
42
- height: height,
43
- onMouseEnter: onMouseEnter,
44
- onMouseLeave: onMouseLeave,
45
- onMouseOut: onMouseOut,
46
- onClick: onClick,
47
- onMouseMove: onMouseMove,
48
- ref: ref,
49
- style: _objectSpread({
50
- position: 'absolute',
51
- width: width,
52
- height: height
53
- }, style)
54
- }, /*#__PURE__*/_react["default"].createElement("g", {
55
- transform: 'translate(' + marginLeft + ', ' + marginTop + ')'
56
- }, children));
57
- }));
58
-
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
17
+
18
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
+
20
+ var event = function event() {};
21
+
22
+ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
23
+ var width = _ref.width,
24
+ height = _ref.height,
25
+ marginLeft = _ref.marginLeft,
26
+ marginTop = _ref.marginTop,
27
+ style = _ref.style,
28
+ children = _ref.children,
29
+ _ref$onMouseEnter = _ref.onMouseEnter,
30
+ onMouseEnter = _ref$onMouseEnter === void 0 ? event : _ref$onMouseEnter,
31
+ _ref$onMouseLeave = _ref.onMouseLeave,
32
+ onMouseLeave = _ref$onMouseLeave === void 0 ? event : _ref$onMouseLeave,
33
+ _ref$onClick = _ref.onClick,
34
+ onClick = _ref$onClick === void 0 ? event : _ref$onClick,
35
+ _ref$onMouseMove = _ref.onMouseMove,
36
+ onMouseMove = _ref$onMouseMove === void 0 ? event : _ref$onMouseMove,
37
+ _ref$onMouseOut = _ref.onMouseOut,
38
+ onMouseOut = _ref$onMouseOut === void 0 ? event : _ref$onMouseOut;
39
+ return /*#__PURE__*/_react["default"].createElement("svg", {
40
+ className: "__easyv-svg",
41
+ width: width,
42
+ height: height,
43
+ onMouseEnter: onMouseEnter,
44
+ onMouseLeave: onMouseLeave,
45
+ onMouseOut: onMouseOut,
46
+ onClick: onClick,
47
+ onMouseMove: onMouseMove,
48
+ ref: ref,
49
+ style: _objectSpread({
50
+ position: 'absolute',
51
+ width: width,
52
+ height: height
53
+ }, style)
54
+ }, /*#__PURE__*/_react["default"].createElement("g", {
55
+ transform: 'translate(' + marginLeft + ', ' + marginTop + ')'
56
+ }, children));
57
+ }));
58
+
59
59
  exports["default"] = _default;
@@ -1,162 +1,162 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
-
14
- var _react = _interopRequireWildcard(require("react"));
15
-
16
- var _d3v = require("d3v7");
17
-
18
- var _utils = require("@easyv/utils/lib/common/utils");
19
-
20
- var _indexModule = _interopRequireDefault(require("../css/index.module.css"));
21
-
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _d3v = require("d3v7");
17
+
18
+ var _utils = require("@easyv/utils/lib/common/utils");
19
+
20
+ var _indexModule = _interopRequireDefault(require("../css/index.module.css"));
21
+
22
22
  /**
23
23
  * 饼图装饰内圈
24
- */
25
- var _default = function _default(_ref) {
26
- var width = _ref.width,
27
- height = _ref.height,
28
- centerX = _ref.centerX,
29
- centerY = _ref.centerY,
30
- radius = _ref.radius,
31
- _ref$config = _ref.config,
32
- show = _ref$config.show,
33
- innerRadius = _ref$config.innerRadius,
34
- outerRadius = _ref$config.outerRadius,
35
- opacity = _ref$config.opacity,
36
- speed = _ref$config.speed,
37
- direction = _ref$config.direction,
38
- arcs = _ref.arcs;
39
- if (!show) return null;
40
-
41
- var _useState = (0, _react.useState)(null),
42
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
43
- canvas = _useState2[0],
44
- setCanvas = _useState2[1];
45
-
46
- (0, _react.useEffect)(function () {
47
- if (arcs && arcs.length > 0 && canvas && canvas.getContext('2d')) {
48
- var _radius = radius * devicePixelRatio;
49
-
50
- var context = canvas.getContext('2d');
51
- context.clearRect(0, 0, width * devicePixelRatio, height * devicePixelRatio);
52
- context.save();
53
- context.translate(centerX * devicePixelRatio, centerY * devicePixelRatio);
54
- context.beginPath();
55
-
56
- var _arc = (0, _d3v.arc)().innerRadius(innerRadius * _radius).outerRadius(outerRadius * _radius) // .padAngle(axis.pole.padAngle)
57
- // .cornerRadius(axis.pole.cornerRadius)
58
- .context(context);
59
-
60
- arcs.forEach(function (element) {
61
- var startAngle = element.arc.startAngle()();
62
- var endAngle = element.arc.endAngle()();
63
-
64
- _arc.startAngle(startAngle).endAngle(endAngle)();
65
-
66
- context.fillStyle = 'rgba(255, 255, 255, 0)';
67
- context.fill();
68
- });
69
- context.clip();
70
- context.rotate(-Math.PI / 2);
71
- var conic = new ConicalGradient();
72
- arcs.reduce(function (reduced, _ref2) {
73
- var percent = _ref2.percent,
74
- _ref2$series$color = _ref2.series.color,
75
- type = _ref2$series$color.type,
76
- pure = _ref2$series$color.pure,
77
- stops = _ref2$series$color.linear.stops;
78
- var result = reduced + percent / 100;
79
- var color = type == 'pure' ? pure : stops[0].color;
80
-
81
- if (!!color) {
82
- var _converColor = (0, _utils.converColor)(color, 1),
83
- r = _converColor.r,
84
- g = _converColor.g,
85
- b = _converColor.b,
86
- a = _converColor.a;
87
-
88
- conic.addColorStop(reduced, {
89
- r: r,
90
- g: g,
91
- b: b,
92
- a: 0
93
- });
94
- conic.addColorStop(result, {
95
- r: r,
96
- g: g,
97
- b: b,
98
- a: a
99
- });
100
- }
101
-
102
- return result;
103
- }, 0);
104
- conic.fill(context, 0, 0, _radius, 0, 2 * Math.PI, false);
105
- context.restore();
106
- }
107
- }, [canvas, radius, arcs, innerRadius, outerRadius]);
108
- return /*#__PURE__*/_react["default"].createElement("canvas", {
109
- className: direction == 'clockwise' ? _indexModule["default"].rotateClockwise : _indexModule["default"].rotateCounterClockwise,
110
- ref: setCanvas,
111
- width: width * devicePixelRatio,
112
- height: height * devicePixelRatio,
113
- style: {
114
- opacity: opacity / 100,
115
- width: width,
116
- height: height,
117
- pointerEvents: 'none',
118
- position: 'absolute',
119
- animationTimingFunction: 'linear',
120
- animationDuration: speed + 's',
121
- animationIterationCount: 'infinite',
122
- transformOrigin: centerX + 'px ' + centerY + 'px'
123
- }
124
- });
125
- };
24
+ */
25
+ var _default = function _default(_ref) {
26
+ var width = _ref.width,
27
+ height = _ref.height,
28
+ centerX = _ref.centerX,
29
+ centerY = _ref.centerY,
30
+ radius = _ref.radius,
31
+ _ref$config = _ref.config,
32
+ show = _ref$config.show,
33
+ innerRadius = _ref$config.innerRadius,
34
+ outerRadius = _ref$config.outerRadius,
35
+ opacity = _ref$config.opacity,
36
+ speed = _ref$config.speed,
37
+ direction = _ref$config.direction,
38
+ arcs = _ref.arcs;
39
+ if (!show) return null;
40
+
41
+ var _useState = (0, _react.useState)(null),
42
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
43
+ canvas = _useState2[0],
44
+ setCanvas = _useState2[1];
45
+
46
+ (0, _react.useEffect)(function () {
47
+ if (arcs && arcs.length > 0 && canvas && canvas.getContext('2d')) {
48
+ var _radius = radius * devicePixelRatio;
49
+
50
+ var context = canvas.getContext('2d');
51
+ context.clearRect(0, 0, width * devicePixelRatio, height * devicePixelRatio);
52
+ context.save();
53
+ context.translate(centerX * devicePixelRatio, centerY * devicePixelRatio);
54
+ context.beginPath();
55
+
56
+ var _arc = (0, _d3v.arc)().innerRadius(innerRadius * _radius).outerRadius(outerRadius * _radius) // .padAngle(axis.pole.padAngle)
57
+ // .cornerRadius(axis.pole.cornerRadius)
58
+ .context(context);
59
+
60
+ arcs.forEach(function (element) {
61
+ var startAngle = element.arc.startAngle()();
62
+ var endAngle = element.arc.endAngle()();
63
+
64
+ _arc.startAngle(startAngle).endAngle(endAngle)();
65
+
66
+ context.fillStyle = 'rgba(255, 255, 255, 0)';
67
+ context.fill();
68
+ });
69
+ context.clip();
70
+ context.rotate(-Math.PI / 2);
71
+ var conic = new ConicalGradient();
72
+ arcs.reduce(function (reduced, _ref2) {
73
+ var percent = _ref2.percent,
74
+ _ref2$series$color = _ref2.series.color,
75
+ type = _ref2$series$color.type,
76
+ pure = _ref2$series$color.pure,
77
+ stops = _ref2$series$color.linear.stops;
78
+ var result = reduced + percent / 100;
79
+ var color = type == 'pure' ? pure : stops[0].color;
80
+
81
+ if (!!color) {
82
+ var _converColor = (0, _utils.converColor)(color, 1),
83
+ r = _converColor.r,
84
+ g = _converColor.g,
85
+ b = _converColor.b,
86
+ a = _converColor.a;
87
+
88
+ conic.addColorStop(reduced, {
89
+ r: r,
90
+ g: g,
91
+ b: b,
92
+ a: 0
93
+ });
94
+ conic.addColorStop(result, {
95
+ r: r,
96
+ g: g,
97
+ b: b,
98
+ a: a
99
+ });
100
+ }
101
+
102
+ return result;
103
+ }, 0);
104
+ conic.fill(context, 0, 0, _radius, 0, 2 * Math.PI, false);
105
+ context.restore();
106
+ }
107
+ }, [canvas, radius, arcs, innerRadius, outerRadius]);
108
+ return /*#__PURE__*/_react["default"].createElement("canvas", {
109
+ className: direction == 'clockwise' ? _indexModule["default"].rotateClockwise : _indexModule["default"].rotateCounterClockwise,
110
+ ref: setCanvas,
111
+ width: width * devicePixelRatio,
112
+ height: height * devicePixelRatio,
113
+ style: {
114
+ opacity: opacity / 100,
115
+ width: width,
116
+ height: height,
117
+ pointerEvents: 'none',
118
+ position: 'absolute',
119
+ animationTimingFunction: 'linear',
120
+ animationDuration: speed + 's',
121
+ animationIterationCount: 'infinite',
122
+ transformOrigin: centerX + 'px ' + centerY + 'px'
123
+ }
124
+ });
125
+ };
126
126
  /**
127
127
  * ConicalGradient
128
- */
129
-
130
-
131
- exports["default"] = _default;
132
-
133
- function ConicalGradient() {
134
- this._offsets = [];
135
- this._colors = [];
136
- }
137
-
138
- ConicalGradient.prototype = {
128
+ */
129
+
130
+
131
+ exports["default"] = _default;
132
+
133
+ function ConicalGradient() {
134
+ this._offsets = [];
135
+ this._colors = [];
136
+ }
137
+
138
+ ConicalGradient.prototype = {
139
139
  /**
140
140
  * addColorStop
141
141
  *
142
142
  * @param {Number} offset
143
143
  * @param {Array} color RGBA值
144
- */
145
- addColorStop: function addColorStop(offset, color) {
146
- this._offsets.push(offset);
147
-
148
- this._colors.push(color);
149
-
150
- return this;
151
- },
152
-
144
+ */
145
+ addColorStop: function addColorStop(offset, color) {
146
+ this._offsets.push(offset);
147
+
148
+ this._colors.push(color);
149
+
150
+ return this;
151
+ },
152
+
153
153
  /**
154
154
  * _offsetsReverse (array.forEach callback)
155
- */
156
- _offsetsReverse: function _offsetsReverse(offset, index, array) {
157
- array[index] = 1 - offset;
158
- },
159
-
155
+ */
156
+ _offsetsReverse: function _offsetsReverse(offset, index, array) {
157
+ array[index] = 1 - offset;
158
+ },
159
+
160
160
  /**
161
161
  * fill
162
162
  *
@@ -167,99 +167,99 @@ ConicalGradient.prototype = {
167
167
  * @param {Number} startAngle
168
168
  * @param {Number} endAngle
169
169
  * @param {Boolean} anticlockwise
170
- */
171
- fill: function fill(context, x, y, radius, startAngle, endAngle, anticlockwise) {
172
- var offsets = this._offsets;
173
- var colors = this._colors;
174
- var PI = Math.PI;
175
- var TWO_PI = PI * 2;
176
- if (startAngle < 0) startAngle = startAngle % TWO_PI + TWO_PI;
177
- startAngle %= TWO_PI;
178
- if (endAngle < 0) endAngle = endAngle % TWO_PI + TWO_PI;
179
- endAngle %= TWO_PI;
180
-
181
- if (anticlockwise) {
182
- // 逆时针
183
- var swap = startAngle;
184
- startAngle = endAngle;
185
- endAngle = swap;
186
- colors.reverse();
187
- offsets.reverse();
188
- offsets.forEach(this._offsetsReverse);
189
- }
190
-
191
- if (startAngle > endAngle || Math.abs(endAngle - startAngle) < 0.0001) {
192
- endAngle += TWO_PI;
193
- }
194
-
195
- var colorsLength = colors.length;
196
- var currentColorIndex = 0;
197
- var currentColor = colors[currentColorIndex];
198
- var nextColor = colors[currentColorIndex];
199
- var prevOffset = 0;
200
- var currentOffset = offsets[currentColorIndex];
201
- var offsetDist = currentOffset - prevOffset;
202
- var totalAngleDeg = (endAngle - startAngle) * 180 / PI;
203
- var stepAngleRad = (endAngle - startAngle) / totalAngleDeg;
204
- var arcStartAngle = startAngle;
205
- var arcEndAngle;
206
- var r1 = currentColor.r,
207
- g1 = currentColor.g,
208
- b1 = currentColor.b,
209
- a1 = currentColor.a,
210
- r2 = nextColor.r,
211
- g2 = nextColor.g,
212
- b2 = nextColor.b,
213
- a2 = nextColor.a;
214
- if (!a1 && a1 !== 0) a1 = 1;
215
- if (!a2 && a2 !== 0) a2 = 1;
216
- var rd = r2 - r1,
217
- gd = g2 - g1,
218
- bd = b2 - b1,
219
- ad = a2 - a1;
220
- var t, r, g, b, a;
221
- context.save();
222
-
223
- for (var i = 0, n = 1 / totalAngleDeg; i < 1; i += n) {
224
- if (i >= currentOffset) {
225
- currentColorIndex++;
226
- currentColor = nextColor;
227
- r1 = currentColor.r;
228
- g1 = currentColor.g;
229
- b1 = currentColor.b;
230
- a1 = currentColor.a;
231
- if (!a1 && a1 !== 0) a1 = 1;
232
- nextColor = colors[currentColorIndex];
233
- r2 = nextColor.r;
234
- g2 = nextColor.g;
235
- b2 = nextColor.b;
236
- a2 = nextColor.a;
237
- if (!a2 && a2 !== 0) a2 = 1;
238
- rd = r2 - r1;
239
- gd = g2 - g1;
240
- bd = b2 - b1;
241
- ad = a2 - a1;
242
- prevOffset = currentOffset;
243
- currentOffset = offsets[currentColorIndex];
244
- offsetDist = currentOffset - prevOffset;
245
- }
246
-
247
- t = (i - prevOffset) / offsetDist;
248
- r = rd * t + r1 & 255;
249
- g = gd * t + g1 & 255;
250
- b = bd * t + b1 & 255;
251
- a = ad * t + a1;
252
- arcEndAngle = arcStartAngle + stepAngleRad;
253
- context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
254
- context.beginPath();
255
- context.moveTo(x, y);
256
- context.arc(x, y, radius, arcStartAngle - 0.02, arcEndAngle, false);
257
- context.closePath();
258
- context.fill();
259
- arcStartAngle += stepAngleRad;
260
- }
261
-
262
- context.restore();
263
- return this;
264
- }
170
+ */
171
+ fill: function fill(context, x, y, radius, startAngle, endAngle, anticlockwise) {
172
+ var offsets = this._offsets;
173
+ var colors = this._colors;
174
+ var PI = Math.PI;
175
+ var TWO_PI = PI * 2;
176
+ if (startAngle < 0) startAngle = startAngle % TWO_PI + TWO_PI;
177
+ startAngle %= TWO_PI;
178
+ if (endAngle < 0) endAngle = endAngle % TWO_PI + TWO_PI;
179
+ endAngle %= TWO_PI;
180
+
181
+ if (anticlockwise) {
182
+ // 逆时针
183
+ var swap = startAngle;
184
+ startAngle = endAngle;
185
+ endAngle = swap;
186
+ colors.reverse();
187
+ offsets.reverse();
188
+ offsets.forEach(this._offsetsReverse);
189
+ }
190
+
191
+ if (startAngle > endAngle || Math.abs(endAngle - startAngle) < 0.0001) {
192
+ endAngle += TWO_PI;
193
+ }
194
+
195
+ var colorsLength = colors.length;
196
+ var currentColorIndex = 0;
197
+ var currentColor = colors[currentColorIndex];
198
+ var nextColor = colors[currentColorIndex];
199
+ var prevOffset = 0;
200
+ var currentOffset = offsets[currentColorIndex];
201
+ var offsetDist = currentOffset - prevOffset;
202
+ var totalAngleDeg = (endAngle - startAngle) * 180 / PI;
203
+ var stepAngleRad = (endAngle - startAngle) / totalAngleDeg;
204
+ var arcStartAngle = startAngle;
205
+ var arcEndAngle;
206
+ var r1 = currentColor.r,
207
+ g1 = currentColor.g,
208
+ b1 = currentColor.b,
209
+ a1 = currentColor.a,
210
+ r2 = nextColor.r,
211
+ g2 = nextColor.g,
212
+ b2 = nextColor.b,
213
+ a2 = nextColor.a;
214
+ if (!a1 && a1 !== 0) a1 = 1;
215
+ if (!a2 && a2 !== 0) a2 = 1;
216
+ var rd = r2 - r1,
217
+ gd = g2 - g1,
218
+ bd = b2 - b1,
219
+ ad = a2 - a1;
220
+ var t, r, g, b, a;
221
+ context.save();
222
+
223
+ for (var i = 0, n = 1 / totalAngleDeg; i < 1; i += n) {
224
+ if (i >= currentOffset) {
225
+ currentColorIndex++;
226
+ currentColor = nextColor;
227
+ r1 = currentColor.r;
228
+ g1 = currentColor.g;
229
+ b1 = currentColor.b;
230
+ a1 = currentColor.a;
231
+ if (!a1 && a1 !== 0) a1 = 1;
232
+ nextColor = colors[currentColorIndex];
233
+ r2 = nextColor.r;
234
+ g2 = nextColor.g;
235
+ b2 = nextColor.b;
236
+ a2 = nextColor.a;
237
+ if (!a2 && a2 !== 0) a2 = 1;
238
+ rd = r2 - r1;
239
+ gd = g2 - g1;
240
+ bd = b2 - b1;
241
+ ad = a2 - a1;
242
+ prevOffset = currentOffset;
243
+ currentOffset = offsets[currentColorIndex];
244
+ offsetDist = currentOffset - prevOffset;
245
+ }
246
+
247
+ t = (i - prevOffset) / offsetDist;
248
+ r = rd * t + r1 & 255;
249
+ g = gd * t + g1 & 255;
250
+ b = bd * t + b1 & 255;
251
+ a = ad * t + a1;
252
+ arcEndAngle = arcStartAngle + stepAngleRad;
253
+ context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
254
+ context.beginPath();
255
+ context.moveTo(x, y);
256
+ context.arc(x, y, radius, arcStartAngle - 0.02, arcEndAngle, false);
257
+ context.closePath();
258
+ context.fill();
259
+ arcStartAngle += stepAngleRad;
260
+ }
261
+
262
+ context.restore();
263
+ return this;
264
+ }
265
265
  };