1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.rgbBasisClosed = exports.rgbBasis = exports.default = void 0;
|
7 |
|
8 | var _index = require("../../../lib-vendor/d3-color/src/index.js");
|
9 |
|
10 | var _basis = _interopRequireDefault(require("./basis.js"));
|
11 |
|
12 | var _basisClosed = _interopRequireDefault(require("./basisClosed.js"));
|
13 |
|
14 | var _color = _interopRequireWildcard(require("./color.js"));
|
15 |
|
16 | function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
17 |
|
18 | function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
19 |
|
20 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21 |
|
22 | var _default = function rgbGamma(y) {
|
23 | var color = (0, _color.gamma)(y);
|
24 |
|
25 | function rgb(start, end) {
|
26 | var r = color((start = (0, _index.rgb)(start)).r, (end = (0, _index.rgb)(end)).r),
|
27 | g = color(start.g, end.g),
|
28 | b = color(start.b, end.b),
|
29 | opacity = (0, _color.default)(start.opacity, end.opacity);
|
30 | return function (t) {
|
31 | start.r = r(t);
|
32 | start.g = g(t);
|
33 | start.b = b(t);
|
34 | start.opacity = opacity(t);
|
35 | return start + "";
|
36 | };
|
37 | }
|
38 |
|
39 | rgb.gamma = rgbGamma;
|
40 | return rgb;
|
41 | }(1);
|
42 |
|
43 | exports.default = _default;
|
44 |
|
45 | function rgbSpline(spline) {
|
46 | return function (colors) {
|
47 | var n = colors.length,
|
48 | r = new Array(n),
|
49 | g = new Array(n),
|
50 | b = new Array(n),
|
51 | i,
|
52 | color;
|
53 |
|
54 | for (i = 0; i < n; ++i) {
|
55 | color = (0, _index.rgb)(colors[i]);
|
56 | r[i] = color.r || 0;
|
57 | g[i] = color.g || 0;
|
58 | b[i] = color.b || 0;
|
59 | }
|
60 |
|
61 | r = spline(r);
|
62 | g = spline(g);
|
63 | b = spline(b);
|
64 | color.opacity = 1;
|
65 | return function (t) {
|
66 | color.r = r(t);
|
67 | color.g = g(t);
|
68 | color.b = b(t);
|
69 | return color + "";
|
70 | };
|
71 | };
|
72 | }
|
73 |
|
74 | var rgbBasis = rgbSpline(_basis.default);
|
75 | exports.rgbBasis = rgbBasis;
|
76 | var rgbBasisClosed = rgbSpline(_basisClosed.default);
|
77 | exports.rgbBasisClosed = rgbBasisClosed; |
\ | No newline at end of file |