有几种方法可以在 beamer 中用彩色背景突出显示一行文本,例如使用framed
或mdframed
。
如何为该突出显示添加动画,即从左到右填充背景颜色?(您可以根据需要使用任何包。)
场景:您首先列出几点,然后(例如,在之后\pause
)通过(逐步)突出显示其中一点来强调它。
\documentclass{beamer}
\usepackage{framed, color}
\usepackage{mdframed}
\definecolor{shadecolor}{rgb}{1.0, 0.0, 0.0}
\begin{document}
\begin{frame}
\begin{shaded}
A piece of shaded text with red background for highlight.
\end{shaded}
\begin{mdframed}[backgroundcolor = yellow]
A piece of mdframed text with yellow background for highlight.
\end{mdframed}
\end{frame}
\end{document}
答案1
基于 的版本animate
:
\documentclass{beamer}
\usepackage{color}
\usepackage{calc}
\usepackage{animate}
\begin{document}
\begin{frame}
\begin{itemize}
\item on first
\item<2-> on second
\alt<3>{\item
\begin{animateinline}[autoplay]{24}
\multiframe{26}{n=0.0+0.04}{
\makebox[\widthof{\colorbox{yellow}{on third we see something magical}}][l]{%
\colorbox{yellow}{\makebox[\n\width][l]{on third we see something magical}}%
}
}
\end{animateinline}
}{\item<4->
\colorbox{yellow}{on third we see something magical}
}
\item<4-> on fourth
\end{itemize}
\end{frame}
\end{document}
答案2
你可以用 tikz 创建这样的动画:
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\transduration{0}
\begin{tikzpicture}
\foreach \foreach \x in {0,0.01, ...,1}{
\fill<+>[red] (0,0) rectangle (\x*\textwidth,1);
}
\node[anchor=west] at (0.25,0.5) {A piece of text with red background for highlight.};
\end{tikzpicture}
\end{frame}
\end{document}