13
$\begingroup$

I want to use ListAnimate to show an animation but I want to remove the slider and all of the buttons from the top and show the animation panel only. There is an AppearanceElements -> None option but it doesn't remove the slider and the other buttons. How can I remove all of the controls?

$\endgroup$
2

3 Answers 3

19
$\begingroup$

If you look at underlying code:

ListAnimate[Table[Plot[Sin[n x], {x, 0, 10}], {n, 25}]] // InputForm

at the end you'll find:

enter image description here

which leads to a trick:

ListAnimate[Table[Plot[Sin[n x], {x, 0, 10}], {n, 25}]] /. 
 HoldPattern[AppearanceElements -> _] -> (AppearanceElements -> None)

enter image description here

In the spirit of @Mr.Wizard comment you can also do something like:

ListAnimate[Table[Plot[Sin[n x], {x, 0, 10}], {n, 25}], 
  Paneled -> False] /. (AppearanceElements -> _) -> (AppearanceElements -> {})

which a bit changes things.

$\endgroup$
4
  • 2
    $\begingroup$ Nice trick. You don't need HoldPattern by the way. This still leaves the space for the controls; can you remove that too? $\endgroup$
    – Mr.Wizard
    Oct 14, 2012 at 9:25
  • 1
    $\begingroup$ @Mr.Wizard thanks :) hmmm... not sure about space. I added something at the end of the answer. $\endgroup$ Oct 14, 2012 at 9:43
  • 3
    $\begingroup$ If you cannot apply AppearanceElements->None directly as an option, surely that must be a bug? $\endgroup$ Oct 14, 2012 at 23:59
  • $\begingroup$ @MikeHoneychurch I'll see what I can find out. $\endgroup$ Oct 15, 2012 at 0:07
6
$\begingroup$

Update: go through the list every 2 seconds and stop after 5 repetitions:

list = Table[Plot[Sin[x + n], {x, 0, 3 Pi}, PlotRange -> {-1, 1}], {n, -2 Pi, 2 Pi, Pi/40}];

Dynamic[list[[Clock[{1, Length@list, 1}, 2, 5]]]]

enter image description here


Original post:

Since

ListAnimate generates a Manipulate object containing an Animator (docs)

With explicit lists as input, say,

 list = Table[Plot[Sin[x + n], {x, 0, 3 Pi}], {n, 0, 2 Pi, Pi/20}];

the animation produced by ListAnimate[list...] can also be produced using Manipulate or Animator specifying the Animator option settings directly (instead of post-processing the Manipulate object generated by ListAnimate).

Manipulate[list[[k]], {{k, 1, ""}, 1, Length[list], 1,
      ControlType -> Animator, AnimationRate -> 15, 
      AnimationRunning -> True, AppearanceElements -> {}},
  AppearanceElements -> None, Paneled -> False]

or

DynamicModule[{j},
  Column[{Animator[Dynamic[j], {1, Length@list, 1}, 15, 
       AnimationRunning -> True, AppearanceElements -> None], 
  Dynamic[list[[j]]]}]]

enter image description here

$\endgroup$
1
  • $\begingroup$ This is impressive as the file size is dramatically reduced, at least in my case working with DensityPlot +1. $\endgroup$ Oct 29, 2022 at 11:41
3
$\begingroup$

I don't know how to do that. Perhaps you are open to an alternative?

animate[list_List, rate_?Positive] := DynamicModule[{x = list},
  Dynamic[First[x = RotateLeft@x], UpdateInterval -> 1/rate, TrackedSymbols -> {}]]

list = Table[Plot[Sin[x + n], {x, 0, 3 Pi}], {n, 0, 2 Pi, Pi/20}];

animate[list, 15]

enter image description here

$\endgroup$
2
  • $\begingroup$ It's too slow on my machine but it's what I am looking for. ListAnimate looks 10x faster to me. I want to make an interactive user interface, so being fast is a must. $\endgroup$
    – Helium
    Oct 14, 2012 at 9:07
  • $\begingroup$ @Mohsen Yes, I see now that it's not very smooth. $\endgroup$
    – Mr.Wizard
    Oct 14, 2012 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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