I find that the Export of Manipuate contains backforward play, see a simplified example:

  Plot[Sin[2 x + φ], {x, 0, 10}], {φ, 0, 2 π}]]

You can see the problem in the SWF file. (I'm sorry that the exported SWF file cannot be uploaded here)

Actually, I have two questions here,

  1. Is there any simple way to get a animation with only forward play? I can find nothing about this in the help documents.

  2. Why is GIF not working in Export? That is to say, if I use Export["try.gif", Manipulate[...]],the exported file, otherwise an animation, is only a static picture actually.

  • 3
    $\begingroup$ Try Export["yourfile.gif", Table[Plot[Sin[2 x + \[Phi]], {x, 0, 10}], {\[Phi], 0, 2 Pi, 2 Pi/20}]] $\endgroup$ – Dr. belisarius Oct 29 '12 at 3:46
  • $\begingroup$ @ belisarius, you mean the gif can only be used in exporting a sequence of images? $\endgroup$ – yulinlinyu Oct 29 '12 at 3:49
  • $\begingroup$ An animated GIF is just a series of GIFs ... you have to specify them one by one, yes $\endgroup$ – Dr. belisarius Oct 29 '12 at 3:50
  • $\begingroup$ There was also a way by using Animate[]. I don't remember it right now $\endgroup$ – Dr. belisarius Oct 29 '12 at 3:51

Both questions can be addressed by using a Table to generate the frames of the animation rather than Manipulate:

mov = Table[Plot[Sin[2 x + ϕ], {x, 0, 10}, PlotRange->All], {ϕ, 0, 2 π, 
2 π/10}];
Export["movie.gif", mov] 

enter image description here

Although this runs the animation in the forward direction only, it does repeat indefinitely. This technique is not limited to .gif, e.g., I use this to export .swf animations quite a bit.

You can of course control the smoothness of the animation by changing the increment 2 π/10 to something smaller if you like.

  • 4
    $\begingroup$ Quick comment: better to use Export["movie.gif", Most[mov]] because your Table duplicates the starting point of the periodicity interval so that the movie appears to stop briefly when it completes one loop. $\endgroup$ – Jens Nov 29 '12 at 17:23
  • $\begingroup$ Good point, although I left that repetitious frame there so he could see the animation was repeating (and when). This may not be desirable in his final application though. $\endgroup$ – JohnD Nov 29 '12 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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