7

I'm creating a beamer presentation on network protocols. I like to put very simple animations in the slides, like an arrow extending from sender to receiver, showing the flow of network messages.

I saw LaTeX packages like animate which can do this. Yet I believe they are an overkill.

Or, don't they? Well, I don't know.

Is there a simple way for doing what I'm after?

2 Answers 2

13

beamer has an \animate method that advances slides automatically in succession. You just have to create the "stop motion" slides. For instance:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\begin{frame}
\begin{tikzpicture}[every node/.style={draw}]
\node (s) {sender};
\node (r) at (5,0) {receiver};
\animate<2-10>
\foreach \pos in {0.1,0.2,...,1.0} {
  \action<+>{
    \path (s) -- (r) node[pos=\pos,coordinate] (p) {};
    \draw[->] (s) -- (p);
  }
}
\end{tikzpicture}
\end{frame}

\end{document}

Open the PDF in Adobe Reader and enable full screen mode. After one click you will see the arrow extend animatedly from sender to receiver.

0
9

Using the `animate' LaTeX package for this purpose isn't overkill, I think:

\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}

\begin{document}

\begin{frame}
\begin{animateinline}[loop]{10}
  \multiframe{10}{rPos=0.1+0.1}{
    \begin{tikzpicture}[every node/.style={draw}]
    \node (s) {sender};
    \node (r) at (5,0) {receiver};
    \path (s) -- (r) node[pos=\rPos,coordinate] (p) {};
    \draw[->] (s) -- (p);
    \end{tikzpicture}
  }
\end{animateinline}
\end{frame}

\end{document}

The number of code lines is about the same as in Matthews example. And the animation can be configured to loop over the frames.

1
  • 1
    +1. Thanks a lot Alexander. As you said, it wasn't an overkill at all! Dec 2, 2010 at 11:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .