nFrames = 60 fps = 1/30 radius = 120 for n in range(nFrames): newPage(480, 270) frameDuration(fps) with savedState(): fill(0,1,0) # move origin of the canvas to the center translate(width()/2, height()/2) # rotate the canvas rotate(-360 * n/nFrames) # move the origin again translate(radius, 0) rect(-50, -50, 100, 100) with savedState(): fill(1,0,1) translate(width()/2, height()/2) rotate(-360 * n/nFrames) translate(radius, 0) # counter-rotate the canvas so the rect appears to not rotate rotate(360 * n/nFrames) rect(-50, -50, 100, 100) saveImage('rotate_more.gif')