PImage icon;
float angle = 0;
void setup() {
size(256, 256);
icon = loadImage("http://i.imgur.com/mY2mbd7.png");
imageMode(CENTER);
}
void draw() {
background(255);
int framesPerPiece = 60;
int numrotated = int(frameCount / framesPerPiece % 6);
for (float i = 0; i < 5; i++) {
pushMatrix();
float theta = 2*PI/6*i + (2*PI)/6*numrotated;
if(i==0) {
float amount = (frameCount % framesPerPiece) * 1.0 / framesPerPiece;
theta += -amount*(2*PI)/(6);
}
float r = icon.height/2;
float x = width/2 + r*cos(theta);
float y = height/2 + r*sin(theta);
translate(x,y);
rotate(theta + PI/2);
image(icon, 0, 0);
popMatrix();
}
}