GrADS Animation

## Animation

There are two different ways to animate images within GrADS.

1. Set the dimension environment to have three varying dimensions and then `display` a variable. GrADS will return an animation sequence. By default, the animation dimension is time, but you may specify a different dimension to animate by using the following command:

     `set loopdim` x|y|z|t

     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:

     `set looping` on|off

     Remember to `set looping off` when you are done animating, or you will get a surprise when you display your next expression!

2. 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:

     `set dbuff on`

     When you issue a display command after turning on double buffering, the image is drawn to the backgound buffer. Then you issue the `swap` command, and GrADS swaps the background and foreground buffers so you can see what you've displayed. `swap` works like `clear` in that it resets many graphics options. Here is a sample script demonstrating how to use double buffering:

         '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

     You may also control the speed of the animation by inserting a `q pos` following the `swap` command -- then each click of the mouse would move to the next time step.