我想慢慢地揭开树中的节点。但是当我使用叠加时,生成的图像会在幻灯片中跳动。我该如何摆脱它?
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\begin{document}
\begin{frame}
\frametitle{Standard Approach}
\begin{tikzpicture}
\draw node[circle,draw] (0) at (0,0) {$s_0$};
\draw <2-> node[circle,draw] (1) at (-1,-1) {$s_1$};
\draw <2-> node[circle,draw] (2) at (1,-1) {$s_2$};
\draw <2-> [->, dashed] (0) to (1);
\draw <2-> [->] (0) to (2);
\draw <3-> node[circle,draw] (3) at (-0.5,-2) {$m$};
\draw <3-> node[circle,draw] (4) at (-1.5,-2) {$j$};
\draw <3-> [->] (1) to (3);
\draw <3-> [->, dashed] (1) to (4);
\draw <4-> node[circle,draw] (5) at (0.5,-2) {$s$};
\draw <4-> node[circle,draw] (6) at (1.5,-2) {$s_3$};
\draw <4-> node[circle,draw] (7) at (1,-3) {$a_r$};
\draw <4-> node[circle,draw] (8) at (2,-3) {$a_i$};
\draw <4-> [->, dashed] (2) to (5);
\draw <4-> [->] (2) to (6);
\draw <4-> [->] (6) to (8);
\draw <4-> [->, dashed] (6) to (7);
\end{tikzpicture}
\end{frame}
\end{document}
答案1
在这种情况下,你的朋友是\onslide
。
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\begin{document}
\begin{frame}
\frametitle{Standard Approach}
\begin{tikzpicture}
\draw node[circle,draw] (0) at (0,0) {$s_0$};
\onslide<2->{\draw node[circle,draw] (1) at (-1,-1) {$s_1$};
\draw node[circle,draw] (2) at (1,-1) {$s_2$};
\draw [->, dashed] (0) to (1);
\draw [->] (0) to (2);}
\onslide<3->{\draw node[circle,draw] (3) at (-0.5,-2) {$m$};
\draw node[circle,draw] (4) at (-1.5,-2) {$j$};
\draw [->] (1) to (3);
\draw [->, dashed] (1) to (4);}
\onslide<4->{\draw node[circle,draw] (5) at (0.5,-2) {$s$};
\draw node[circle,draw] (6) at (1.5,-2) {$s_3$};
\draw node[circle,draw] (7) at (1,-3) {$a_r$};
\draw node[circle,draw] (8) at (2,-3) {$a_i$};
\draw [->, dashed] (2) to (5);
\draw [->] (2) to (6);
\draw [->] (6) to (8);
\draw [->, dashed] (6) to (7);}
\end{tikzpicture}
\end{frame}
\end{document}