tikz:在投影仪演示中的树中的几代之间暂停

tikz:在投影仪演示中的树中的几代之间暂停

我一直在为 tikz-tree 编写以下代码:

\documentclass{beamer}
\begin{document}    
\begin{frame}

\begin{figure}
\centering

\begin{tikzpicture} [nodes={draw, rectangle, fill=orange!30, sibling distance=10cm,minimum height=2em}, ->]

\node[fill=orange!30, rectangle]{0}
child { node {A} }
child [missing]
    child { node[fill=orange!30, rectangle] {F: 3} 
    child { node[fill=orange!30, rectangle] {G: 28} 
    {child {node{Z}}}
      child {node[fill=orange!30, rectangle] {L: 22}}
        child [missing]
      child {node {B: 296}}
    }}
child [missing]
child { node {C: 167} }
child [missing]
child { node {D: 92}};
\end{tikzpicture}

 \end{figure}
 \end{frame}
  \end{document}

我希望在几代人之间有一个停顿:你能帮助我这样做吗?

多谢 :)

1dre

答案1

复制 TikZ 代码...

将它们粘贴到原来的下面...放置...\action它们之间...并保持最后的副本不变...但在之前插入的每个副本中...要么开始改变颜色以使其不可见,或者如果可能的话,删除与世代相对应的代码......

\documentclass{beamer}
\usepackage{tikz}
\begin{document}    
\begin{frame}[label=CCS]
\frametitle{Motivations and Directions}
\framesubtitle{The Cache County Study (CCS)}

\begin{figure}
\centering

\begin{tikzpicture} [nodes={draw, rectangle, fill=orange!30, sibling distance=10cm,minimum height=2em}, ->]

\action<1>{\node[fill=orange!30, rectangle]{0};}

\action<2>{\node[fill=orange!30, rectangle]{0}
child { node {A} }
child [missing]
    child { node[fill=orange!30, rectangle] {F: 3} 
    }
child [missing]
child { node {C: 167} }
child [missing]
child { node {D: 92}};
}

\action<3>{\node[fill=orange!30, rectangle]{0}
child { node {A} }
child [missing]
    child { node[fill=orange!30, rectangle] {F: 3} 
    child { node[fill=orange!30, rectangle] {G: 28} 
    }}
child [missing]
child { node {C: 167} }
child [missing]
child { node {D: 92}};
}

\action<4>{\node[fill=orange!30, rectangle]{0}
child { node {A} }
child [missing]
    child { node[fill=orange!30, rectangle] {F: 3} 
    child { node[fill=orange!30, rectangle] {G: 28} 
    {child {node{Z}}}
    }}
child [missing]
child { node {C: 167} }
child [missing]
child { node {D: 92}};
}

\action<5>{\node[fill=orange!30, rectangle]{0}
child { node {A} }
child [missing]
    child { node[fill=orange!30, rectangle] {F: 3} 
    child { node[fill=orange!30, rectangle] {G: 28} 
    {child {node{Z}}}
      child {node[fill=orange!30, rectangle] {L: 22}}
        child [missing]
      child {node {B: 296}}
    }}
child [missing]
child { node {C: 167} }
child [missing]
child { node {D: 92}};
}



\end{tikzpicture}



\end{figure}
\end{frame}
\end{document}

按级别逐步显示树

相关内容