In more general terms, to rotate any object about its centre, you need to translate its centre to the origin, perform the rotation and translate back again. If you want to transform more than one object in your sketch, you will also probably need to store a copy of the transformation matrix before you do the rotation and then restore it when finished - this stops other objects from being moved at the same time.
Here is a simple example:
Quote:void setup()
{
size(400,400);
smooth();
ellipseMode(CENTER);
noLoop();
}
void draw()
{
background(255);
int xLocation = width/2;
int yLocation = height/2;
pushMatrix(); // Store the current transformation settings.
translate(xLocation,yLocation);
rotate(radians(30));
ellipse(0,0,100,50);
popMatrix(); // Restore the previous transformation settings.
}
Note that when performing multiple transformations, they are specified in the opposite order to that which you might expect. So reading from the bottom of the example up,
ellipse(0,0,100,50) does the translation to the origin,
rotate() does the rotation and
translate() does the translation back to the object's centre position.