We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everybody! I want to realize a background with a progressive color change that goes from orange to violet but I don't know how to properly do it.
fullScreen ();
colorMode(HSB,360,100,100,100);
int l=20;
int a= 20;
for (int x=0; x<=width; x+=l)
{
for (int y=0; y<=height; y+=a)
{
float hue=map(x,0,width,0,360);
fill(hue,100,100);
ellipse(x,y,30,30);
noStroke();
}
}
This is my starting code; I think that it's possible to change the color "range" by colorMode but what number should I use? There's some specific colorMode or I must use RGB/HSB?
Answers
The best thing you can do is to draw out a few examples. What are the RGB or HSV values at different points on your gradient? Then come up with a formula that captures that pattern.
Check https://processing.org/reference/lerpColor_.html
A demo below.
Kf
Thanks for the tips.