0

I would like to have an animation (consisting of three pictures pic-0.jpg, pic-1.jpg, pic-2.jpg) with additional elements added on the top of the animation. What am I doing wrong? And how can I do it right?

\documentclass[xcolor={dvipsnames,svgnames,table},11pt]{beamer}
\usepackage{animate}
\begin{document}
\begin{frame}

\only<1>{Text}
\only<2> 
{\begin{animateinline}[autoplay,loop]{6}
   \multiframe{3}{i=0+1}{ 
   \begin{figure}[h!]
   \centering
   \setlength{\unitlength}{0.1\textwidth}
   \begin{picture}(0,0)
   \put(-6,-3){\includegraphics[height=0.8\columnwidth]{pic-\i} }
   \put(4.5,-2){$x$}
   \end{picture}
   \end{figure} }
 \end{animateinline}      }  

\end{frame}
\end{document}
AlexG
  • 54,894
Markow
  • 1

1 Answers1

1
  1. \begin{picture}(0,0) ... \end{picture} produces a box with zero dimensions, but animate wants non-zero size boxes in order to produce animation frames.

    TikZ is better suited for annotating external graphics files. Dedicated TikZ-based packages exist for image annotation, e. g. callouts on CTAN, and non-CTAN onimage, introduced ↗here. I prefer the latter. It can be downloaded as onimage.dtx↗here. Run pdflatex twice on it to get onimage.sty and the documentation onimage.pdf.


  1. The figure environment should be moved out of the animateinline environment.

\documentclass{beamer}
\usepackage{animate}
\usepackage{onimage}

\begin{document}

\begin{frame}{Annotated animation} \only<1>{Text} \only<2>{% \begin{figure}\centering \begin{animateinline}[autoplay,loop]{1} \begin{tikzonimage}[width=0.6\columnwidth]{example-image-a}[tsx/show help lines] \draw (0.5,0.5) [<-]-- (0.3,0.4) node [anchor=east] {centre}; \end{tikzonimage} \newframe \begin{tikzonimage}[width=0.6\columnwidth]{example-image-b}[tsx/show help lines] \node [anchor=south west] at (0,0) {lower left}; \end{tikzonimage} \newframe \begin{tikzonimage}[width=0.6\columnwidth]{example-image-c}[tsx/show help lines] \node [anchor=north east] at (1,1) {upper right}; \end{tikzonimage} %\newframe
%\multiframe{3}{i=0+1}{ % \begin{tikzonimage}[width=0.6\columnwidth]{pic-\i}[tsx/show help lines] % ... % \end{tikzonimage} %} \end{animateinline}% \caption{annotated animation} \end{figure} } \end{frame} \end{document}

AlexG
  • 54,894