我在下图中对顶点和边做了动画。我想在顶点做循环动画(连续),然后我想做边缘动画,但边缘动画不应该是循环,顶点循环动画应该在边缘动画期间继续。
\documentclass{article}
\usepackage[a6paper]{geometry}
\usepackage{tikz}
\usepackage{animate}
\newcommand\staticParts{%
\draw (7,0)[line width=1pt]--(11,0);
\draw (7,0)[line width=1pt]--(7,4);
\draw (7,4)[line width=1pt]--(11,4);
\draw (11,0)[line width=1pt]--(11,4);
\draw (7,0)[white,line width=1pt]--(8,1);
\draw (7,4)[white,line width=1pt]--(8,3);
\draw (11,0)[white,line width=1pt]--(10,1);
\draw (11,4)[white,line width=1pt]--(10,3);
\draw (8,1)[line width=1pt]--(8,3);
\draw (8,1)[line width=1pt]--(10,1);
\draw (10,1)[line width=1pt]--(10,3);
\draw (8,3)[line width=1pt]--(10,3);
\draw (7,0)[blue,line width=1pt]--(8,3);
\draw (7,0)[blue,line width=1pt]--(10,1);
\draw (7,4)[blue,line width=1pt]--(8,1);
\draw (7,4)[blue,line width=1pt]--(10,3);
\draw (11,4)[blue,line width=1pt]--(8,3);
\draw (11,4)[blue,line width=1pt]--(10,1);
\draw (11,0)[blue,line width=1pt]--(10,3);
\draw (11,0)[blue,line width=1pt]--(8,1);
\draw(7,0)node[left=2pt]{\Large $v_2'$};
\draw(7,4)node[left=2pt]{\Large $v_1'$};
\draw(11,0)node[right=2pt]{\Large $v_3'$};
\draw(11,4)node[right=2pt]{\Large $v_4'$};
\draw(8,1)node[left=2pt]{ $v_2$};
\draw(8,3)node[left=2pt]{ $v_1$};
\draw(10,1)node[right=2pt]{ $v_3$};
\draw(10,3)node[right=2pt]{ $v_4$};
\draw(9,0)node[below=7mm]{$D_2^*(C_4)$};}
\newcommand\vertices[1]{%
\draw(7,4) [fill=black] circle (#1);
\draw(11,4) [fill=black] circle (#1);
\draw(7,0) [fill=black] circle (#1);
\draw(11,0) [fill=black] circle (#1);
\draw(8,1) [fill=black] circle (#1);
\draw(8,3) [fill=black] circle (#1);
\draw(10,1) [fill=black] circle (#1);
\draw(10,3) [fill=black] circle (#1);}
\newcommand\edges[1]{%
\draw[draw=red,line width=1pt] (7,0)--(7+#1,0+#1);
\draw[draw=red,line width=1pt] (7,4)--(7+#1, 4-#1);
\draw[draw=red,line width=1pt] (11,0)--(11-#1, 0+#1);
\draw[draw=red,line width=1pt] (11,4)--(11-#1, 4-#1);}
\begin{document}
\begin{animateinline}[autoplay]{40}
\multiframe{51}{d=0pt+0.06pt}{ %d=0pt,0.06pt,...,3pt
\begin{tikzpicture}
\staticParts
\vertices{\d}
\end{tikzpicture}}
\newframe* %insert pause, click to continue
\multiframe{101}{n=0.0+0.01}{ %n=0,0.01,...,1.0
\begin{tikzpicture}
\staticParts
\edges{\n}
\vertices{3pt}
\end{tikzpicture}}
\end{animateinline}
\end{document}