|
Getting Started with IDL: Animation |
|
IDL includes a powerful, widget-based animation tool called XINTERANIMATE. Sometimes it is useful to view a single wire-mesh surface or shaded surface from a number of different angles. Let's make a SURFACE plot from one of the S dataset frames and view it rotating through 360 degrees. by entering:
A=S[*,*,0]
WINDOW,0,XSIZE=300,YSIZE=300
SURFACE,A,XSTYLE=4,YSTYLE=4,ZSTYLE=4
Setting the XSTYLE, YSTYLE, and ZSTYLE keywords equal to 4 turns axis drawing off. Usually, IDL automatically scales the axes of plots to best display all of the data points sent to the plotting routine. However, for this sequence of images, it is best if each SURFACE plot is drawn with the same size axes. The SCALE3 procedure can be used to control various aspects of the three-dimensional transformation used to display plots.
SCALE3,XRANGE=[0,31],YRANGE=[0,31],ZRANGE=[0,250]
XINTERANIMATE,SET=[300,300,40],/SHOWLOAD
WSET, 0
FOR I=0,39 DO BEGIN SCALE3,AZ= -i * 9 & SURFACE,A, $ /T3D,XSTYLE=4,YSTYLE=4,ZSTYLE=4 & XINTERANIMATE,$ FRAME=I,WIN=0 & END
The XINTERANIMATE window should appear, as shown above. "Tape recorder" style controls can be used to play the animation forward, play it backward, or stop. Individual frames can also be selected by moving the "Animation Frame" slider. The "Options" menu controls the style and direction of image playback. Click on "End Animation" when you are ready to return to the IDL Command Line.
Before continuing with the rest of the tutorials, delete the two windows you used to create the animations. The WDELETE procedure is used to delete IDL windows.