0

I have done animations on vertices and edges in the following graphs. I want to do loop animation in the vertex(Continuously) then after I want to do edge animation which should not be a loop and the vertex loop animation should continue during edge animation.

\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}
  • It would be great if you could give credit to @AlexG for this code. – user121799 Mar 16 '18 at 12:43
  • Yes sir. I apologize for this – kalpeshmpopat Mar 16 '18 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.