# Displaying a sequence of images in a timed fashion in beamer

I would like to display a sequence of images in a timed fashion in beamer i.e. I want to zoom an image from small size to large size. Below is the code I tried and I get some errors while compiling.

\documentclass{beamer}

\usetheme{Copenhagen}
\usecolortheme{whale}
\useinnertheme{rounded}

\usepackage{tikz}
\usepackage{calc}
\usepackage{forloop}

\begin{document}

\newcounter{k}
\forloop{k}{1}{\value{k} < 11}{
\begin{frame}
\transduration{0.1}
\includegraphics[scale=\value{0.01\arabic{k}}]{images/my_image.pdf}
\end{frame}
}

\end{document}

-

## 2 Answers

You can do something like this, using TikZ's \foreach and the overlay specification for \includegraphics:

\documentclass{beamer}
\usetheme{Copenhagen}
\usecolortheme{whale}
\useinnertheme{rounded}
\usepackage{tikz}

\begin{document}

\begin{frame}
\centering
\transduration{0.1}
\foreach \k [evaluate=\k as \kscale using \k/100] in {1,2,...,10}
{\includegraphics<\k>[scale=\kscale]{ctanlion}}

\end{frame}

\end{document}


CTAN lion drawing by Duane Bibby.

-
Thanks Gonzalo Medina! – user1876 Oct 19 '12 at 1:45

The use of \transduration requires Adobe Reader for display. Therefore, one could also use the animate package. The animation is embedded in a single physical page of the final PDF:

\documentclass{beamer}
\usetheme{Copenhagen}
\usecolortheme{whale}
\useinnertheme{rounded}
\usepackage{animate}

\newsavebox\imgbox
\sbox\imgbox{\includegraphics[scale=0.5]{ctanlion}}

\begin{document}

\begin{frame}
\begin{center}
\begin{animateinline}[loop,autoplay]{10} %10 frames per s
\multiframe{10}{rScale=0.1+0.1}{
\hbox to \wd\imgbox{
\hss  %\hss, \vss -->stretchable space for centering
\vbox to \ht\imgbox{\vss\scalebox{\rScale}{\usebox\imgbox}\vss}
\hss
}
}
\end{animateinline}
\end{center}
\end{frame}

\end{document}

-
Thanks. `\transduration' also works with Document viewer on ubuntu, which is what I use to open pdf files. – user1876 Oct 19 '12 at 18:13