We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I'm trying to make a gradient around a circle, so that one rotation around the circle would be one lap of the hue wheel. It seems to work fine when I try it out as a linear gradient (the rects in the following code), but I can't get it to wrap around the circle.
void setup()
{
colorMode(HSB, 360, 100, 100);
background(100, 0, 100);
ellipseMode(RADIUS);
noFill();
frame.setResizable(true);
}
void draw()
{
float R = 200;
clear();
for (int i = 0; i < 360; i++)
{
stroke(i, 100, 100);
rect(5*i, 50, 5, 5);
}
pushMatrix();
translate(width/2, height/2);
strokeWeight(5);
int FINE = 360*3;
for (int i = 0; i < FINE; i++) {
println(i + ", " + float(i)/FINE*360);
stroke(float(i)/FINE*360, 100, 100);
arc(-R/2, 0, R/2, R/2, 0, PI);
rotate(2*PI*float(i)/FINE);
}
popMatrix();
//strokes
strokeWeight(4);
stroke(0, 0, 0);
ellipse(width/2, height/2, R, R);
translate(width/2, height/2);
arc(-R/2, 0, R/2, R/2, 0, PI);
rotate(2*PI/3);
arc(-R/2, 0, R/2, R/2, 0, PI);
rotate(2*PI/3);
arc(-R/2, 0, R/2, R/2, 0, PI);
}
Answers
Like this?
Yes, thank you!