How to generate animated GIF of a Manipulate? 8.0.1
Asked Answered
G

2

16

Exporting to animated gif seems to have changed in Mathematica 8.0.1?

I normally make animated GIFs of a manipulate by simply writing:

v=Manipulate[....]

then Export["foo.gif",v];

But now it does not work. I just get one static image.

Here is an example:

v=Manipulate[
Text[t],
{{t,4,"start"},0,10,1,ControlType->Trigger,AnimationRate->1,AnimationRepetitions->10}
]

Now Export["foo.gif",v] just generate static image, as nothing was running.

But Export["foo.avi",v] works, and it does generate a running avi movie.

Also, there used to be animated GIF options I used before, but now there are not supported:

Export["foo.gif",v,ConversionOptions->{"AnimationDisplayTime"->0.5,"Loop"->True},ImageSize->{500,500}]

Export::convoptobs: ConversionOptions is obsolete. 

When I go to help, I do not see options for GIF there. How does one control animation delay and such?

I thought someone here might have an idea.

thanks --Nasser

Galleywest answered 24/5, 2011 at 11:38 Comment(5)
I don't use version 8, but I am curious to know what you get if you use: Export["foo.gif", {v}]Wojcik
Same effect when I used {v}, no animated gif generated.Galleywest
A shame it wasn't that simple. I am afraid I cannot be of help.Wojcik
@Galleywest What Mathematica version were you using that worked in the mentioned way? I tried v=Manipulate[Text[t],{{t,4,"start"},0,10,1,ControlType->Trigger,AnimationRate->1,AnimationRepetitions->10}];Export["C:/foo.gif",v] in the version 7.0.1 and it does generate a static image.Sox
Hello; I do not remember which version. But I do remember that I used to be able to export to animated gif a variable which I had set equal to the Maniupulate command. I could be may be wrong, but it does work with SWF and AVI? As for the options (for the Export to gif part) I do know for sure these used to work before, and now they no longer work. Either way, the question still, how would one export a Manipulate to animated gif file? Using Animate[] as was suggested instead of Manipulate did not work well for my case (UI changed a little when I did that). Thanks --NasserGalleywest
J
22

You can export a Table to an animated GIF.

v = Table[Panel[Text[t]], {t, 0, 10, 1}];
Export["anim.gif", v, "DisplayDurations" -> 0.5]

If you absolutely want the animation to look like a Manipulate, you could do something like so.

v = Table[Manipulate[Text[t], 
    {{t, Mod[k, 10], "start"}, 0, 10, 1, ControlType -> Trigger}],
  {k, 4, 14}];
Export["Manip.gif", v, "DisplayDurations" -> 0.5]
Jaguarundi answered 24/5, 2011 at 13:11 Comment(2)
Thank you Mark! That did it. I wanted to vote your answer up, but it forum won't let me. I used your trick to finally animate a small Manipulate I did for school HW. If you like to see the animation, here it is 12000.org/my_notes/mma_demos/pendulum_flywheel/index.htm I used latex to load it, scaled it down a little. Thanks again ! I like this forum much more than the other Math group, as there is no long delay here and one can finally talk Mathematica at well. --NasserGalleywest
@Galleywest - Glad to help! And I'm glad you like this forum. It's certainly different from mathgroup. I'm sure they both have their strengts, but I definitely like the turn around here. Concerning the upvote, you need to earn a bit of reputation before you can do so. I don't think it's too much.Jaguarundi
A
4

You can use v = Animate[ Text[t], {{t, 4, "start"}, 0, 10, 1, ControlType -> Trigger, AnimationRate -> 1, AnimationRepetitions -> 10}]

Alikee answered 24/5, 2011 at 11:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.