Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I find it very convenient to use Mathematica notebooks to organise the codes + results.

I was wondering if it is possible to insert an animated image (say an animated gif) in the middle of a notebook.

(I tried dragging and dropping an animated gif into a notebook, the gif itself was created using Mathematica. Mathematica Import[] s it and I see a bunch of images in the notebook). This suggests, one solution namely using a Manipulate[] or Animate[], with those bunch of images. But is there an less tedious and more elegant way?

Thanks!

share|improve this question
6  
Import["pp.gif", "Animation"] ? – belisarius Mar 15 '12 at 18:32

2 Answers

up vote 7 down vote accepted

The credits go to belisarius and the Mathematica help (ref/format/GIF), but I thought the comment would be worth an answer.

Import["ExampleData/cellularautomaton.gif", "Animation"]

Mathematica graphics

share|improve this answer

Unfortunately I don't know of any simple and convenient ways.

You can import the GIF first:

frames = Import["http://i.imgur.com/ivfdq.gif"];

Then you can use ListAnimate to get an animation:

ListAnimate[frames]

For completeness I'll mention that pre-6 versions could also animate. Scan[Print, frames] will give you each frame in separate cells. Now close the cell group by double clicking its bracket and press Ctrl-Y or Ctrl-Shift-Y to start the animation. This still works in version 8.

share|improve this answer
(Slightly OT): Is there some way to import the animated GIF and have it appear animated -- but without the frame and Animator element? – murray Mar 20 '12 at 18:57
@murray Well, you can always hack together something manually ... list = Range[100]; DynamicModule[{i = 1}, Dynamic[Refresh[list[[i = Mod[i + 1, Length[list], 1]]], UpdateInterval -> 1/4], TrackedSymbols -> {}] ] – Szabolcs Mar 21 '12 at 9:23

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.