2

I am trying to make an animation that requires a click before each successive frame is displayed. Further, it will loop back to the first frame upon clicking the last frame.

MWE

In this MWE, the user clicks on each frame to advance. Upon clicking the final frame (the black shirt), the animation loops. However, the red shirt (frame 1) is quickly skipped without the user clicking the frame.

How do I pevent the red shirt frame from being skipped on the second pass?

Note: You may need to download the PDF and use a viewer that supports animation.

https://github.com/lucasreddinger/etc/raw/master/stackexchange.tex/q-animate-skips-first-frame-after-manual-loop/animation.pdf

\documentclass{standalone}

\usepackage{graphicx} \usepackage{animate}

\begin{filecontents}{timeline.txt} ::0 ::1 *::2 \end{filecontents}

\begin{document} \centering\animategraphics[timeline=timeline.txt]{5}{frames}{}{} \end{document}

Example use case

Here's something that's closer to my actual use case.

https://github.com/lucasreddinger/etc/raw/master/stackexchange.tex/q-animate-skips-first-frame-after-manual-loop/animation-pause-on-red.pdf

Steps to replicate:

  1. Click on red shirt.
  2. Watch shirt color alternate successively a few times, before settling on black.
  3. Click on black shirt to return to the beginning.

Expected behavior:

  1. Frame with red shirt waits for user click

Actual behavior:

  1. Frame with red shirt quickly advances and shows blue/black shirts

Many thanks for your help!

\documentclass{standalone}

\usepackage{graphicx} \usepackage{animate}

\begin{filecontents}{timeline.txt} *::0 ::1 ::2 ::1 ::2 ::1 ::2 \end{filecontents}

\begin{document}

\centering\animategraphics[timeline=timeline.txt]{5}{frames}{}{}

\end{document}

Lucas
  • 309
  • You are right, it somewhat looks like a bug. To work around it, I suggest to duplicate the first line of the timeline file. – AlexG Sep 28 '20 at 09:23

1 Answers1

2

This was indeed a bug which could finally be resolved in version [2020/10/05] of animate.

Interactive example:

\documentclass{standalone}

\usepackage{animate}

\begin{filecontents}[overwrite]{timeline.txt}

  • ::0 ::1 ::2 ::1 ::2 ::1 ::2

\end{filecontents}

\begin{document} \begin{animateinline}[ width=2in, timeline=timeline.txt ]{1} \multiframe{3}{i=0+1}{\fbox{\Huge \i}} \end{animateinline} \end{document}

AlexG
  • 54,894
  • Thanks for this. I was just trying to construct an MWE, though. My use case involves more complex sequences, but I cannot figure out why the first frame is quickly advanced. – Lucas Sep 27 '20 at 21:36
  • I have since added an example use case to the original question, if you have any insight. Thanks! – Lucas Sep 27 '20 at 22:42
  • @Lucas Now it should work, finally. – AlexG Oct 06 '20 at 10:49
  • Thanks a lot @AlexG for working through this with me! I'd be happy to move to an issue tracker, if you prefer, though. I'm still having the same problem (note the compile dates:

    https://github.com/lucasreddinger/etc/raw/master/stackexchange.tex/q-animate-skips-first-frame-after-manual-loop/animation-pause-on-red_2020-09-30.pdf https://github.com/lucasreddinger/etc/raw/master/stackexchange.tex/q-animate-skips-first-frame-after-manual-loop/animation-pause-on-red_2020-10-07.pdf

    – Lucas Oct 07 '20 at 11:17
  • @Lucas Sorry. Didn't test with PDF output but with SVG were the (hot-)fix worked. I have to look again into it. – AlexG Oct 07 '20 at 12:03
  • @Lucas. This one should work: animate.sty – AlexG Oct 07 '20 at 12:53
  • 1
    Great, thanks a bunch! Got it working my my slides, my paper, and this MWE:

    https://github.com/lucasreddinger/etc/raw/master/stackexchange.tex/q-animate-skips-first-frame-after-manual-loop/animation-pause-on-red_2020-10-07_r2.pdf

    Cheers!

    – Lucas Oct 07 '20 at 19:43
  • And thanks a lot for reporting this issue! – AlexG Oct 07 '20 at 20:06