反向发现节点和边

反向发现节点和边

考虑以下 Tikz 示例,如何从下到上发现节点?我希望节点C出现在幻灯片 1 上,然后B to C在幻灯片 2 上,沿着从节点到最终节点的路径A以及来自的路径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}

答案1

\onslide这是文本和draw on来自的组合雙方对于箭头:

\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}

onslide如果您需要保留空间和类似的东西,您可能想要使用不同的东西。

在此处输入图片描述

相关内容