Creating an interactive "X" made of circles
in
Programming Questions
•
6 months ago
So far I have narrowed it down to everything I need but I am not good with the
for loop code. How can I make it an "X" instead of the big squares I made? It is on line 21 and 22.
- int x=mouseX;
- int y=mouseY;
- int r;
- int g;
- int b;
- void setup()
- {
- size(200, 200);
- frameRate(15);
- smooth(0);
- }
- void draw()
- {
- background(255);
- for ( int x = mouseX; x < 200;x = x + 10){
- for (int y = mouseY; y < 200;y = y + 10){
- ellipseMode(CENTER);
- ellipse(x, y, 10, 10);
- }
- }
- }
- void mouseMoved()
- {
- r = int(random(0, 256));
- g = int(random(0, 256));
- b = int(random(0, 256));
- fill(r,g,b);
- }
1