Good day/morning/evening/afternoon!
So I got his code which I wanna utilize for another task:
void setup() { size(800,400); }
void draw() {
loadPixels();
int w = width/2, h = height;
for(float j = 0; j < w; j++) for(float i = 0; i < h; i++) {
float red = lerp(0,255,i/h), green = lerp(0,255,j/h), blue = lerp(255,0,i/h);
pixels[floor(j+w+i*width)] = color(red,green,blue);
color clr = color(map(i,0,h,255,0),map(j,0,w,0,255),map(i,0,h,0,255));
pixels[floor(j+i*width)] = clr; //inverted, different approach
}
updatePixels();
noLoop();
}
I can’t figure out how to use it so maybe you could help me here.
I have to make an interactive HSL (Hue, Saturation, Lightness) Box in Processing.
On top of the window, there should be a 500px wide and 50px tall color strip that will determine the hue of the gradient based on my cursor position. Below it is a 500 x 500 gradient showing the different saturation and brightness values for that hue. On top is the brightest and gets darker as you go down, while the leftmost is the most saturated and gets less saturated towards the right.
If you want to visualize it: link