## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ animate, tikZ | Unexpected Result Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
mas
Posts: 223
Joined: Thu Dec 04, 2008 4:39 am

### animate, tikZ | Unexpected Result

I was able to get the animation for a series of bitmap files using the animate package. I thought of using it for a figure drawn in TikZ.

Here is the MWE:
\documentclass{beamer}\usepackage{tikz}\usepackage{animate} \begin{document}   \begin{frame}     \begin{center}       \begin{animateinline}[         loop,         controls,         begin={\begin{tikzpicture}},         end={\end{tikzpicture}}       ]{1}         \newframe         \draw[fill=red] (0,0) circle (3cm);         \newframe         \draw[fill=blue] (0,0) circle (6cm);       \end{animateinline}     \end{center}   \end{frame}\end{document}

When I try to compile this, I get the following error:
! Package animate Error: Contents of first frame must not have zero width. See the animate package documentation for explanation.Type  H <return>  for immediate help.  ...                                               l.19 \end{frame} ?

Assuming that there was a problem in getting the dimensions, I added something like
\draw (-4,-4) rectangle (4,4); just before the first \newframe command. It was successful. But, I was surprised to see both the circles being drawn with the same radius.

Regards.

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim

Tags:

alex
Posts: 32
Joined: Mon May 19, 2008 10:53 am
In your example, there is no material in the first frame between \begin{animateinline}... and \newframe. The size of the first frame is measured to set the animation box dimensions in the document.

All subsequent frames will be scaled anamorphically to fit into the animation box. Therefore both circles are displayed at the same size. You need to set-up a bounding box of fixed size that is used with each of the animation frames.

Instead of \draw, put \useasboundingbox in front of the rectangle and move this command from the first frame into the code of the begin option. See animate doc on page 8.
Last edited by alex on Thu Jan 24, 2013 2:41 pm, edited 1 time in total.

mas
Posts: 223
Joined: Thu Dec 04, 2008 4:39 am
Thanks. That solved the problem.

Regards.

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim

### Who is online

Users browsing this forum: Google [Bot] and 7 guests