It looks like you’re trying to move a circle until it hits the bottom of the window. While the circle isn’t at the bottom yet, you want to move it down, and it speeds up.
The problem is that you don’t need a while loop to do this! Confusing, right? You already have a loop, and that loop is draw()
being called over and over. Consider these changes:
float circleX = 320;
float circleY = 50;
float speed = 1;
void setup() {
size(640,360);
}
void draw(){
background(50);
if (circleY < height) {
circleY += speed;
speed += 0.3;
}
ellipse(circleX, circleY, 10, 10);
}
Also note that the function to draw a circle is actually ellipse()
.