如何使用 LaTeX 创建动画流程图?

如何使用 LaTeX 创建动画流程图?

我需要绘制一个简单的动画流程图,描述从每个节点到节点的流程。

在此处输入图片描述

在画面的时间范围内,表示动画的流动方式。

答案1

这只是注释。如果您有某种流程图,可以在那里添加这个流动框架。您可能想使用参数来使其更花哨/吸引人,但这说明了这是如何工作的。

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\newcount\ww
\begin{frame}[t]
\frametitle{An animated dash pattern}
\animate<2-49>
\animatevalue<1-50>{\ww}{1}{50}
\begin{tikzpicture}
 \pgfmathsetmacro{\mydash}{\ww/25}
 \draw[dash pattern=on 0.001pt off \mydash pt on 2pt] (0,0) rectangle (4,3);
\end{tikzpicture}    
\end{frame}
\end{document}

在此处输入图片描述

当然,你也可以制作动画dash phase

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{chains,fit,positioning,shapes.geometric}
\begin{document}
\newcount\ww
\begin{frame}[t]
\frametitle{An animated dash pattern}
\animate<2-19> % <-increase 19 to make the animation last longer
\animatevalue<1-20>{\ww}{1}{20} % <- 210 is 19+1, so increase
\transduration<1-20>{0.4}% <- 20 is 19+1, so increase; controls the speed
\begin{tikzpicture}
 \begin{scope}[local bounding box=N,nodes=draw,>=stealth]
  \begin{scope}[start chain=going below,nodes={on chain,join,draw},
  every join/.style={->},node distance=4mm]
   \node[ellipse,alias=N0] {Start};
   \node[alias=N1] {Wurzelbrumpf};
   \node[alias=OCM] {OCM};
   \node[alias=O2] {O2};
   \node[alias=N3] {Output};
   \node[alias=N4] {Stop};
  \end{scope}
  \node[left=of O2] (O1) {O1};
  \node[right=of O2] (O3) {O3};
  \draw[->] (OCM) -- (O1);
  \draw[->] (OCM) -- (O3);
  \pgfmathsetmacro{\mydashphase}{\ww/5} 
  \node[fit=(OCM) (O1) (O3),inner sep=1ex,
    dash=on 2.0pt off 2.0pt phase \mydashphase pt](N2){};
 \end{scope}
 \path foreach \X in {0,...,4}
 {(N\X-|N.west) node[left]{$t=\ifnum\X=0
 0
 \else
 t+\X
 \fi$}};
\end{tikzpicture}    
\end{frame}
\end{document}

在此处输入图片描述

这里的速度由转换为 gif 来控制,在您的 beamer 动画中,您需要进入全屏模式,使用 acroread,然后您可以设置\transduration来控制速度。

相关内容