#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# What's wrong with my hue gradient?

edited December 2016

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);
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);

}
``````

Tagged:

Like this?

``````void setup()
{
size(600, 600);
colorMode(HSB, 360, 100, 100);
background(100, 0, 100);
noFill();
//frame.setResizable(true);
}

void draw()
{
float R = 200;
//clear();
background(128);
//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);
for (int i = 0; i < 360; i++)
{
stroke(i, 100, 100);
arc(-R/2, 0, R/2, R/2, 0, PI);
rotate(TWO_PI/(1*360.0));
}
popMatrix();

// Segment into three sections with very thick black lines.
strokeWeight(8);
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.0);
arc(-R/2, 0, R/2, R/2, 0, PI);
rotate(2*PI/3.0);
arc(-R/2, 0, R/2, R/2, 0, PI);
}
``````
• Yes, thank you!