I have 2 presentations:
\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}
\begin{document}
\usetikzlibrary{calc,intersections}
\begin{frame}
\begin{center}
\begin{tikzpicture}
\useasboundingbox (3,0.5) rectangle (7,4.5);
\pause
\draw [name path=circle, line width=1](5,2.5) circle (2);
\pause
\draw [name path=line, line width=1](2,1)--(7,4) ;
\path [name intersections={of = circle and line}];
\coordinate (A) at (intersection-1);
\coordinate (B) at (intersection-2);
\pause
\filldraw(A) circle (1.5pt);
\pause
\filldraw(B) circle (1.5pt);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
and
\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}
\begin{document}
\usetikzlibrary{calc}
\begin{frame}
\begin{animateinline}[autoplay]{90}
\multiframe{121}{iAngle=0+3}
{\begin{tikzpicture}
\useasboundingbox (3,0.5) rectangle (7,4.5);
\draw [line width=1](5,2.5) arc (0:\iAngle:2);
\end{tikzpicture}}
\end{animateinline}
\end{frame}
\end{document}
I want to combine it with all functionality. I do it this way:
\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}
\begin{document}
\usetikzlibrary{calc,intersections}
\begin{frame}
\begin{center}
\begin{tikzpicture}
\useasboundingbox (3,0.5) rectangle (7,4.5);
\pause
\begin{animateinline}[autoplay]{90}
\multiframe{121}{iAngle=0+3}
{\draw [line width=1](5,2.5) arc (0:\iAngle:2);}
\end{animateinline}
\draw [name path=circle, line width=1](5,2.5) circle (2);
\pause
\draw [name path=line, line width=1](2,1)--(7,4) ;
\path [name intersections={of = circle and line}];
\coordinate (A) at (intersection-1);
\coordinate (B) at (intersection-2);
\pause
\filldraw(A) circle (1.5pt);
\pause
\filldraw(B) circle (1.5pt);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
What am I doing wrong? And how can I do it right?
Best Answer
A TikZ
\draw
alone doesn't produce a box with non-zero width and height, butanimateinline
expects something of non-zero size in order to produce animation frames.Therefore a
tikzpicture
environment must surround the graphical objects inside theanimateinline
environment (as in the standalone animation in the 2nd code box). But you removed it from the "combined" document (3rd code box). Hence, the reported errorThe animation should be saved in an ordinary
lrbox
and put as a\node
on the second slide (\node<2> ...
). The final animation frame should be repeated on the slides after the slide with the animation: