How to | Create Animations

Animations can convey much more information than static displays. The built-in Wolfram Language functions Animate and ListAnimate provide an immediate way to construct animations of graphics or any other kind of expression in a Wolfram System 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 :

In[1]:=
Click for copyable input
Out[1]=

The Wolfram Language 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:

In[2]:=
Click for copyable input
Out[2]=
    

Use ListAnimate to animate a list of objects. Setting the AnimationRunning option to False prevents the animation from starting automatically:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
    

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:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Import a "QuickTime", "AVI", "TIFF", or animated "GIF" file with to obtain a list of images in the animation:

In[3]:=
Click for copyable input
Out[3]=

Import just a single frame of the animation:

In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=
    

The Animator control can be used directly to dynamically control an animating variable, outside the structure of Animate or Manipulate:

In[1]:=
Click for copyable input
Out[1]=
Out[1]=

A Dynamic that automatically changes itself is effectively a self-contained animation. DynamicModule localizes and stores the value of the variable counter:

In[2]:=
Click for copyable input
Out[2]=

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:

In[3]:=
Click for copyable input
Out[3]=