<!--Copyright (C) 1988-2005 by the Institute of Global Environment and Society (IGES). See file COPYRIGHT for more information.--> <html> <head> <title>GrADS Animation</title> </head> <body bgcolor="e0f0ff" text="#000000"> <h2>Animation</h2> There are two different ways to animate images within GrADS. <ol> <li> Set the <a href="dimenv.html">dimension environment</a> to have three varying dimensions and then <a href="gradcomddisplay.html"><code>display</code></a> a variable. GrADS will return an <b>animation sequence</b>. By default, the animation dimension is time, but you may specify a different dimension to animate by using the following command: <p> <dd><a href="gradcomdsetloopdim.html"><code>set loopdim</a> x|y|z|t</code> <p> If you wish to animate a variable with fewer than three varying dimensions (i.e., animate a line graph), you can control animation by entering: <p> <dd><a href="gradcomdsetlooping.html"><code>set looping</a> on|off</code> <p> Remember to <a href="gradcomdsetlooping.html"><code>set looping off</code></a> when you are done animating, or you will get a surprise when you display your next expression! <p> <li> Use double buffering, which means you have two display windows, one of which is always in the background. Double buffering is invoked with the following command: <p> <dd><code><a href="gradcomdsetdbuff.html">set dbuff</a> on</code> <p> When you issue a display command after turning on double buffering, the image is drawn to the backgound buffer. Then you issue the <a href="gradcomdswap.html"><code>swap</code></a> command, and GrADS swaps the background and foreground buffers so you can see what you've displayed. <a href="gradcomdswap.html"><code>swap</code></a> works like <a href="gradcomdclear.html"><code>clear</code></a> in that it resets many graphics options. Here is a sample script demonstrating how to use double buffering: <p> <pre> 'open model.ctl' 'set dbuff on' t = 1 'set gxout shaded' while (t <= 5) 'set t 't 'draw title Temperature' 'd t' 'cbarn' 'swap' t = t + 1 endwhile </pre> <p> You may also control the speed of the animation by inserting a <a href="gradcomdqpos.html"><code>q pos</code></a> following the <a href="gradcomdswap.html"><code>swap</code></a> command -- then each click of the mouse would move to the next time step. </body> </html>