MCPcopy Create free account
hub / github.com/breck7/scroll / piecewise

Function piecewise

external/.d3.js:4015–4023  ·  view source on GitHub ↗
(interpolate, values)

Source from the content-addressed store, hash-verified

4013var cubehelixLong = cubehelix$1(nogamma);
4014
4015function piecewise(interpolate, values) {
4016 if (values === undefined) values = interpolate, interpolate = interpolate$2;
4017 var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);
4018 while (i < n) I[i] = interpolate(v, v = values[++i]);
4019 return function(t) {
4020 var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
4021 return I[i](t - i);
4022 };
4023}
4024
4025function quantize$1(interpolator, n) {
4026 var samples = new Array(n);

Callers 3

scaleFunction · 0.85
transformer$2Function · 0.85
rangeFunction · 0.85

Calls 3

interpolateFunction · 0.85
maxMethod · 0.80
minMethod · 0.80

Tested by

no test coverage detected