1
$\begingroup$

This question already has an answer here:

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

$\endgroup$

marked as duplicate by Yves Klett, Öskå, bobthechemist, Dr. belisarius, Bob Hanlon Dec 1 '14 at 2:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Welcome! You got most steps already covered. What is the actual problem? $\endgroup$ – Yves Klett Nov 30 '14 at 18:52
  • $\begingroup$ You can export to animated gif directly from Manipulate. No need to make ParalleTable[...]. And why the Parallel part? Here is a link community.wolfram.com/groups/-/m/t/86994 $\endgroup$ – Nasser Nov 30 '14 at 18:53
  • $\begingroup$ I know it generally but I do not know details so I could not make it. $\endgroup$ – Nimbigli Nov 30 '14 at 18:55
  • $\begingroup$ How can I do it? $\endgroup$ – Nimbigli Nov 30 '14 at 19:16
  • $\begingroup$ @belisarius has given an answer for this question, but I can't put my finger on it. $\endgroup$ – bobthechemist Nov 30 '14 at 23:23
5
$\begingroup$

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

$\endgroup$
  • $\begingroup$ Thanks @Nasser. Please look at My new edition of question. $\endgroup$ – Nimbigli Nov 30 '14 at 20:12
  • $\begingroup$ @bigli Updated for your new version $\endgroup$ – Nasser Nov 30 '14 at 20:13
  • $\begingroup$ A gif for polar plot $r=\cos 2 \theta$ like your update. $\endgroup$ – Nimbigli Nov 30 '14 at 20:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.