add another color gradient scheme (blue to red)
This commit is contained in:
parent
d860ca4726
commit
ec7a4ca235
1 changed files with 28 additions and 1 deletions
|
|
@ -688,8 +688,9 @@
|
|||
return layers;
|
||||
}
|
||||
|
||||
const colorFunctions = {
|
||||
const colorFunctions = FDM.colorFunctions = {
|
||||
default: hsv2rgb.bind({ seg: 5, fn: color5 }),
|
||||
simple: hsv2rgb.bind({ seg: 3, fn: color4 }),
|
||||
dark: hsv2rgb.bind({ seg: 3, fn: color3 })
|
||||
};
|
||||
|
||||
|
|
@ -742,6 +743,32 @@
|
|||
}
|
||||
}
|
||||
|
||||
function color4(rgb, inc, seg) {
|
||||
const dec = 1 - inc;
|
||||
switch (seg) {
|
||||
case 0:
|
||||
rgb.r = 0;
|
||||
rgb.g = inc;
|
||||
rgb.b = 1;
|
||||
break;
|
||||
case 1:
|
||||
rgb.r = inc;
|
||||
rgb.g = 1;
|
||||
rgb.b = 0;
|
||||
break;
|
||||
case 2:
|
||||
rgb.r = 1;
|
||||
rgb.g = dec;
|
||||
rgb.b = 0;
|
||||
break;
|
||||
case 3:
|
||||
rgb.r = dec;
|
||||
rgb.g = 0;
|
||||
rgb.b = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function color3(rgb, inc, seg) {
|
||||
const dec = 1 - inc;
|
||||
switch (seg) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue