Skip to content

Commit

Permalink
Optimize.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Jun 24, 2014
1 parent 8d92702 commit fecbc79
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cubehelix/cubehelix.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
return function(t) {
var h = ah + bh * t,
l = Math.pow(al + bl * t, γ),
a = (as + bs * t) * l * (1 - l);
a = (as + bs * t) * l * (1 - l),
cosh = Math.cos(h),
sinh = Math.sin(h);
return "#"
+ hex(l + a * (-0.14861 * Math.cos(h) + 1.78277 * Math.sin(h)))
+ hex(l + a * (-0.29227 * Math.cos(h) - 0.90649 * Math.sin(h)))
+ hex(l + a * (+1.97294 * Math.cos(h)));
+ hex(l + a * (-0.14861 * cosh + 1.78277 * sinh))
+ hex(l + a * (-0.29227 * cosh - 0.90649 * sinh))
+ hex(l + a * (+1.97294 * cosh));
};
};
}
Expand Down

0 comments on commit fecbc79

Please sign in to comment.