Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-interpolate

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-interpolate - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

src/bind.js

2

build/bundle.js

@@ -1,1 +0,1 @@

var version = "0.2.1"; export * from "../index"; export {version};
var version = "0.3.0"; export * from "../index"; export {version};

@@ -7,47 +7,2 @@ (function (global, factory) {

function deltaHue(h1, h0) {
var delta = h1 - h0;
return delta > 180 || delta < -180
? delta - 360 * Math.round(delta / 360)
: delta;
};
function cubehelixGamma(gamma) {
return function(a, b) {
a = d3Color.cubehelix(a);
b = d3Color.cubehelix(b);
var ah = isNaN(a.h) ? b.h : a.h,
as = isNaN(a.s) ? b.s : a.s,
al = a.l,
bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),
bs = isNaN(b.s) ? 0 : b.s - as,
bl = b.l - al;
return function(t) {
a.h = ah + bh * t;
a.s = as + bs * t;
a.l = al + bl * Math.pow(t, gamma);
return a + "";
};
};
};
function cubehelixGammaLong(gamma) {
return function(a, b) {
a = d3Color.cubehelix(a);
b = d3Color.cubehelix(b);
var ah = isNaN(a.h) ? b.h : a.h,
as = isNaN(a.s) ? b.s : a.s,
al = a.l,
bh = isNaN(b.h) ? 0 : b.h - ah,
bs = isNaN(b.s) ? 0 : b.s - as,
bl = b.l - al;
return function(t) {
a.h = ah + bh * t;
a.s = as + bs * t;
a.l = al + bl * Math.pow(t, gamma);
return a + "";
};
};
};
function rgb(a, b) {

@@ -372,2 +327,9 @@ a = d3Color.rgb(a);

function deltaHue(h1, h0) {
var delta = h1 - h0;
return delta > 180 || delta < -180
? delta - 360 * Math.round(delta / 360)
: delta;
};
function hsl(a, b) {

@@ -458,12 +420,58 @@ a = d3Color.hsl(a);

var cubehelix = cubehelixGamma(1);
var cubehelixLong = cubehelixGammaLong(1);
function cubehelix(a, b, gamma) {
if (arguments.length < 3) gamma = 1;
a = d3Color.cubehelix(a);
b = d3Color.cubehelix(b);
var ah = isNaN(a.h) ? b.h : a.h,
as = isNaN(a.s) ? b.s : a.s,
al = a.l,
bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),
bs = isNaN(b.s) ? 0 : b.s - as,
bl = b.l - al;
return function(t) {
a.h = ah + bh * t;
a.s = as + bs * t;
a.l = al + bl * Math.pow(t, gamma);
return a + "";
};
};
var version = "0.2.1";
function cubehelixLong(a, b, gamma) {
if (arguments.length < 3) gamma = 1;
a = d3Color.cubehelix(a);
b = d3Color.cubehelix(b);
var ah = isNaN(a.h) ? b.h : a.h,
as = isNaN(a.s) ? b.s : a.s,
al = a.l,
bh = isNaN(b.h) ? 0 : b.h - ah,
bs = isNaN(b.s) ? 0 : b.s - as,
bl = b.l - al;
return function(t) {
a.h = ah + bh * t;
a.s = as + bs * t;
a.l = al + bl * Math.pow(t, gamma);
return a + "";
};
};
var slice = Array.prototype.slice;
function bindN(type, args) {
args = slice.call(args);
args[0] = null;
args.unshift(null);
return function(a, b) {
args[0] = a;
args[1] = b;
return type.apply(null, args);
};
}
function bind(type) {
return arguments.length === 1 ? type : bindN(type, arguments);
};
var version = "0.3.0";
exports.version = version;
exports.cubehelix = cubehelix;
exports.cubehelixLong = cubehelixLong;
exports.cubehelixGamma = cubehelixGamma;
exports.cubehelixGammaLong = cubehelixGammaLong;
exports.array = array;

@@ -484,3 +492,6 @@ exports.number = number;

exports.hclLong = hclLong;
exports.cubehelix = cubehelix;
exports.cubehelixLong = cubehelixLong;
exports.bind = bind;
}));

@@ -1,1 +0,1 @@

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-color")):"function"==typeof define&&define.amd?define("d3-interpolate",["exports","d3-color"],t):t(n.d3_interpolate={},n.d3_color)}(this,function(n,t){"use strict";function r(n,t){var r=n-t;return r>180||-180>r?r-360*Math.round(r/360):r}function e(n){return function(e,u){e=t.cubehelix(e),u=t.cubehelix(u);var i=isNaN(e.h)?u.h:e.h,a=isNaN(e.s)?u.s:e.s,o=e.l,s=isNaN(u.h)?0:r(u.h,i),h=isNaN(u.s)?0:u.s-a,c=u.l-o;return function(t){return e.h=i+s*t,e.s=a+h*t,e.l=o+c*Math.pow(t,n),e+""}}}function u(n){return function(r,e){r=t.cubehelix(r),e=t.cubehelix(e);var u=isNaN(r.h)?e.h:r.h,i=isNaN(r.s)?e.s:r.s,a=r.l,o=isNaN(e.h)?0:e.h-u,s=isNaN(e.s)?0:e.s-i,h=e.l-a;return function(t){return r.h=u+o*t,r.s=i+s*t,r.l=a+h*Math.pow(t,n),r+""}}}function i(n,r){n=t.rgb(n),r=t.rgb(r);var e=n.r,u=n.g,i=n.b,a=r.r-e,o=r.g-u,s=r.b-i;return function(t){return n.r=e+a*t,n.g=u+o*t,n.b=i+s*t,n+""}}function a(n,t){return n=+n,t-=n,function(r){return n+t*r}}function o(n,t){var r,e={},u={};for(r in n)r in t?e[r]=l(n[r],t[r]):u[r]=n[r];for(r in t)r in n||(u[r]=t[r]);return function(n){for(r in e)u[r]=e[r](n);return u}}function s(n){return function(){return n}}function h(n){return function(t){return n(t)+""}}function c(n,t){var r,e,u,i=X.lastIndex=_.lastIndex=0,o=-1,c=[],l=[];for(n+="",t+="";(r=X.exec(n))&&(e=_.exec(t));)(u=e.index)>i&&(u=t.slice(i,u),c[o]?c[o]+=u:c[++o]=u),(r=r[0])===(e=e[0])?c[o]?c[o]+=e:c[++o]=e:(c[++o]=null,l.push({i:o,x:a(r,e)})),i=_.lastIndex;return i<t.length&&(u=t.slice(i),c[o]?c[o]+=u:c[++o]=u),c.length<2?l[0]?h(l[0].x):s(t):(t=l.length,function(n){for(var r,e=0;t>e;++e)c[(r=l[e]).i]=r.x(n);return c.join("")})}function l(n,t){for(var r,e=z.length;--e>=0&&!(r=z[e](n,t)););return r}function f(n,t){var r,e=[],u=[],i=n.length,a=t.length,o=Math.min(n.length,t.length);for(r=0;o>r;++r)e.push(l(n[r],t[r]));for(;i>r;++r)u[r]=n[r];for(;a>r;++r)u[r]=t[r];return function(n){for(r=0;o>r;++r)u[r]=e[r](n);return u}}function N(n,t){return n=+n,t-=n,function(r){return Math.round(n+t*r)}}function p(n){S||(S=document.createElementNS("http://www.w3.org/2000/svg","g")),n&&(S.setAttribute("transform",n),t=S.transform.baseVal.consolidate());var t,r=t?t.matrix:Q,e=[r.a,r.b],u=[r.c,r.d],i=g(e),a=x(e,u),o=g(v(u,e,-a))||0;e[0]*u[1]<u[0]*e[1]&&(e[0]*=-1,e[1]*=-1,i*=-1,a*=-1),this.rotate=(i?Math.atan2(e[1],e[0]):Math.atan2(-u[0],u[1]))*P,this.translate=[r.e,r.f],this.scale=[i,o],this.skew=o?Math.atan2(a,o)*P:0}function x(n,t){return n[0]*t[0]+n[1]*t[1]}function g(n){var t=Math.sqrt(x(n,n));return t&&(n[0]/=t,n[1]/=t),t}function v(n,t,r){return n[0]+=r*t[0],n[1]+=r*t[1],n}function b(n){return n.length?n.pop()+",":""}function d(n,t,r,e){if(n[0]!==t[0]||n[1]!==t[1]){var u=r.push("translate(",null,",",null,")");e.push({i:u-4,x:a(n[0],t[0])},{i:u-2,x:a(n[1],t[1])})}else(t[0]||t[1])&&r.push("translate("+t+")")}function M(n,t,r,e){n!==t?(n-t>180?t+=360:t-n>180&&(n+=360),e.push({i:r.push(b(r)+"rotate(",null,")")-2,x:a(n,t)})):t&&r.push(b(r)+"rotate("+t+")")}function m(n,t,r,e){n!==t?e.push({i:r.push(b(r)+"skewX(",null,")")-2,x:a(n,t)}):t&&r.push(b(r)+"skewX("+t+")")}function w(n,t,r,e){if(n[0]!==t[0]||n[1]!==t[1]){var u=r.push(b(r)+"scale(",null,",",null,")");e.push({i:u-4,x:a(n[0],t[0])},{i:u-2,x:a(n[1],t[1])})}else(1!==t[0]||1!==t[1])&&r.push(b(r)+"scale("+t+")")}function y(n,t){var r=[],e=[];return n=new p(n),t=new p(t),d(n.translate,t.translate,r,e),M(n.rotate,t.rotate,r,e),m(n.skew,t.skew,r,e),w(n.scale,t.scale,r,e),n=t=null,function(n){for(var t,u=-1,i=e.length;++u<i;)r[(t=e[u]).i]=t.x(n);return r.join("")}}function j(n){return((n=Math.exp(n))+1/n)/2}function k(n){return((n=Math.exp(n))-1/n)/2}function q(n){return((n=Math.exp(2*n))-1)/(n+1)}function I(n,t){var r,e,u=n[0],i=n[1],a=n[2],o=t[0],s=t[1],h=t[2],c=o-u,l=s-i,f=c*c+l*l;if(C>f)e=Math.log(h/a)/T,r=function(n){return[u+n*c,i+n*l,a*Math.exp(T*n*e)]};else{var N=Math.sqrt(f),p=(h*h-a*a+B*f)/(2*a*V*N),x=(h*h-a*a-B*f)/(2*h*V*N),g=Math.log(Math.sqrt(p*p+1)-p),v=Math.log(Math.sqrt(x*x+1)-x);e=(v-g)/T,r=function(n){var t=n*e,r=j(g),o=a/(V*N)*(r*q(T*t+g)-k(g));return[u+o*c,i+o*l,a*r/j(T*t+g)]}}return r.duration=1e3*e,r}function L(n,e){n=t.hsl(n),e=t.hsl(e);var u=isNaN(n.h)?e.h:n.h,i=isNaN(n.s)?e.s:n.s,a=n.l,o=isNaN(e.h)?0:r(e.h,u),s=isNaN(e.s)?0:e.s-i,h=e.l-a;return function(t){return n.h=u+o*t,n.s=i+s*t,n.l=a+h*t,n+""}}function A(n,r){n=t.hsl(n),r=t.hsl(r);var e=isNaN(n.h)?r.h:n.h,u=isNaN(n.s)?r.s:n.s,i=n.l,a=isNaN(r.h)?0:r.h-e,o=isNaN(r.s)?0:r.s-u,s=r.l-i;return function(t){return n.h=e+a*t,n.s=u+o*t,n.l=i+s*t,n+""}}function E(n,r){n=t.lab(n),r=t.lab(r);var e=n.l,u=n.a,i=n.b,a=r.l-e,o=r.a-u,s=r.b-i;return function(t){return n.l=e+a*t,n.a=u+o*t,n.b=i+s*t,n+""}}function G(n,e){n=t.hcl(n),e=t.hcl(e);var u=isNaN(n.h)?e.h:n.h,i=isNaN(n.c)?e.c:n.c,a=n.l,o=isNaN(e.h)?0:r(e.h,u),s=isNaN(e.c)?0:e.c-i,h=e.l-a;return function(t){return n.h=u+o*t,n.c=i+s*t,n.l=a+h*t,n+""}}function R(n,r){n=t.hcl(n),r=t.hcl(r);var e=isNaN(n.h)?r.h:n.h,u=isNaN(n.c)?r.c:n.c,i=n.l,a=isNaN(r.h)?0:r.h-e,o=isNaN(r.c)?0:r.c-u,s=r.l-i;return function(t){return n.h=e+a*t,n.c=u+o*t,n.l=i+s*t,n+""}}var S,X=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_=new RegExp(X.source,"g"),z=[function(n,r){var e,u=typeof r;return("string"===u?(e=t.color(r))?(r=e,i):c:r instanceof t.color?i:Array.isArray(r)?f:"object"===u&&isNaN(r)?o:a)(n,r)}],P=180/Math.PI,Q={a:1,b:0,c:0,d:1,e:0,f:0},T=Math.SQRT2,V=2,B=4,C=1e-12,D=e(1),F=u(1),H="0.2.1";n.version=H,n.cubehelix=D,n.cubehelixLong=F,n.cubehelixGamma=e,n.cubehelixGammaLong=u,n.array=f,n.number=a,n.object=o,n.round=N,n.string=c,n.transform=y,n.values=z,n.value=l,n.zoom=I,n.rgb=i,n.hsl=L,n.hslLong=A,n.lab=E,n.hcl=G,n.hclLong=R});
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-color")):"function"==typeof define&&define.amd?define("d3-interpolate",["exports","d3-color"],t):t(n.d3_interpolate={},n.d3_color)}(this,function(n,t){"use strict";function r(n,r){n=t.rgb(n),r=t.rgb(r);var e=n.r,u=n.g,i=n.b,a=r.r-e,s=r.g-u,o=r.b-i;return function(t){return n.r=e+a*t,n.g=u+s*t,n.b=i+o*t,n+""}}function e(n,t){return n=+n,t-=n,function(r){return n+t*r}}function u(n,t){var r,e={},u={};for(r in n)r in t?e[r]=o(n[r],t[r]):u[r]=n[r];for(r in t)r in n||(u[r]=t[r]);return function(n){for(r in e)u[r]=e[r](n);return u}}function i(n){return function(){return n}}function a(n){return function(t){return n(t)+""}}function s(n,t){var r,u,s,o=P.lastIndex=Q.lastIndex=0,l=-1,h=[],c=[];for(n+="",t+="";(r=P.exec(n))&&(u=Q.exec(t));)(s=u.index)>o&&(s=t.slice(o,s),h[l]?h[l]+=s:h[++l]=s),(r=r[0])===(u=u[0])?h[l]?h[l]+=u:h[++l]=u:(h[++l]=null,c.push({i:l,x:e(r,u)})),o=Q.lastIndex;return o<t.length&&(s=t.slice(o),h[l]?h[l]+=s:h[++l]=s),h.length<2?c[0]?a(c[0].x):i(t):(t=c.length,function(n){for(var r,e=0;t>e;++e)h[(r=c[e]).i]=r.x(n);return h.join("")})}function o(n,t){for(var r,e=T.length;--e>=0&&!(r=T[e](n,t)););return r}function l(n,t){var r,e=[],u=[],i=n.length,a=t.length,s=Math.min(n.length,t.length);for(r=0;s>r;++r)e.push(o(n[r],t[r]));for(;i>r;++r)u[r]=n[r];for(;a>r;++r)u[r]=t[r];return function(n){for(r=0;s>r;++r)u[r]=e[r](n);return u}}function h(n,t){return n=+n,t-=n,function(r){return Math.round(n+t*r)}}function c(n){z||(z=document.createElementNS("http://www.w3.org/2000/svg","g")),n&&(z.setAttribute("transform",n),t=z.transform.baseVal.consolidate());var t,r=t?t.matrix:B,e=[r.a,r.b],u=[r.c,r.d],i=N(e),a=f(e,u),s=N(g(u,e,-a))||0;e[0]*u[1]<u[0]*e[1]&&(e[0]*=-1,e[1]*=-1,i*=-1,a*=-1),this.rotate=(i?Math.atan2(e[1],e[0]):Math.atan2(-u[0],u[1]))*V,this.translate=[r.e,r.f],this.scale=[i,s],this.skew=s?Math.atan2(a,s)*V:0}function f(n,t){return n[0]*t[0]+n[1]*t[1]}function N(n){var t=Math.sqrt(f(n,n));return t&&(n[0]/=t,n[1]/=t),t}function g(n,t,r){return n[0]+=r*t[0],n[1]+=r*t[1],n}function p(n){return n.length?n.pop()+",":""}function x(n,t,r,u){if(n[0]!==t[0]||n[1]!==t[1]){var i=r.push("translate(",null,",",null,")");u.push({i:i-4,x:e(n[0],t[0])},{i:i-2,x:e(n[1],t[1])})}else(t[0]||t[1])&&r.push("translate("+t+")")}function d(n,t,r,u){n!==t?(n-t>180?t+=360:t-n>180&&(n+=360),u.push({i:r.push(p(r)+"rotate(",null,")")-2,x:e(n,t)})):t&&r.push(p(r)+"rotate("+t+")")}function v(n,t,r,u){n!==t?u.push({i:r.push(p(r)+"skewX(",null,")")-2,x:e(n,t)}):t&&r.push(p(r)+"skewX("+t+")")}function b(n,t,r,u){if(n[0]!==t[0]||n[1]!==t[1]){var i=r.push(p(r)+"scale(",null,",",null,")");u.push({i:i-4,x:e(n[0],t[0])},{i:i-2,x:e(n[1],t[1])})}else(1!==t[0]||1!==t[1])&&r.push(p(r)+"scale("+t+")")}function M(n,t){var r=[],e=[];return n=new c(n),t=new c(t),x(n.translate,t.translate,r,e),d(n.rotate,t.rotate,r,e),v(n.skew,t.skew,r,e),b(n.scale,t.scale,r,e),n=t=null,function(n){for(var t,u=-1,i=e.length;++u<i;)r[(t=e[u]).i]=t.x(n);return r.join("")}}function m(n){return((n=Math.exp(n))+1/n)/2}function w(n){return((n=Math.exp(n))-1/n)/2}function y(n){return((n=Math.exp(2*n))-1)/(n+1)}function j(n,t){var r,e,u=n[0],i=n[1],a=n[2],s=t[0],o=t[1],l=t[2],h=s-u,c=o-i,f=h*h+c*c;if(G>f)e=Math.log(l/a)/C,r=function(n){return[u+n*h,i+n*c,a*Math.exp(C*n*e)]};else{var N=Math.sqrt(f),g=(l*l-a*a+F*f)/(2*a*D*N),p=(l*l-a*a-F*f)/(2*l*D*N),x=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p);e=(d-x)/C,r=function(n){var t=n*e,r=m(x),s=a/(D*N)*(r*y(C*t+x)-w(x));return[u+s*h,i+s*c,a*r/m(C*t+x)]}}return r.duration=1e3*e,r}function k(n,t){var r=n-t;return r>180||-180>r?r-360*Math.round(r/360):r}function q(n,r){n=t.hsl(n),r=t.hsl(r);var e=isNaN(n.h)?r.h:n.h,u=isNaN(n.s)?r.s:n.s,i=n.l,a=isNaN(r.h)?0:k(r.h,e),s=isNaN(r.s)?0:r.s-u,o=r.l-i;return function(t){return n.h=e+a*t,n.s=u+s*t,n.l=i+o*t,n+""}}function A(n,r){n=t.hsl(n),r=t.hsl(r);var e=isNaN(n.h)?r.h:n.h,u=isNaN(n.s)?r.s:n.s,i=n.l,a=isNaN(r.h)?0:r.h-e,s=isNaN(r.s)?0:r.s-u,o=r.l-i;return function(t){return n.h=e+a*t,n.s=u+s*t,n.l=i+o*t,n+""}}function I(n,r){n=t.lab(n),r=t.lab(r);var e=n.l,u=n.a,i=n.b,a=r.l-e,s=r.a-u,o=r.b-i;return function(t){return n.l=e+a*t,n.a=u+s*t,n.b=i+o*t,n+""}}function E(n,r){n=t.hcl(n),r=t.hcl(r);var e=isNaN(n.h)?r.h:n.h,u=isNaN(n.c)?r.c:n.c,i=n.l,a=isNaN(r.h)?0:k(r.h,e),s=isNaN(r.c)?0:r.c-u,o=r.l-i;return function(t){return n.h=e+a*t,n.c=u+s*t,n.l=i+o*t,n+""}}function L(n,r){n=t.hcl(n),r=t.hcl(r);var e=isNaN(n.h)?r.h:n.h,u=isNaN(n.c)?r.c:n.c,i=n.l,a=isNaN(r.h)?0:r.h-e,s=isNaN(r.c)?0:r.c-u,o=r.l-i;return function(t){return n.h=e+a*t,n.c=u+s*t,n.l=i+o*t,n+""}}function R(n,r,e){arguments.length<3&&(e=1),n=t.cubehelix(n),r=t.cubehelix(r);var u=isNaN(n.h)?r.h:n.h,i=isNaN(n.s)?r.s:n.s,a=n.l,s=isNaN(r.h)?0:k(r.h,u),o=isNaN(r.s)?0:r.s-i,l=r.l-a;return function(t){return n.h=u+s*t,n.s=i+o*t,n.l=a+l*Math.pow(t,e),n+""}}function S(n,r,e){arguments.length<3&&(e=1),n=t.cubehelix(n),r=t.cubehelix(r);var u=isNaN(n.h)?r.h:n.h,i=isNaN(n.s)?r.s:n.s,a=n.l,s=isNaN(r.h)?0:r.h-u,o=isNaN(r.s)?0:r.s-i,l=r.l-a;return function(t){return n.h=u+s*t,n.s=i+o*t,n.l=a+l*Math.pow(t,e),n+""}}function X(n,t){return t=H.call(t),t[0]=null,t.unshift(null),function(r,e){return t[0]=r,t[1]=e,n.apply(null,t)}}function _(n){return 1===arguments.length?n:X(n,arguments)}var z,P=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Q=new RegExp(P.source,"g"),T=[function(n,i){var a,o=typeof i;return("string"===o?(a=t.color(i))?(i=a,r):s:i instanceof t.color?r:Array.isArray(i)?l:"object"===o&&isNaN(i)?u:e)(n,i)}],V=180/Math.PI,B={a:1,b:0,c:0,d:1,e:0,f:0},C=Math.SQRT2,D=2,F=4,G=1e-12,H=Array.prototype.slice,J="0.3.0";n.version=J,n.array=l,n.number=e,n.object=u,n.round=h,n.string=s,n.transform=M,n.values=T,n.value=o,n.zoom=j,n.rgb=r,n.hsl=q,n.hslLong=A,n.lab=I,n.hcl=E,n.hclLong=L,n.cubehelix=R,n.cubehelixLong=S,n.bind=_});

@@ -16,7 +16,4 @@ export {default as array} from "./src/array";

export {default as hclLong} from "./src/hclLong";
import cubehelixGamma from "./src/cubehelixGamma";
import cubehelixGammaLong from "./src/cubehelixGammaLong";
export var cubehelix = cubehelixGamma(1);
export var cubehelixLong = cubehelixGammaLong(1);
export {cubehelixGamma, cubehelixGammaLong};
export {default as cubehelix} from "./src/cubehelix";
export {default as cubehelixLong} from "./src/cubehelixLong";
export {default as bind} from "./src/bind";
{
"name": "d3-interpolate",
"version": "0.2.1",
"version": "0.3.0",
"description": "Interpolate numbers, colors, strings, arrays, objects, whatever!",

@@ -8,3 +8,4 @@ "keywords": [

"interpolate",
"interpolation"
"interpolation",
"color"
],

@@ -11,0 +12,0 @@ "homepage": "https://github.com/d3/d3-interpolate",

@@ -166,28 +166,29 @@ # d3-interpolate

<a name="cubehelix" href="#cubehelix">#</a> d3_interpolate.<b>cubehelix</b>(<i>a</i>, <i>b</i>)
<a name="cubehelix" href="#cubehelix">#</a> d3_interpolate.<b>cubehelix</b>(<i>a</i>, <i>b</i>[, <i>gamma</i>])
<img src="https://raw.githubusercontent.com/d3/d3-interpolate/master/img/cubehelix.png" width="100%" height="80" alt="cubehelix">
Returns a Cubehelix color space interpolator between the two colors *a* and *b* using the default *gamma* of 1.0. The colors *a* and *b* need not be in Cubehelix; they will be converted to Cubehelix using [color.cubehelix](https://github.com/d3/d3-color#cubehelix). If either color’s hue or saturation is NaN, the opposing color’s channel value is used. The shortest path between hues is used. The return value of the interpolator is a hexadecimal RGB string.
Or, with a gamma of 3.0 to emphasize high-intensity values:
<a name="cubehelixLong" href="#cubehelixLong">#</a> d3_interpolate.<b>cubehelixLong</b>(<i>a</i>, <i>b</i>)
<img src="https://raw.githubusercontent.com/d3/d3-interpolate/master/img/cubehelixGamma.png" width="100%" height="80" alt="cubehelixGamma">
Returns a Cubehelix color space interpolator between the two colors *a* and *b* using the specified *gamma*. If *gamma* is not specified, it defaults to 1.0. The colors *a* and *b* need not be in Cubehelix; they will be converted to Cubehelix using [color.cubehelix](https://github.com/d3/d3-color#cubehelix). If either color’s hue or saturation is NaN, the opposing color’s channel value is used. The shortest path between hues is used. The return value of the interpolator is a hexadecimal RGB string.
<a name="cubehelixLong" href="#cubehelixLong">#</a> d3_interpolate.<b>cubehelixLong</b>(<i>a</i>, <i>b</i>[, <i>gamma</i>])
<img src="https://raw.githubusercontent.com/d3/d3-interpolate/master/img/cubehelixLong.png" width="100%" height="80" alt="cubehelixLong">
Or, with a gamma of 3.0 to emphasize high-intensity values:
<img src="https://raw.githubusercontent.com/d3/d3-interpolate/master/img/cubehelixGammaLong.png" width="100%" height="80" alt="cubehelixGammaLong">
Like [cubehelix](#cubehelix), but does not use the shortest path between hues.
<a name="cubehelixGamma" href="#cubehelixGamma">#</a> d3_interpolate.<b>cubehelixGamma</b>(<i>gamma</i>)
<a name="bind" href="#bind">#</a> d3_interpolate.<b>bind</b>(<i>type</i>[, <i>parameters…</i>])
<img src="https://raw.githubusercontent.com/d3/d3-interpolate/master/img/cubehelixGamma.png" width="100%" height="80" alt="cubehelixGamma">
A convenience function for binding zero or more *parameters* to the specified interpolation function *type*. If no *parameters* are specified, this function simply returns *type*. The returned function takes two arguments *a* and *b* and passes any optional *parameters* to the underlying function *type*. For example, the following statements are equivalent:
Returns a Cubehelix color space interpolator factory using the specified *gamma*. A gamma value less than one emphasizes low intensity values, while a gamma value greater than one emphasizes high intensity values. For example:
```js
var i = d3_interpolate.cubehelixGamma(3)("purple", "orange");
d3_interpolate.bind(d3_interpolate.cubehelix, 3)("purple", "orange");
d3_interpolate.cubehelix("purple", "orange", 3);
```
<a name="cubehelixGammaLong" href="#cubehelixGammaLong">#</a> d3_interpolate.<b>cubehelixGammaLong</b>(<i>gamma</i>)
<img src="https://raw.githubusercontent.com/d3/d3-interpolate/master/img/cubehelixGammaLong.png" width="100%" height="80" alt="cubehelixGammaLong">
Like [cubehelixGamma](#cubehelixGamma), but does not use the shortest path between hues.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc