# animate skips first frame after manual loop

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}

• You are right, it somewhat looks like a bug. To work around it, I suggest to duplicate the first line of the timeline file. Sep 28, 2020 at 9:23

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}