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 not sure if this is even possible with the current PDF format specification, but I'd like to animate transitions between slide or between slide overlays by having part of the slide move or "fly" to a new spot. For instance,

\documentclass{beamer}
\usepackage{tikz}
\begin{document}

\begin{frame}
  \only<1-2>{some text before}
  \begin{tikzpicture}
    \draw<1> (0,0) node [fill=blue!20] (a) {hello} -- (1, 1) node [fill=red!20] (b) {world};
    \draw<2-> (0,0) node [fill=blue!20] (a) {hello} -- (0, 1) node [fill=red!20] (b) {world};
    \draw<1-> (2,2) node [fill=violet!20] (c) {this stays put};
  \end{tikzpicture}
  \only<3->{some text after}
\end{frame}
\end{document}

Ideally, there would be some way to animate between overlays 1 and 2 so that the audience gets a sense of continuity (for those familiar with the iOS developer library, or anyone who has ever studied user interface design on iOS, this concept will be familiar). Even better, when the text "some text before" goes away (overlays 3 and beyond), the whole tikz figure would slide left into it's new place.

Is this even possible with the current PDF standard (or anything else that TeX/LaTeX/*TeX can output)? Is there a package anywhere that implements this behavior? It sounds pretty extreme for a simple TeX/LaTeX/*TeX file, but I've learned to put nothing past tikz/pgf and beamer.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Animation is generally often a bad idea as it will distract the audience from the presentation (see Beamer manual).

I've read that animation (ex: dissolve, moveto) should be possible between frame with at least Acrobat reader, but I didn't try them, and they are limited to the whole slide.

Smooth animation could be precalculated using the animate package, as this nice example. I think that you could also move smoothly a part of a text between 2 points in a similar way.

Edit exemple of animation: production of AC current

\documentclass{beamer}
\usepackage{animate}
\usepackage{tikz}

\usetikzlibrary{decorations.markings}

\newcounter{angle}
\setcounter{angle}{0}

\begin{document}

\begin{frame}[fragile]{Production of AC current}{Alternator}
\begin{center}
\begin{animateinline}[loop,poster=first,controls]{10}
    \whiledo{\theangle<720}{
        \begin{tikzpicture}[scale=.7]
        \path[use as bounding box] (-3.5,-4) -- (10,4);
        %\draw (-3.5,-4) rectangle (10,4);
        % 1/2 surface inf
        \draw[black!50,thick] (2,-1) 
            arc[start angle=-90,end angle=90,x radius=.2cm, y radius=1cm];
        \begin{scope}[rotate=\theangle]
        % lignes de champ
        \foreach \h/\X/\Y in {.85/1.6/.8, 1.1/2/1.1, 1.325/2.4/1.35,%
                1.525/2.8/1.6} {
            \draw [decoration={markings,
                    mark=between positions 0 and 1 step 1.5cm 
                        with {\arrow{stealth}}},    
                    postaction={decorate},color=brown!60] (0,\h) 
                circle[x radius=\X cm,y radius=\Y cm];
            \draw [decoration={markings,
                    mark=between positions 0 and 1 step 1.5cm 
                        with {\arrowreversed{stealth}}},    
                    postaction={decorate},color=brown!60] (0,-\h)
                circle[x radius=\X cm,y radius=\Y cm];
        }
        \end{scope}
        % 1/2 surface sup
        \draw[thick] (2,-1) 
            arc[start angle=-90,end angle=-270,x radius=.2cm,%
                    y radius=1cm];
        % aimant
        \begin{scope}[rotate=\theangle]
        \fill[color=cyan!70] (-1,-.25) rectangle (0,.25);
        \fill[color=red!70] (0,-.25) rectangle (1,.25);
        \draw (-1,-.25) rectangle (1,.25);
        \end{scope}

        % calculation of the position       
        \pgfmathrad{\theangle}
        \edef\myangle{\pgfmathresult}
        \pgfmathparse{4 + .4 * \myangle}
        \edef\myX{\pgfmathresult}
        \pgfmathparse{2 * cos(\theangle)}
        \edef\myY{\pgfmathresult}

        \coordinate (O) at (4,0);
        \begin{scope}
        % axes
        \draw[->] (O) -- ++(5.5,0) node[below]{$t$};
        \draw[->] ([yshift=-2.5cm]O) -- ([yshift=2.5cm]O) node[left]{$I$};
            \begin{scope}[xshift=4cm,xscale=0.4] % sinusoïde
            % calcul clip
            %\node at (1,1) { \myangle };
            \clip (0,-2.5) rectangle (\myangle,2.5);
            \draw[green,thick] (0,2) cos (1.5708,0) sin (3.1416,-2)
                    cos (4.7124,0) sin (6.2832,2) cos (7.8540,0)
                    sin (9.4248,-2) cos (10.9956,0) sin (12.5664,2); 
            \end{scope}

        \draw[fill=green!30,draw=green] (\myX,\myY) circle[radius=.5mm];
        \end{scope}
        \end{tikzpicture}       
        %
        %\addtocounter{angle}{720}
        \addtocounter{angle}{5}
        %\stepcounter{angle}
        \ifthenelse{\theangle<720}{%
            \newframe
        }{%
            \end{animateinline}
        }
    }
\end{center}
\end{frame}

\end{document}
share|improve this answer
    
@Jake I agree, I was more talking about animations as transition effects: powerpoint as some very nice transitions effects or moving points with rotation, and noise, and blinking, and ... All this nice stuff is a distraction and often mask a lack of content with a nice aspect. And "when the text [...] goes away [...] the whole [...] figure would slide left into it's new place." is - in my opinion - exactly this kind of bad animation –  Lionel MANSUY Feb 22 '13 at 17:11
    
Jake has the right idea actually. I didn't go into details about my specific use case because it wasn't necessary to the question, but in my case I'm moving around parts of equations that are very hard to follow otherwise. Also, I often have to take a part of an equation from the previous slide and elaborate on it on the next slide. It's not always entirely obvious where that part comes from, and when I present I often find myself flipping back and forth to show this. Continuity makes all the difference in these sorts of cases. –  David Hollman Feb 22 '13 at 17:59
    
@DavidHollman have you checked the link on "nice example"? It's quite easy to make such an animation. I will edit my answer to provide one animation I made: it's not moving equation, but the principles are the same. –  Lionel MANSUY Feb 22 '13 at 22:09
    
Thanks, I went ahead and accepted your answer, since it looks like it's the best option. It would be nice if there were a package that automated this, though, particularly the interpolation. Sounds like another one to add to the list of "nice problems to take on when I have the time." Thanks for the help. –  David Hollman Feb 23 '13 at 23:49

Moving objects in a presentation, without adding information are often considered distracting.
It is possible, with limitations. Probably because it was never considered worth the effort, probably because the underlying PDF format is not made for it.

The animate package lets you create animations on a single slide. It will however use a certain number discrete steps for the transition. While this may look nice on your laptop, your image will still jump/jitter on the large beamer image on the wall. Examples for animate can be found on Texample - animations.
This uses Javascript though, for the transitions and is therefore limited to the Acrobat Reader.

Slightly higher compatibility can be achieved, using \transduration<overlay specification>{time}. You can then create a lot of frames and make the reader run through them, by specifying a time of 0 seconds. Even if this does not work automatically on a different system, you can still show your animation then, using the clicker excessively.

The best use would be to only specify a before and a after frame and letting the viewer create the limited amount of availablle full page transitions.
Define them by use of

\begin{frame}
\transwipe
\only<1>{First}
\only<2>{Second}
\end{frame}

The full (?) list of transitions, supported by the PDF format are listed in this answer.
These transitions do not lead to problems, if unsupported, and are the smoothest, because they are created by the Acrobat Reader. The increase in file size is also the lowest, using these.
Option two and three can be combined. The transduration command can lead to problems during the actual presentation, since it makes it hard to go back to a previous slide. I use white hyperlinks, for safety.

share|improve this answer

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.