Simple concentric circles
in
Programming Questions
•
1 year ago
Hi, I'm simply trying to draw a few concentric circles with two colors but it's not working properly.
I can't see the problem. Any suggestions?
I can't see the problem. Any suggestions?
- Heart loops;
color col = color(255, 0, 0);
color col2 = color(0, 0, 255);
void setup() {
size(800, 800);
background(255);
smooth();
loops = new Heart(width/2, height/2, 800, 30);
}
void draw() {
loops.drawCircle();
}
class Heart {
int x, y;
int dia;
int steps;
Heart(int _x, int _y, int _dia, int _steps) {
x = _x;
y = _y;
dia = _dia;
steps = _steps;
}
void drawCircle() {
for (int i = dia; i > 0; i-=steps) {
if (i%(2 * steps) == 0) {
fill(col);
}
else
{
fill(col2);
}
ellipse(x, y, i, i);
}
}
}
1