Sha256: 2655148e452e32062ea89c480d2cbcb5945703822a99f70f6d76702f135f85ac

Contents?: true

Size: 541 Bytes

Versions: 4

Compression:

Stored size: 541 Bytes

Contents

import "../color/hsl";

d3.interpolateHsl = d3_interpolateHsl;

function d3_interpolateHsl(a, b) {
  a = d3.hsl(a);
  b = d3.hsl(b);
  var ah = a.h,
      as = a.s,
      al = a.l,
      bh = b.h - ah,
      bs = b.s - as,
      bl = b.l - al;
  if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as;
  if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah;
  else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; // shortest path
  return function(t) {
    a.h = ah + bh * t;
    a.s = as + bs * t;
    a.l = al + bl * t;
    return a;
  };
}

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
stripchart-0.0.3 lib/stripchart/public/components/d3/src/interpolate/hsl.js
stripmem-0.0.3 lib/stripmem/public/components/d3/src/interpolate/hsl.js
stripmem-0.0.2 lib/stripmem/public/components/d3/src/interpolate/hsl.js
stripmem-0.0.1 lib/stripmem/public/components/d3/src/interpolate/hsl.js