multiple circles in changing colors
in
Programming Questions
•
2 years ago
Hi, im trying to draw a circle that repeats itself through the y and x axis.
I can get the circles displayed with;
size(480,480);
for (int x=20; x<460; x += 20){
for (int y=20; y<460; y += 20){
ellipse (x, y,10, 10);
}
}
But when i try to add the fill(); variable that changes, I can get each circle to be a different color:
size(480,480);
for (int x=20; x<460; x += 20){
for (int y=20; y<460; y += 20){
for (int c=0; c<255; c += 10){
fill(c,0,0);
ellipse (x, y,10, 10);
}
}
}
Then I found this;
size(480,480);
int x= 20;
for (int c=0; c<255; c += 10){
fill(c,0,0);
ellipse (x, 20,10, 10);
x += 20;
}
which works for either x or y axis but no for both:
size(480,480);
int x= 20;
int y= 20;
for (int c=0; c<255; c += 10){
fill(c,0,0);
ellipse (x, y,10, 10);
x += 20;
y += 20;
}
The last one makes a diagonal.
An explanation of why this isn´t working would be awsome!
1