How to | Create Animations
Animations can convey much more information than static displays. The built-in
Mathematica functions
Animate and
ListAnimate provide an immediate way to construct animations of graphics or any other kind of expression in a
Mathematica notebook. There are many other ways to interact with animations, including using interface-building tools like
Manipulate and
Dynamic, or file manipulation tools like
Import and
Export.
Use
Animate to animate a picture of

for changing values of

:
| Out[107]= |  |
Mathematica can animate any expression, not just graphics. Here,
Animate scans through integer powers of a polynomial. The
DefaultDuration option specifies how long the animation should take from start to finish, in seconds:
| Out[1]= |  |
Use
ListAnimate to animate a list of objects. Setting the
AnimationRunning option to
False prevents the animation from starting automatically:
| Out[110]= |  |
For continuous ranges,
Manipulate includes animation controls, which are hidden by default. Show them automatically by setting the
Appearance option to

. Notice that you can animate multiple variables at once:
Pass a list of graphics or any other expression to
Export to create an animation in an
"SWF",
"AVI",
"TIFF", or animated
"GIF" file.
Export will also create an animation instead of a list when given a
Manipulate,
Animate, or
ListAnimate:
| Out[37]= |  |
Import a
"QuickTime",
"AVI",
"TIFF", or animated
"GIF" file with

to obtain a list of images in the animation:
| Out[38]= |  |
Import just a single frame of the animation:
| Out[39]= |  |
| Out[40]= |  |
The
Animator control can be used directly to dynamically control an animating variable, outside the structure of
Animate or
Manipulate:
| Out[22]= |  |
| Out[23]= |  |
A
Dynamic that automatically changes itself is effectively a self-contained animation.
DynamicModule localizes and stores the value of the variable counter:
| Out[31]= |  |
The
Clock function can also be used in
Dynamic to drive a time-based animation. Here is a disk which changes color from
Hue
to
Hue
every 20 seconds:
| Out[49]= |  |