Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 13 down vote accepted

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.

share|improve this answer
    
Thanks Matthew. Exactly what I needed! –  Sadeq Dousti Dec 1 '10 at 15:07

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.

share|improve this answer
1  
+1. Thanks a lot Alexander. As you said, it wasn't an overkill at all! –  Sadeq Dousti Dec 2 '10 at 11:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.