Animated graphics in Mathematica

Mathematica can produce animated GIFs, but the documentation is not clear and I could find no example where an animation was written to a file. Here is a simple example that shows the basic steps in producing an animated GIF.

plot1 = Table[ Plot[{Sin[a x], 0.5 Cos[a x]}, {x, -5, 5}, PlotRange -> {-2, 2}, PlotLabel -> "animated sin function",
  PlotStyle -> {{RGBColor[0, 1, 0], Thickness[0.01]}, {RGBColor[0, 0, 1], Thickness[0.01]}}, DisplayFunction -> Identity], {a, 0, 10, .5}]
Export["c:/temp/sinx.gif", plot1, ConversionOptions -> {"AnimationDisplayTime" -> 0.5, "Loop" -> True}, ImageSize -> {500, 500}]

(1) The <<Graphics`Animation` loads the animation package.
(2) The Table[...] command creates a table of graphs. DisplayFunction -> Identity prevents the graphs from showing in the notebook. The other options are standard. Unless you are doing something unusual, you should set PlotRange to be the same on all graphs, otherwise the animation will be jerky.
(3) Export[...] writes the table to a the .gif file given in the first argument. The options in the ConversionOptions argument should be in quotes. More info in the help browser: under the Export command, look under "Additional information", then click on the "GIF" cell.

Here is the resulting graph:

Animated GIF

View this page in Romanian courtesy of Alexandra Seremina.