source: node_modules/d3-scale-chromatic/src/sequential-multi/sinebow.js

Last change on this file was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 316 bytes
RevLine 
[e4c61dd]1import {rgb} from "d3-color";
2
3var c = rgb(),
4 pi_1_3 = Math.PI / 3,
5 pi_2_3 = Math.PI * 2 / 3;
6
7export default function(t) {
8 var x;
9 t = (0.5 - t) * Math.PI;
10 c.r = 255 * (x = Math.sin(t)) * x;
11 c.g = 255 * (x = Math.sin(t + pi_1_3)) * x;
12 c.b = 255 * (x = Math.sin(t + pi_2_3)) * x;
13 return c + "";
14}
Note: See TracBrowser for help on using the repository browser.