Simple Beamer animation

man

The following LaTeX document shows a simple usage of the animate package. I used it once for the final frame of a Beamer presentation.

\documentclass{beamer}

\usepackage{tikz}
\usepackage{animate}

\newcommand{\mancommon}[1]{%
    \begin{tikzpicture}[ultra thick,scale=0.25]
      \draw (0,0) -- (1,2) -- (2,0); %legs
      \draw (1,2) -- (1,4);          %trunk
      \draw (1,4.7) circle (0.7cm);  %head
      #1
    \end{tikzpicture}}

\newcommand{\mananimated}{\begin{animateinline}[autoplay,loop]{3}
    \mancommon{\draw (-1,3.5) -- (1,3) -- (3,3.5);}
    \newframe
    \mancommon{\draw (-1,3) -- (3,3);}
    \newframe
    \mancommon{\draw (-1,2.5) -- (1,3) -- (3,2.5);}
    \newframe
    \mancommon{\draw (-1,3) -- (3,3);}
\end{animateinline}}

\begin{document}
\begin{frame}
  \begin{center}
    \mananimated\hspace{0.4cm}
    \mananimated\hspace{0.4cm}
    \mananimated\hspace{0.4cm}
    \mananimated
  \end{center}
\end{frame}
\end{document}

Advertisements
This entry was posted in LaTeX and tagged , . Bookmark the permalink.

2 Responses to Simple Beamer animation

  1. yag says:

    can we add gif file for animations in beamer.?

  2. Rafael says:

    I don’t think so. In that case you could split the gif and then you can use the animate package to achive the effect of the animation.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s