I mentioned this when we met, but make sure you really do understand how the RGB and HSB color models work.
HSB is the mode that you may be less familiar with, and just to make things confusing there are 2 similar color models HSL and HSV.
In Processing, go to the Tools menu and open the Color Selector. You will see that the colors are given as both HSB and RGB values. The selector itself uses the HSB model. The vertical "rainbow" bar changes the Hue value only. In the large square, moving in the x-axis changes the Saturation value, and moving in the y-axis changes the Brightness value.
This Wikipedia entry on HSL and HSV is a bit more technical than you really need. But, the Basic Principle and Motivation sections are useful to read.
Here is a simple little program that plays with color. mouseY controls the color, mouseX controls the size of the central rectangle.
void setup()
{
size(720,720);
// noCursor();
}
void draw()
{
colorMode(HSB, 360, 100, 100);
rectMode(CENTER);
noStroke();
background(mouseY/2, 100, 100);
fill(abs(180-mouseY/2), 100, 100);
rect(360, 360, mouseX+1, mouseX+1);
}
No comments:
Post a Comment