1

I want to put autoplay on vertices animation(a bit faster if possible) but not on edges animation. Plese, guide me for the same.

\begin{animateinline}{40}
\multiframe{200}{n=0+0.005}{
\begin{tikzpicture}
\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,4) [fill=red] circle (3pt);
\draw(11,4) [fill=red] circle (3pt);
\draw(7,0) [fill=red] circle (3pt);
\draw(11,0) [fill=red] circle (3pt) ;
\draw(8,1) [fill=red] circle (3pt);
\draw(8,3) [fill=red] circle (3pt);
\draw(10,1) [fill=red] circle (3pt);
\draw(10,3) [fill=red] circle (3pt);
\pgfmathsetmacro{\k}{(3*\n} % animates as long as \n is negative
\draw(7,4) [fill=blue] circle ({\k*1.35pt});
\draw(11,4) [fill=blue] circle ({\k*1.35pt});
\draw(7,0) [fill=blue] circle ({\k*1.35pt});
\draw(11,0) [fill=blue] circle ({\k*1.35pt}) ;
 \draw(8,1) [fill=blue] circle ({\k*1.35pt});
 \draw(8,3) [fill=blue] circle ({\k*1.35pt});
 \draw(10,1) [fill=blue] circle ({\k*1.35pt});
 \draw(10,3) [fill=blue] circle ({\k*1.35pt});
%\pgfmathsetmacro{\m}{\n} % <-animation will only start when \n is positive
\begin{scope}[fill opacity=4]
\filldraw[fill=blue,draw=blue,line width=1pt] (7,0)--(7+\n,0+3*\n);
\filldraw[fill=blue,draw=blue,line width=1pt] (7,0)--(7+3*\n, 0+\n);
\filldraw[fill=blue,draw=blue,line width=1pt] (7,4)--(7+\n, 4-3*\n);
\filldraw[fill=blue,draw=blue,line width=1pt] (7,4)--(7+3*\n, 4-\n);
\filldraw[fill=blue,draw=blue,line width=1pt] (11,4)--(11-3*\n, 4-\n);
\filldraw[fill=blue,draw=blue,line width=1pt] (11,4)--(11-\n, 4-3*\n); 
\filldraw[fill=blue,draw=blue,line width=1pt] (11,0)--(11-\n, 0+3*\n);
\filldraw[fill=blue,draw=blue,line width=1pt] (11,0)--(11-3*\n, 0+\n);
\end{scope}
\draw(7,0)node[red,left=2pt]{\Large $v_2'$};
\draw(7,4)node[red,left=2pt]{\Large $v_1'$};
\draw(11,0)node[red,right=2pt]{\Large $v_3'$};
\draw(11,4)node[red,right=2pt]{\Large $v_4'$};
\draw(8,1)node[red,left=2pt]{ $v_2$};
\draw(8,3)node[red,left=2pt]{ $v_1$};
\draw(10,1)node[red,right=2pt]{ $v_3$};
\draw(10,3)node[red,right=2pt]{ $v_4$};
\draw(9,0)node[below=7mm]{$D_2^*(C_4)$};
 \end{tikzpicture}}
 \end{animateinline}
3

Most of your question has already been addressed in ↗my answer to your previous question. The key is to use two \multiframe in order to divide the animation into two sections. Subsequent \multiframes must always be separated by a \newframe, but here we use the starred variant, \newframe*, in order to insert a pause in between. The animation continues on mouse click.

You can speed up the first animation section with the growing vertices by reducing the number of frames in this section (101-->51) and by increasing the increment (0.03pt-->0.06pt) at the same time.

(Acrobat Reader or Foxit required)

\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}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.