Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

Export["try.swf", 
 Manipulate[
  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.

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

1 Answer 1

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 + \[Phi]], {x, 0, 10}, PlotRange->All], {\[Phi], 0, 2 \[Pi], 
2 \[Pi]/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 [Pi]/10 to something smaller if you like.

share|improve this answer
3  
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. –  Jens Nov 29 '12 at 17:23
    
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. –  JohnD Nov 29 '12 at 17:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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