float theta = 0; float delta = 0.05; void setup() { size(400, 400); frameRate(30); smooth(); } void draw() { background(255); translate(mouseX, mouseY); rotate(theta); rectMode(CENTER); noStroke(); fill(240, 32, 32); rect(0, 0, 90, 90); pushMatrix(); fill(240, 128, 128); translate(120, 0); rotate(theta); rect(0, 0, 45, 45); popMatrix(); pushMatrix(); fill(240, 128, 128); translate(-120, 0); rotate(theta); rect(0, 0, 45, 45); pushMatrix(); fill(240, 192, 192); translate(-45, 0); rotate(theta); rect(0, 0, 20, 20); popMatrix(); popMatrix(); theta += delta; }