16

please consider the following example:

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
   \begin{frame}
      \begin{tikzpicture}[remember picture,overlay]
         \only<1>{
                \node at(current page.center){test};
            }
            \only<2>{
                \node [anchor=north]at(current page.north){test};
            }
      \end{tikzpicture}
   \end{frame}

\end{document}

It produces two slides: the first with the centered text and the second with the same text in the northern part of the frame.

I'd like to know if there is some technique to obtain a "moving text" effect: an animation that graciously moves the text north until it reaches the second slide position.

edit: I just discovered the animate package that seems to be able to do what I want. But the examples in the manual involve very complicated figures while I need to move just tikz nodes (with text inside mostly). Is there anybody who'd like to show me how to animate my code?

disclaimer: I know animation are considered bad practice but this is a very special use case.

3
  • You could combine tikz and foreach and make the slides change automatically. Drawback: if you want to go back to a previous slide, you have to use hyperlinks (or click on "previous slide" many times...).
    – anderstood
    Aug 6, 2014 at 20:45
  • Yes, but that technique also adds clapping noise and a paperclip assistant.
    – percusse
    Aug 6, 2014 at 20:51
  • Paperclip assistant? Is because of Windows? Never had that. And it can probably be removed.
    – anderstood
    Aug 6, 2014 at 20:54

2 Answers 2

11

Similar to Herbert answer but with TikZ:

\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}
\setbeamersize{text margin left=0cm,text margin right=0cm}             % removing text margins so that all the frame space will be available
\beamertemplatenavigationsymbolsempty

\begin{document}

\begin{frame}
\begin{animateinline}[
    begin={\begin{tikzpicture}
        \useasboundingbox (0,0) rectangle (\textwidth,\textheight);},  % this defines the space where the tikz content will be placed (and moved around)
    end=\end{tikzpicture}]{25}                                         % 25 is the animation speed
    \multiframe{40}{rA=5+0.1}{                                         % this is where the animation is defined as \rA
        \node at(.5\textwidth,\rA) {test};        
    }%
\end{animateinline}
\end{frame}

\end{document}

you can compile with pdflatex but of course you still need acrobat reader to properly see the animation.

1
  • I'm switching accepted answer because I' using TikZ and not PSTricks
    – Vishesh
    Oct 15, 2014 at 12:07
8
\documentclass{beamer}
\usepackage{multido}
\begin{document}
\begin{frame}[t]
\begin{center}
\only<1->{test}

\multido{\iA=40+-1}{40}{\only<+>{\rule{0pt}{\iA ex}test}}
\end{center}
\end{frame}

\end{document}

An animation with package animate. Run it with xelatex or latex->dvips->ps2pdf:

\documentclass{beamer}
\usepackage{pstricks}
\usepackage{animate}
\begin{document}

\begin{frame}[t]
\begin{center}
\begin{animateinline}[controls, palindrome,begin={\begin{pspicture}(0,-1ex)(\linewidth,8cm)},end=\end{pspicture}]{10}%
\multiframe{76}{rA=0.0+0.1}{\rput(0.5\linewidth,7.5){test}\rput(0.5\linewidth,\rA){test}}%
\end{animateinline}
\end{center}
\end{frame}

\end{document}

enter image description here

The PDF is here. View it with the Adobe Reader in fullscreen mode.

6
  • this is very cool but I'd prefer a solution where I can click somewhere and the animation is performed. Like a "real" animation :)
    – Vishesh
    Aug 6, 2014 at 21:22
  • @Vishesh: Add a hyperref \PushButton, which starts the animation?
    – user31729
    Aug 6, 2014 at 21:30
  • That is simple with package animate
    – user2478
    Aug 6, 2014 at 21:31
  • 1
    @Herbert can you show how to do it with the package animate?
    – Vishesh
    Aug 6, 2014 at 21:42
  • 1
    see my extended anwer
    – user2478
    Aug 7, 2014 at 8:55

You must log in to answer this question.

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