如何分段揭示投影仪框架上的单个图形?

如何分段揭示投影仪框架上的单个图形?

我想要一个投影仪框架,其中单个大图形排版在 处居中0.8\textwidth。困难在于我需要逐段地揭示它,即幻灯片 1 中的顶部 30%,幻灯片 2 中的下一个 60%,最后幻灯片 3 中的底部 10%(显示完整图形)。

请注意,将\only、等与/选项\uncover结合 使用会导致修剪部分重新居中,从而产生“摆动”效果。我只需要将图形固定/固定,然后逐张显示不同的水平部分。trimclip\includegraphics

这是一个最小的非工作示例:

\documentclass{beamer}
\usetheme{warsaw}

\begin{document}

\begin{frame}
\frametitle{my large figure}

\centering
\includegraphics{some_figure.pdf}  % ---> a suitable vector graphics pdf image can be substituted here
% How do I have 3 slides wherein the single large figure remains anchored in place while doing a piecewise reveal to the top 30%, additional 60%, and the bottom 10%?

\end{frame}

\end{document}

答案1

如果您将图形放置在 内的命名节点中tikzpicture,则可以使用白色矩形和命名图形节点的坐标覆盖图形的各个部分。在下面的示例中,矩形以红色绘制以方便说明,但draw=red通常会被省略。

\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{frame}
\frametitle{my large figure}
\centering
\begin{tikzpicture}
\node<1-4>[inner sep=0](mypic){\includegraphics[height=7cm]{example-image-a}};
\node[shape=coordinate](p1) at ($(mypic.north west)!0.3!(mypic.south west)$){};
\node[shape=coordinate](p2) at ($(mypic.north west)!0.9!(mypic.south west)$){};
\only<1>{\fill[white,draw=red] (p1) rectangle (mypic.north east);}
\only<1-2>{\fill[white,draw=red] (p2) rectangle (p1 -| mypic.north east);}
\only<1-3>{\fill[white,draw=red] (p2) rectangle (mypic.south east);}

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

在此处输入图片描述

相关内容