3
$\begingroup$

This question already has an answer here:

I would like to display a sequence of images as a movie within mathematica. I am aware of ListAnimate, but I do not want the various controls included, and there seems to be no way to remove them.

$\endgroup$

marked as duplicate by Jens, bobthechemist, Simon Woods, C. E., RunnyKine Aug 29 '14 at 19:47

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$ Perhaps you can use the example in my answer here. $\endgroup$ – Jens Aug 29 '14 at 19:10
  • $\begingroup$ Since @Jens linked answer has a lot of nice information, the function that answers this question is makeAnimation $\endgroup$ – bobthechemist Aug 29 '14 at 19:27
  • $\begingroup$ see also how can I completely remove ListAnimate controls $\endgroup$ – kglr Aug 29 '14 at 19:48
  • $\begingroup$ The answers were useful, but all require clever, obscure syntax. It seems odd that with all the native capabilities of mathematica, this one is absent. Perhaps some day in the future there will be a "Movie" object with a status similar to "Image." $\endgroup$ – abwatson Aug 29 '14 at 20:04
  • 1
    $\begingroup$ This is a minimal example that seems to work. movie is a list of images. Dynamic[movie[[Clock[{1, 8, 1}, 4, 1]]]] $\endgroup$ – abwatson Aug 29 '14 at 20:58
2
$\begingroup$

For variety, one can do this with ControllerManipulate

imgs = Plot[Sin[x + #], {x, 0, 2 Pi}] & /@ Range[0, 2 Pi, Pi/10];
ControllerManipulate[
 Show[imgs[[(Pause[0.05]; 1 + Mod[x++, Length@imgs - 0])]]], {x, 0, 1}]

enter image description here

$\endgroup$
1
$\begingroup$

I haven't carefully looked over the makeAnimation that is suggested in the comments but it looks like it might be even be more advanced than what you need, it certainly is more advanced that what I had written so here goes a basic version that might help you:

animation[frames_, delay_] := Module[{fr = frames},
  Dynamic[
   Refresh[First[fr = RotateRight@fr], UpdateInterval -> delay], 
   TrackedSymbols -> {}
   ]
  ]

Example usage:

frames = Table[Graphics[{ColorData["Rainbow"]@RandomReal[], Rectangle[]}], {10}];
animation[frames, 0.5]

The second argument says that it should switch frame every 0.5 seconds.

$\endgroup$

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