Hello,
So I have these tasks: 1. When the sketch starts, a circle with a random size, position and border color is
displayed in the window and a first circle with a radius of 10 pixels on the mouse
position.
2. Every two seconds a new circle with a random border color (no white!) and
random radius (between 10 and 50) will appear at a random position in the
window.
So far, I have this:
int counter=120;
int numCircles = 50;
int x, y;
int[] myArr = new int[numCircles];
void setup() {
size(500, 500);
initializeArray(myArr);
}
void initializeArray(int[] someArr) {
for (int i=1; i < someArr.length; i++) {
someArr[0] = 10;
someArr[i] = (int)random(10, 50);
}
printArray(someArr);
}
void draw() {
background(255);
//ellipse(mouseX, mouseY, 10, 10);
generateCircles(myArr);
}
void generateCircles(int[] someArr) {
x = (int)random(width);
y = (int)random(height);
for (int i=1; i < someArr.length; i++) {
drawCircle(x, y, someArr[i]);
}
}
void drawCircle(int x, int y, int radius) {
for (int i=0; i <= counter; i++) {
stroke((int)random(255));
ellipse(x, y, radius, radius);
}
}
The issues I’m currently facing are those: 1. Framerate seems to be 240fps instead of default 60, although I haven’t changed it neither in the code nor settings.
2. When I try to draw an ellipse in the mouse position, it updates at the same time as the other circles (these are updating using counter), it doesn’t matter where I put the command.
3. Circles with random position are drawn on top of each other 2-3 times and then moves all together instead of drawing one every 2 seconds.
Any advice?