Pro anim2d, XROT=xrot ;+ ; Demo program to show an animated drawing in 3-D. ; ; USAGE: ; anim2d, [XROT=xrot] ; ; If XROT is set then rotate around X axis (def.=Z axis). ;- ; Reset any 3-D transformations that may be in use creating a dummy window. WINDOW, /FREE, XSIZE=300, YSIZE=300 ; Initialize animation: set frame size and number of frames. sizx = 300 sizy = 300 rate=20 nframes=16 XINTERANIMATE, SET=[sizx, sizy, nframes] c=loadct19() ; First drawing for the frame SCALE3, AX = 75, AZ = 30 ERASE pp = polygon(48) USERSYM, pp, /FILL PLOT, pp[0,*],pp[1,*], PSYM=-8, SYMS=2, color=c(2), /T3D XINTERANIMATE, FRAME=0, WINDOW=!D.WINDOW ; Loop to create nframes images, rotating in the Z plane each time. FOR i = 1, nframes - 1 DO BEGIN IF KEYWORD_SET(xrot) THEN SCALE3, AX = 75 + i * 360./nframes, AZ = 30 $ ELSE SCALE3, AX = 75, AZ = 30 + i * 360./nframes PLOT, pp[0,*],pp[1,*], PSYM=-8, SYMS=2, color=c(2), /T3D XINTERANIMATE, FRAME=i, WINDOW=!D.WINDOW ENDFOR WDELETE ; remove the dummy window ; Run the animation. XINTERANIMATE, rate END