I have a tree drawn in tikz and want to animate its transformation to another tree. The structure of the trees is the same, it's just the labels (and for good measure the colours of the labels) which change. So, before:
and after:
I want the animation to proceed row by row: first the bottom row changes, then the middle row, then the top rop.
How can I do this with least code duplication? I have seen a nice example showing how to change just the formatting on a frame-by-frame basis, but I want to change the labels as well as the formatting.
Code for the two trees follows.
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\node at (5cm, 0cm) {the}
child {node at (-1.5cm, -.3cm) {quick}
child {node at (-1cm, -.3cm) {brown}}
child {node at (1cm, -.3cm) {fox}}
}
child {node at (1.7cm,-.3cm){jumped}
child {node at (-.5cm, -.3cm) {over}}
child {node at (.8cm, -.3cm) {the}}
};
\end{tikzpicture}
\end{frame}
\begin{frame}
\begin{tikzpicture}
\node [red] at (5cm, 0cm) {now}
child {node [red] at (-1.5cm, -.3cm) {is}
child {node [red] at (-1cm, -.3cm) {the}}
child {node [red] at (1cm, -.3cm) {time}}
}
child {node [red] at (1.7cm,-.3cm){for}
child {node [red] at (-.5cm, -.3cm) {all}}
child {node [red] at (.8cm, -.3cm) {good}}
};
\end{tikzpicture}
\end{frame}
\end{document}
