如何为每张幻灯片中的每个项目着色,并在其他幻灯片上恢复为黑色?

如何为每张幻灯片中的每个项目着色,并在其他幻灯片上恢复为黑色?

我想用颜色突出显示每张幻灯片中的每个项目,以便它看起来是动画。也就是说,我在标签 A 下有两个项目。

在此处输入图片描述

现在我想在幻灯片 2 上用红色突出显示第一个项目。但是尽管\onlide<3->MWE 中提供了该项目,但它却在第一项下方重复(如下图所示)。

在此处输入图片描述

我希望第二个重复项不可见,并且第一个项应恢复为黑色,并且第二个项(“Ut enim ...”)应在幻灯片 3 上显示为红色。但是第二个项再次重复。如何为每张幻灯片中的每个项目着色,并在其他幻灯片上恢复为黑色?

平均能量损失

\documentclass{beamer}
\usetheme{metropolis}
\setbeamercovered{transparent}
\usepackage{ragged2e}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{frame}[fragile]
\frametitle{Intro}
  \begin{tikzpicture}[
    bigcircle/.style={ % style for the circles
    text width=1.6cm, % diameter
    align=center, % center align
    line width=2mm, % thickness of border
    draw, % draw the border
    circle, % shape
    font=\sffamily\normal % font of the year
    },
    desc/.style 2 args={ % style for the list nodes
    % this style takes two mandatory arguments, as indicated by "2 args", so is used as
    % desc={first arg}{second arc}
    % the first arg is the color of the title/heading, the second is the title itself
    text width=5cm, % means the node will be kind of like a 4cm wide minipage, and if the
                  % text in the node becomes wider than that, it will wrap to the next line
    font=\sffamily\fontsize{6.5}{7}\selectfont\RaggedRight, % set the font in the list
    label={[#1,yshift=-1.5ex,font=\sffamily\normal]above:#2} % add the title as a label
    },
    node distance=10mm and 1mm % vertical and horizontal separation of nodes, when positioned with e.g. above=of othernode
    ]
    \onslide<1->
    {
      \node [bigcircle,red] (circ1) {A};
      \node [desc={red}{A},below=of circ1] (list1) {
      \begin{itemize}
        \setlength\itemsep{4pt} % reduce space between items in list
        \only<2> {\item \color{red}{Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
        \onslide<3-> {\item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}
        \only<3> {\item \color{red}{Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}}
        \onslide<4-> {\item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}
      \end{itemize}
      };
    }
    \onslide<5->
    {     
      \node [bigcircle,orange,right=of list1] (circ2) {B};
      \node [desc={orange}{B},above=of circ2] (list2) {
      \begin{itemize}
        \setlength\itemsep{4pt}
        \only<6> {\item \color{orange}{Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.}}
        \onslide<7-> {\item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.}
        \only<7> {\item \color{orange}{\item  Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}}
        \onslide<8-> {\item  Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}}
      \end{itemize}
      };
    }
    % draw the line between circles
    \onslide<5->
    { 
      \draw [dashed,black!80] (circ1) -- (circ2);
    }
  \end{tikzpicture}
\end{frame}
\end{document}

答案1

在我看来,你可能正在寻找。如果你也alert想制作动画,我推荐这个库。tikzpictureoverlay-beamer-styles

\documentclass{beamer}
\usetheme{metropolis}
\setbeamercovered{transparent}
\usepackage{ragged2e}
\usepackage{tikz}
\usetikzlibrary{positioning}
\setbeamercolor{alerted text}{fg=red}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{Intro}
\centering
\begin{tikzpicture}[
    bigcircle/.style={ % style for the circles
    text width=1.6cm, % diameter
    align=center, % center align
    line width=2mm, % thickness of border
    draw, % draw the border
    circle, % shape
    font=\sffamily\normalsize % font of the year
    }]
      \node [bigcircle,red] (circ1) {A};
\end{tikzpicture}
\begin{itemize}[<+-| alert@+>]
 \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
  tempor incididunt ut labore et dolore magna aliqua.
 \item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
  ut aliquip ex ea commodo consequat. 
\end{itemize}
\end{frame}
\end{document}

在此处输入图片描述

相关内容