7

Considering the following Tikz example, how can one uncover nodes from bottom to top? I would like the node C appear on slide 1, then B on slide 2 along with the path from B to C and finally node A along with the path from A to B.

\documentclass{beamer}

\usepackage{tikz}

\usetikzlibrary{trees}

\begin{document}
\begin{frame}
  \begin{tikzpicture}[
    level 1/.style={every child/.style={edge from parent/.style={->,solid,draw=blue}} },
    level 2/.style={sibling distance=12mm,every child/.style={edge from parent/.style={->,solid,draw=blue}}},
    level 3/.style={sibling distance=8mm,every child/.style={edge from parent/.style={->,solid,draw=blue}}},
    semithick]

    \node[draw=none] (root) {A}
    child[] {node[draw=none] {B}
      child[] {node[draw=none] {C}
      }};
  \end{tikzpicture}
\end{frame}
\end{document}
d-cmst
  • 23,095
Shahzad
  • 1,297
  • 14
  • 19

1 Answers1

3

This is a combination of \onslide for text and draw on from aobs-tikz for the arrows:

\documentclass{beamer}


\usepackage{tikz}

\usetikzlibrary{trees,overlay-beamer-styles}

\begin{document}
    \begin{frame}
        \begin{tikzpicture}[
        level 1/.style={every child/.style={edge from parent/.style={->,solid,draw=blue,draw on=<{3-}>}} },
        level 2/.style={sibling distance=12mm,every child/.style={edge from parent/.style={->,solid,draw=blue,draw on=<{2-}>}}},
        level 3/.style={sibling distance=8mm,every child/.style={edge from parent/.style={->,solid,draw=blue}}},
        semithick]

        \node[draw=none] (root) {{\onslide<3->{A}}}
        child[] {node[draw=none] {{\onslide<2->{B}}}
            child[] {node[draw=none] {C}
            }};
            \end{tikzpicture}
        \end{frame}
    \end{document}

You may wanto to use something different instead of onslide if you need to reserve space and stuff like that.

enter image description here

d-cmst
  • 23,095