Its not that I'm really thinking of, I guessed that the translate is probably spurious and unnecessary (especially for each loop). I've been trying to think what he's trying to do, which is I presume to start with an ellipse in the center, that can picked up and moved. In the OO world you would create a nice ellipse object initialized in setup. Which is then controlled by the mouse in draw, with or without redrawn background, depending on whether you wanted a persistent image?
If I'm right in my assumption a solution would be to initialize x and y to the center instead, draw the ellipse, and on a boolean (mouse clicked for example) turn on the mouse tracking (but it is still a bit of mess as it depends where your mouse is). To make it less jumpy you could use a calculated displacement rather than the actual mouse coordinates for the movement.
An even better solution use the mouse dragged function to control the ellipse. To make sure x and y are visible between setup and draw, declare them before draw.
Quote:float x;
float y;
void setup(){
x = width/2;
y = height/2;
fill(200,0,200);
}
void draw(){
ellipse(x, y, 3, 3);
}
void mouseDragged(){
y = mouseY;
x = mouseX;
}