2
$\begingroup$

So this is something very similar to my code

Manipulate[Graphics[{Red, Rectangle[{0 + x, 0}, {2 + x, 0.5}], PlotRange -> {{1, 10}, {-1, 5}}, ImageSize -> Large], {x, 1, 10, Appearance -> "Open", AnimationRunning -> True, AnimationRate -> v, AppearanceElements -> None}, ControlPlacement -> Top] 

I'm trying to make the x slider invisible while the animation continues to run, but when I use

Invisible@{x, 1, 10, Appearance -> "Open", AnimationRunning -> True, AnimationRate -> v, AppearanceElements -> None} 

the animation stops running. How can I make it so that while the slider is invisible, it continues to animate? should i use Animate instead of Manipulate?

$\endgroup$
5
  • $\begingroup$ should i use Animate instead of Manipulate? there is really no reason to use Animate over Manipulate. Manipulate can do what Animate does and much more. I always use Manipulate myself. Better learn one command well, than two not too well. $\endgroup$ Commented Feb 26, 2021 at 9:21
  • $\begingroup$ how will you stop/pause animation? $\endgroup$ Commented Feb 26, 2021 at 9:24
  • $\begingroup$ The animation shouldn't stop. it should keep looping $\endgroup$ Commented Feb 26, 2021 at 9:26
  • 1
    $\begingroup$ so does v = 1; Animate[ Graphics[{Red, Rectangle[{0 + x, 0}, {2 + x, 0.5}]}, PlotRange -> {{1, 10}, {-1, 1}}, ImageSize -> Large], {{x, 1, Invisible[""]}, 1, 10, AppearanceElements -> {}}, AnimationRunning -> True, AnimationRate -> v, AppearanceElements -> None] give what you need? $\endgroup$ Commented Feb 26, 2021 at 9:33
  • $\begingroup$ Yes, it does, thank you! $\endgroup$ Commented Feb 26, 2021 at 9:40

1 Answer 1

1
$\begingroup$

Clock

Panel @ Graphics[{Red, Rectangle[{0 + #, 0}, {2 + #, 0.5}] & @ Dynamic[Clock[{1, 10, .1}]]}, PlotRange -> {{1, 10}, {-1, 1.5}}, ImageSize -> Large] 

enter image description here

Animate

v = 1; Animate[Framed @ Graphics[{Red, Rectangle[{0 + x, 0}, {2 + x, 0.5}]}, PlotRange -> {{1, 10}, {-1, 1.5}}, ImageSize -> Large], {{x, 1, ""}, 1, 10, AppearanceElements -> {}}, AnimationRunning -> True, AnimationRate -> v, AppearanceElements -> None, Paneled -> False] 

enter image description here

Manipulate

1. Wrap the control with Invisible @ Control:

Manipulate[Framed @ Graphics[{Red, Rectangle[{0 + x, 0}, {2 + x, 0.5}]}, PlotRange -> {{1, 10}, {-1, 1.5}}, ImageSize -> Large], Invisible @ Control @ {x, 1, 10, Animator, AnimationRunning -> True, AnimationRate -> v}, AppearanceElements -> None, Paneled -> False] 

2. Use the Method option "ControlAreaDisplayFunction":

Manipulate[Framed @ Graphics[{Red, Rectangle[{0 + x, 0}, {2 + x, 0.5}]}, PlotRange -> {{1, 10}, {-1, 1.5}}, ImageSize -> Large], {x, 1, 10, Animator, AnimationRunning -> True, AnimationRate -> v}, AppearanceElements -> None, Method -> {"ControlAreaDisplayFunction" -> (Invisible[#] &)}, Paneled -> False] 

Both methods give the same picture as the one produced by Animate above.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.