如何在 Beamer 中包含外部动画(使用动画)

如何在 Beamer 中包含外部动画(使用动画)

我使用 animate 包制作了一个动画,我想将其集成到 Beamer 演示文稿中,但我只得到了一个空白页。您能告诉我如何将外部动画集成到 Beamer 演示文稿中吗?

这里有两个文件需要测试,首先编译animation.tex ====Animation.tex===

\documentclass{standalone}
\usepackage{animate}
\usepackage{tikz}
\usetikzlibrary{lindenmayersystems}
\pgfdeclarelindenmayersystem{A}{%
  \symbol{F}{\pgflsystemstep=0.6\pgflsystemstep\pgflsystemdrawforward}
  \rule{A->F[+A][-A]}
}

\begin{document}
\begin{animateinline}[controls,autoplay,loop]{2}
\multiframe{8}{n=1+1}{
  \begin{tikzpicture}[scale=10,rotate=90]
    \draw (-.1,-.2) rectangle (.4,0.2);
    \draw [blue,opacity=0.5,line width=0.1cm,line cap=round]
      l-system [l-system={A,axiom=A,order=\n,angle=45,step=0.25cm}];
  \end{tikzpicture}    
}
\end{animateinline}
\end{document}

=======

Beamer 文件

=======

\documentclass{beamer}

\begin{document}
\begin{frame}
first frame
\end{frame}
\begin{frame}
animation
\includegraphics{animation.pdf}
\end{frame}
\begin{frame}
last frame
\end{frame}
\end{document}

========

答案1

用 制作的动画animate基于 PDF 注释,非常类似于超链接。如果使用常规方法(\includepdf\includegraphics)从外部 PDF 文档嵌入这些交互元素,它们就会丢失。

因此,需要采用不同的程序:


  1. 使用动画帧构建多页 PDF(animation.tex):

\documentclass[class=beamer,tikz]{standalone}

\usepackage{tikz}
\usetikzlibrary{lindenmayersystems}
\pgfdeclarelindenmayersystem{A}{%
  \symbol{F}{\pgflsystemstep=0.6\pgflsystemstep\pgflsystemdrawforward}
  \rule{A->F[+A][-A]}
}

\usepackage{multido}

\begin{document}
\multido{\n=1+1}{8}{%
  \begin{tikzpicture}[scale=10,rotate=90]
    \draw (-.1,-.2) rectangle (.4,0.2);
    \draw [blue,opacity=0.5,line width=0.1cm,line cap=round]
      l-system [l-system={A,axiom=A,order=\n,angle=45,step=0.25cm}];
  \end{tikzpicture}%    
}
\end{document}

  1. 在目标文档中构建动画,使用\animategraphics

\documentclass{beamer}
\usepackage{animate}

\begin{document}

\begin{frame}{first frame}
\end{frame}

\begin{frame}{animation}
  \animategraphics[controls,autoplay,loop]{2}{animation}{}{}
\end{frame}

\begin{frame}{last frame}
\end{frame}

\end{document}

相关内容