Browse Source

Disabled autowatch, factorized a bi the main function

master
TFLCL 4 years ago
parent
commit
ab10873e66
  1. 10
      Cubehelix.js

10
Cubehelix.js

@ -12,7 +12,7 @@
// http://www.mrao.cam.ac.uk/~dag/CUBEHELIX/cubetry.html
autowatch = 1;
autowatch = 0;
inlets = 1;
outlets = 4;
@ -113,14 +113,16 @@ function CubeHelixRGB(fract,start,rots,hue,gamma){
var angle = 2*Math.PI*(start/3.0+1+rots*fract);
var fract = Math.pow(fract, gamma);
var amp=hue*fract*(1-fract)/2.0;
var acos = Math.cos(angle);
var asin = Math.sin(angle);
var r=fract+amp*(-0.14861*Math.cos(angle)+1.78277*Math.sin(angle));
var r=fract+amp*(-0.14861*acos+1.78277*asin);
r=Math.max(Math.min(r,1.0),0.0);
var g=fract+amp*(-0.29227*Math.cos(angle)-0.90649*Math.sin(angle));
var g=fract+amp*(-0.29227*acos-0.90649*asin);
g=Math.max(Math.min(g,1.0),0.0);
var b=fract+amp*(+1.97294*Math.cos(angle));
var b=fract+amp*(+1.97294*acos);
b=Math.max(Math.min(b,1.0),0.0);
return [r, g, b];

Loading…
Cancel
Save