// This macro demonstrates how to do animation using the // snapshot and reset functions. size = 500; nsides =20; lineWidth = 1; newImage("Untitled", "RGB", size, size, 1); autoUpdate(false); // disable automatic display updates radius = size/2; angle = 0; frames=0; start=getTime(); setLineWidth(lineWidth); setColor(0,0,0); fill(); snapshot(); // create a backup image that can be restored later setColor(0,0,255); while (true) { reset(); // restore the backup image drawString(round(frames++/((getTime()-start)/1000)) + " fps", 5, 20); drawPolygon(radius, radius, radius, nsides, angle); angle += PI/90; updateDisplay(); } function drawPolygon(x, y, r, n, angle) { twoPi = 2*PI; inc = twoPi/n; for (a1=angle; a1