Not much done today, had a lot of 'work' to do. But I did finally get by head around the sin() function asa way of smoothly traversing something up and down. I really never 'got' this before, feels like a big achievement to me at least :)
In this example sin() is moving through the 0-255 range of the RGB colours art different rates. made this pretty picture...
float angle = 0.0;
void setup() {
size(400,400);
smooth();
}
void draw() {
translate(mouseX,mouseY);
rotate(angle);
float circ = ((1+sin(angle))*(255/2)); //sin(angle) = -1 to +1, so add one to get range 1 to 2, then multiply by colour range 255 divided by 2
float circ1 = ((1+sin(angle/3))*(255/2));
float circ2 = ((1+sin(angle/7))*(255/2));
fill(circ, circ1, circ2);
rect(-15,-15,60,10);
angle += .1;
}
void mouseClicked() {
saveFrame("pic-####.jpg");
}
No comments:
Post a Comment