3
$\begingroup$

It would be nice to be able to see the value of t changing as the animation progresses even if it is updating so fast that you have to stop the slider to read the number.

Animate[Graphics[{Circle[], Point[{Cos[t], Sin[t]}]}], {t, 0, 6}, 
 AnimationRunning -> False]
$\endgroup$
3
  • $\begingroup$ While displaying it in the graphic is probably nicer, just wanted to mention another workaround: use Manipulate[Graphics[{Circle[], Point[{Cos[t], Sin[t]}]}], {t, 0, 6}] and click the little plus next to the slider. This will show a panel of buttons and the value, and one of those buttons will let you play the animation. $\endgroup$
    – thorimur
    Mar 15, 2021 at 0:08
  • $\begingroup$ Yes, Manipulate does the trick! $\endgroup$
    – Youvan
    Mar 15, 2021 at 0:20
  • $\begingroup$ Or Manipulate[Graphics[{Circle[], Point[{Cos[t], Sin[t]}]}], {t, 0, 6, Appearance -> "Labeled"}] or Manipulate[ Graphics[{Circle[], Point[{Cos[t], Sin[t]}]}], {t, 0, 6, Appearance -> "Labeled", AnimationRunning -> False, ControlType -> Animator}] $\endgroup$
    – Michael E2
    Mar 15, 2021 at 0:52

3 Answers 3

7
$\begingroup$

1. You can simply add the option Appearance -> "Labeled" in Animator control:

Animate[Graphics[{Circle[], PointSize[Large], Point[{Cos[t], Sin[t]}]}],
  {t, 0, 6, Appearance -> "Labeled", AnimationRunning -> False}]

enter image description here

2. Alternatively, you can define a custom control with desired elements combining a labeled slider with animator elements:

ClearAll[labeledAnimator]
labeledAnimator = Row[{Slider[##, Appearance -> "Labeled"], 
     Animator[##, AnimationRunning -> False, 
      AppearanceElements -> {"StepLeftButton", "StepRightButton", 
        "PlayPauseButton", "FasterSlowerButtons", "DirectionButton"}]}, 
    Spacer[1]] &;

Use labeledAnimator with Manipulate (it does not work with Animator) and add the option AppearanceElements -> {} to get the Animator look/feel:

Manipulate[Graphics[{Circle[], PointSize[Large], Point[{Cos[t], Sin[t]}]}], 
   {t, 0, 6, labeledAnimator, AnimationRunning -> False}, 
 AppearanceElements -> {}]

enter image description here

3. Using a variation on Alexey Popkov's idea: use a LabeledSlider as control label and remove the progress slider default list of animator appearance elements:

Animate[Graphics[{Circle[], PointSize[Large], Point[{Cos[t], Sin[t]}]}],
 {{t, 0, Dynamic@LabeledSlider[t, {0, 10}]}, 0, 10, 
  AppearanceElements -> {"PlayPauseButton", "FasterSlowerButtons", 
    "DirectionButton", "ResetButton"}}, 
 AnimationRunning -> False]

enter image description here

$\endgroup$
1
$\begingroup$

In addition to the excellent solution described by @kglr, one can make a custom label. Try this:

Animate[Graphics[{Circle[], PointSize[Large], 
   Point[{Cos[t], Sin[t]}]}],
 {{t, 0, Dynamic@
    Panel[Row[{Style["Time: ", Blue, 14], Style[t, Red, 14]}], 
     ImageSize -> {180, 50}]}, 0, 10}]

with the effect of

enter image description here

Have fun!

$\endgroup$
1
$\begingroup$

In case you are not aware, you can simply include t in the layout of the content area :

Animate[Column[{
   t,
   Graphics[{Circle[], Point[{Cos[t], Sin[t]}]}]
   }]
 , {t, 0, 6}, AnimationRunning -> False]  

[enter image description here][

$\endgroup$

Your Answer

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

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