1

I want to export an animation for polar plot $r=\cos 2\theta$, instead of directly using Animate. But I want a table of snapshots: movie = ParallelTable[...] and a point that produce its animations like to this question. Then export it to my favorite animated graphics format, e.g.: Export["rose,gif", movie]. How can I do it?

I want a gif like this, merely with red point and without the circle and blue line of course for $r=\cos 2\theta$.

enter image description here

Nimbigli
  • 349
  • 1
  • 7

1 Answers1

5

Using ManToGif by Vitaliy Kaurov

ManToGif[man_, name_String, step_Integer] := 
  Export[name <> ".gif", 
   Import[Export[name <> Which[$OperatingSystem == "MacOSX", ".mov", 
     $OperatingSystem == "Windows", ".avi"], man], 
          "ImageList"][[1 ;; -1 ;; step]]];

Now write

SetDirectory[NotebookDirectory[]];
r = 1;
backgroundAxes = Plot[0, {x, -Pi, 5 Pi}, 
   PlotRange -> {Automatic, {-r/2, 2 r + .5}}, AspectRatio -> Automatic, 
   Axes -> {True, False}, Ticks -> {Range[0, 4 Pi, Pi], None}];
t = Animate[Show[{backgroundAxes, 
     ListPlot[Table[{x - Sin[x], 1 - Cos[x]}, {x, 0, t, .1}], Joined -> True],
     Graphics[{PointSize[Large], Red, Point[{t - Sin[t], 1 - Cos[t]}]}],
     Graphics[Circle[{t, 1}, r]]}], {t, 0, 4 Pi}
   ];
ManToGif[t, "my_animation", 1]

Mathematica graphics

Load it into the browser to play:

enter image description here

Nasser
  • 143,286
  • 11
  • 154
  • 359