Here is a, somewhat loose, collection of tips and tricks I frequently use to manage beamer frames with lots of slides and complicated animations.
Code Flow Dimension with TikZ
I do not use beamer's overlay commands (\visible<>, \only<>, and so on). Instead I always draw all elements, but hide them on the slides they should not appear. To specify the visibility, I use a visible on=<...> TikZ style as follows (taken from Mindmap tikzpicture in beamer (reveal step by step), look there for a complete MWE):
% Keys to support piece-wise uncovering of elements in TikZ pictures:
% \node[visible on=<2->](foo){Foo}
% \node[visible on=<{2,4}>](bar){Bar} % put braces around comma expressions
%
% Internally works by setting opacity=0 when invisible, which has the
% adavantage (compared to \node<2->(foo){Foo} that the node is always there, hence
% always consumes space that (foo) is always available.
%
% The actual command that implements the invisibility can be overriden
% by altering the style invisible. For instance \tikzsset{invisible/.style={opacity=0.2}}
% would dim the "invisible" parts. Alternatively, the color might be set to white, if the
% output driver does not support transparencies (e.g., PS)
%
\tikzset{
invisible/.style={opacity=0},
visible on/.style={alt={#1{}{invisible}}},
alt/.code args={<#1>#2#3}{%
\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
},
}
With this approach, all named elements (especially nodes) are always there, so you can use them for coordinate calculations even on slides they are not visible. Moreover, the tikzpicture always has the complete size, preventing the frequently asked issue of "jumping images".
The same argument applies to highlighting effects (e.g., turn node red on slide 2). For those, I use the following style (originally taken from Matthew Leingang's answer to How to make beamer overlays with Tikz node):
% Key to apply style on specific overlays only
% usage (e.g.): \node[onslide=<2->{fill=red}]{I am red on slide 2!};
%
% see also: https://tex.stackexchange.com/questions/6135/how-to-make-beamer-overlays-with-tikz-node
%
\tikzset{onslide/.code args={<#1>#2}{%
\only<#1>{\pgfkeysalso{#2}}
}}
Of course, you could easily combine all this with other styles or TikZ scopes. IMHO, all this makes the code much better readable than the standard overlay commands.
I have been using this approach for a couple of years.
Numbering of overlay steps
If developing lager animations, it is generally a good idea to use relative overlay specification where ever possible (and thanks to Joseph's answer to Relative overlay specification in beamer? I have learned that this mechanism is really powerful).
Nevertheless, at times you will find yourself in the situation that you have to use absolute numbers or you just want to use them, because they make the code better readable:
\begin{frame}{Uncovering piecewise}
\begin{tikzpicture}[every node/.style={fill=red!30, draw=red}]
\node{Foo}
child[visible on=<3->]{node {Bar}}
child[visible on=<2->]{node {Baz}}
;
\end{tikzpicture}
\par
\only<3>{COOL PICTURE!}
\end{frame}
With absolute numbers, however, it can become a real a PITA if you later want to insert an intermediate step and, hence, have to increment all subsequent numbers manually.
To prevent situations like that, I have adopted the line numbering scheme from my early days of BASIC programming: Initially use only multiples of 10, so that there is some space to later add lines "in between". To prevent beamer creating 10 slides for each animation step, I then manually restrict the steps to use on the frame level:
\begin{frame}<1,20,30>{Uncovering piecewise}
\begin{tikzpicture}[every node/.style={fill=red!30, draw=red}]
\node{Foo}
child[visible on=<30->]{node {Bar}}
child[visible on=<20->]{node {Baz}}
;
\end{tikzpicture}
\par
\only<30>{COOL PICTURE!}
\end{frame}
Tailoring Animations for Handouts
The idea to tailor animation steps also on the frame level can also be applied for the easy problem-specific tailoring of your animations, such as for the handout.
In handout mode, beamer usually collapses all slides of a frame to a single slide and uses that for the handout. However, I often want to provide some steps of the animation (but not all of them) in the handout. In that case, one can use the mode specifiers (all:, handout:, beamer:) to tell beamer that an certain animation elements should also or only be part of the handout/presentation slides, respectively.
Instead of specifying this element-wise, which quickly becomes a nightmare to maintain, I use the all:-specifier for all overlay specifications, so that each step of the animation would also become part of the handout. I then select the slides I actually want in the handout on the frame level:
% Skip slide 2 in handout
\begin{frame}<beamer|handout:1,3>{Uncovering piecewise}
\begin{tikzpicture}[every node/.style={fill=red!30, draw=red}]
\node{Foo}
child[visible on=<all:3->]{node {Baz}}
child[visible on=<all:2->]{node {Bar}}
;
\end{tikzpicture}
\par
\only<all:3>{COOL PICTURE!}
\end{frame}
In my process, creating the handout (and deciding which slides should be in it) is typically one of the last actions I take. By this approach, it becomes very easy to tailor the handout.
aobs-tikzpackage, which defines several styles (keeping the spirit ofvisible on) for altering other properties, including filling and shading. Examples are: How to overlay tikz matrix in beamer? and Highlighting in Beamer using TikZ nodes. – Claudio Fiandrino Jan 22 '14 at 09:38gvim's Ctrl-A and Ctrl-X. http://vim.wikia.com/wiki/Increasing_or_decreasing_numbersCombined with macro recording in vi, changes are useful. – Yossi Gil Jan 22 '14 at 09:46