在幻灯片过渡时使用 \setbeamercovered{transparent},tikz 节点文本会淡出,但路径却会消失?

在幻灯片过渡时使用 \setbeamercovered{transparent},tikz 节点文本会淡出,但路径却会消失?

我希望路径在被覆盖时与文字一起出现在幻灯片上。Beamer 似乎没有这样做。有办法改变这种情况吗?

\setbeamercovered{transparent}

\begin{frame}
\begin{figure}[h]

\begin{tikzpicture}[box/.style={draw,rectangle}]
\onslide<1>{
\node (Mary) at (0,0) {Mary};
}
\node<2> (Suzy) at (4,0) {Suzy};

\node (John) at (2,0) {John};

\path<1>  [draw, ->, line width=1pt, color=red] (Mary) edge (John);

\path<2>  [draw, ->, line width=1pt, color=red] (Suzy) edge (John);


\end{tikzpicture}
\end{figure}
\end{frame}

答案1

你想要这样的东西吗?

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles}
\begin{document}
\setbeamercovered{transparent}
\begin{frame}
\begin{figure}[h]

\begin{tikzpicture}[box/.style={draw,rectangle}]
\node[alt=<2>{opacity=0.2}] (Mary) at (0,0) {Mary};
\node[alt=<1>{opacity=0.2}] (Suzy) at (4,0) {Suzy};

\node (John) at (2,0) {John};

\path[draw, ->, line width=1pt, color=red,alt=<2>{opacity=0.2}] (Mary) edge (John);

\path[draw, ->, line width=1pt, color=red,alt=<1>{opacity=0.2}] (Suzy) edge (John);


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

在此处输入图片描述

答案2

根据@marmot 的回答,我发现通过将我之前的版本与他的版本相结合,我可以同时拥有“覆盖”和“出现”的内容。这样,在下面的三个框架的示例中,我让 Suzy 的台词仅在 Mary 的台词消失后才出现。

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles}
\begin{document}
\setbeamercovered{transparent}
\begin{frame}
\begin{figure}[h]

\begin{tikzpicture}[box/.style={draw,rectangle}]
\node (Mary) at (0,0) {Mary};
\node (Suzy) at (4,0) {Suzy};

\node (John) at (2,0) {John};

\path[draw, ->, line width=1pt, color=red,alt=<2-3>{opacity=0.2}] (Mary) edge (John);

\path[draw, ->, line width=1pt, color=red,]<3> (Suzy) edge (John);

\end{tikzpicture}
\end{figure}
\end{frame}

\end{document}

相关内容