This is a nice example of using the JavaScript API of animate
and the \mediabutton
command of media9
.
User Caramdir's excellent onimage package is used to place the buttons onto the animation. However, we have to patch onimage.sty
in order to not use \includegraphics
.
For the code below to compile, copy the example image files from package mwe
into the current directory as
cp $TEXMF/tex/latex/mwe/example-image-a.png ./example-image-1.png
cp $TEXMF/tex/latex/mwe/example-image-b.png ./example-image-2.png
cp $TEXMF/tex/latex/mwe/example-image-c.png ./example-image-3.png
since we need numbered images for \animategraphics
.

\documentclass{beamer}
\usepackage{animate}
\usepackage{media9} % buttons via \mediabutton
%get it from http://bazaar.launchpad.net/~tex-sx/tex-sx/development/view/head:/onimage.dtx
\usepackage{onimage}
%patch onimage.sty not to use \includegraphics
\makeatletter
\def\tikzonimage@opt[#1]#2{%
\begin{tikzpicture}
%\node[inner sep=0] (image) {\includegraphics[#1]{#2}};
\node[inner sep=0] (image) {#2};
\begin{tikzonnode}{image}%
}
\makeatother
\begin{document}
\begin{frame}
\begin{tikzonimage}{%
\animategraphics[method=ocg,label=myGUI,step,nomouse,width=0.8\linewidth]{1}{example-image-}{1}{3}
}[tsx/show help lines]
\node at (0.8 , 0.8) [anchor=south east, inner sep=0pt, outer sep=0pt] {
\mediabutton[
jsaction={try{anim.myGUI.frameNum--}catch(e){}}
]{\fbox{\small\strut back}}};
\node at (0.8 , 0.8) [anchor=south west, inner sep=0pt, outer sep=0pt] {
\mediabutton[
jsaction={try{anim.myGUI.frameNum++}catch(e){}}
]{\fbox{\small\strut next}}};
\end{tikzonimage}
\end{frame}
\end{document}