Template:Team:UC Davis/MutantWidget
From 2011.igem.org
(Difference between revisions)
Line 90: | Line 90: | ||
highval = 1; | highval = 1; | ||
} | } | ||
+ | */ | ||
lowcolor = RGB2HSL(colormap[lowval][0], colormap[lowval][1], colormap[lowval][2]); | lowcolor = RGB2HSL(colormap[lowval][0], colormap[lowval][1], colormap[lowval][2]); | ||
highcolor = RGB2HSL(colormap[highval][0], colormap[highval][1], colormap[highval][2]); | highcolor = RGB2HSL(colormap[highval][0], colormap[highval][1], colormap[highval][2]); | ||
var h = lowcolor.h*(highval - newval) + highcolor.h*(newval - lowval); | var h = lowcolor.h*(highval - newval) + highcolor.h*(newval - lowval); | ||
- | + | var s = lowcolor.s*(highval - newval) + highcolor.s*(newval - lowval); | |
- | + | var v = lowcolor.l*(highval - newval) + highcolor.l*(newval - lowval); | |
- | s = lowcolor.s; | + | //s = lowcolor.s; |
- | v = lowcolor.l | + | //v = lowcolor.l; |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
*/ | */ | ||
+ | newcolor = HSL2RGB(h,s,v); | ||
+ | |||
+ | newcolor.r = colormap[lowval][0]*(highval - newval) + colormap[highval][0]*(newval - lowval); | ||
+ | newcolor.g = colormap[lowval][1]*(highval - newval) + colormap[highval][1]*(newval - lowval); | ||
+ | newcolor.b = colormap[lowval][2]*(highval - newval) + colormap[highval][2]*(newval - lowval); | ||
+ | |||
return [newcolor.r, newcolor.g, newcolor.b]; | return [newcolor.r, newcolor.g, newcolor.b]; | ||
} | } |
Revision as of 04:03, 25 September 2011