![Beamer 覆盖和 Tikz 图层问题](https://linux22.com/image/369189/Beamer%20%E8%A6%86%E7%9B%96%E5%92%8C%20Tikz%20%E5%9B%BE%E5%B1%82%E9%97%AE%E9%A2%98.png)
这些角度应该出现在第二张幻灯片上,但是却没有。
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{angles}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\begin{document}
\begin{frame}
\hfill \begin{tikzpicture}
\onslide<+->{
\draw[scale=1.5,rotate=118] (0,0) coordinate (A)
--++(1,0) coordinate (B)
--++(120:2) coordinate (C)
--cycle ;
}
\onslide<+->{%
\begin{pgfonlayer}{background}
\draw pic[%
semithick,
fill=blue!25,
angle radius=.7cm
] {angle=A--C--B} ;
\draw pic[%
semithick,
fill=red!25,
angle radius=.7cm
] {angle=C--B--A} ;
\end{pgfonlayer}
}
\end{tikzpicture}\hfill\strut
\end{frame}
\end{document}
答案1
你也可以 \onslide
使用visible on
https://tex.stackexchange.com/a/55849/36296可通过 方便地获取\usetikzlibrary{overlay-beamer-styles}
。
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{angles}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\usetikzlibrary{overlay-beamer-styles}
\begin{document}
\begin{frame}
\hfill
\begin{tikzpicture}
\draw[scale=1.5,rotate=118] (0,0) coordinate (A)
--++(1,0) coordinate (B)
--++(120:2) coordinate (C)
--cycle ;
\begin{pgfonlayer}{background}
\draw pic[%
semithick,
fill=blue!25,
angle radius=.7cm,
visible on=<+(1)->
] {angle=A--C--B} ;
\draw pic[%
semithick,
fill=red!25,
angle radius=.7cm,
visible on=<+->
] {angle=C--B--A} ;
\end{pgfonlayer}
\end{tikzpicture}\hfill\strut
\end{frame}
\end{document}