This is a possible solution where animationinline
is used from animate
package. Please copy and paste, then compile to see the animation. Basically, one wraps the tikzpicture
in an animationinline
environment as shown below. Here controls
means push bottoms are shown while autoplay
won't have push bottoms. {10} means frames per section. imedeg
is an integer variable; for real variables one uses rxxx
for example. 0+1 means start counting from 0, 1, 2,... while 1+1 means start counting from 1,2,3,...
\begin{animateinline}[poster=first,controls]{10}
\multiframe{9}{imdeg=0+1}
{
tikzpicture environment where \imdeg is the counter
}
\end{animationinline}
Addendum: a second method is addressed.
\multido{\imdeg=0+1}{9}
{
\begin{preview}
tikzpicture environment where \imdeg is the counter
\end{preview}
}


Code
\documentclass[border=10pt]{standalone}
\usepackage{animate}
\usepackage{tikz}
\begin{document}
\begin{animateinline}[poster=first,controls]{10}
\multiframe{9}{imdeg=0+1}
%\foreach \hdeg / \mdeg in {0/0,2/30,4/60,6/90,8/120,10/150,12/180,14/210,16/240}
{ % pontos do mínimo ao máximo de rotação
\begin{tikzpicture}[line cap=round,line width=3pt]
\filldraw [fill=white!30] (0,0) circle (2cm); % cor e tamanho do círculo
\foreach \angle / \label in
{0/140, 30/120, 60/100, 90/80, 120/60, 150/40, 180/20,
210/0, 330/160} % Kilômetros
{
\draw[line width=2pt] (\angle:1.7cm) -- (\angle:2cm); % grossura e ângulo dos tracinhos dos KM's
\draw (\angle:1.4cm) node{\textsf{\label}};
}
\foreach \angle / \label in
{15/, 45/, 75/, 105/, 135/, 165/, 195/,345/, 270/SENAC-SP} % traços dos KM's sem número
{\draw[line width=1pt] (\angle:1.8cm) -- (\angle:2cm);
\draw (\angle:1.4cm) node{\textsf{\label}};
}
\foreach \angle in {0,90,180,270}
\draw[line width=2pt] (\angle:2cm) -- (\angle:2cm);
\node[draw=none,font=\tiny,text=red] at (0,0.3cm) {Velocimetro PI - 1}; %texto
\draw[rotate=210,line width=1.5pt] (0,0) -- (-\imdeg*30:1cm); % ponteiro%%%
\path [fill=red] (0,0) circle (3pt); % borda do círculo do ponteiro
\path [fill=white] (0,0) circle (2pt); % círculo do ponteiro
\end{tikzpicture}
}
\end{animateinline}
\end{document}
Addendum: A second approach is use of multido
package with preview
.
Code:
\documentclass{standalone}%[border=10pt]{standalone}
\usepackage{animate}
\usepackage{tikz}
\usepackage{multido}
\usepackage[active,tightpage]{preview}
\begin{document}
\multido{\imdeg=0+1}{9}
%\foreach \hdeg / \mdeg in {0/0,2/30,4/60,6/90,8/120,10/150,12/180,14/210,16/240}
{ % pontos do mínimo ao máximo de rotação
\begin{preview}
\begin{tikzpicture}[line cap=round,line width=3pt]
\filldraw [fill=white!30] (0,0) circle (2cm); % cor e tamanho do círculo
\foreach \angle / \label in
{0/140, 30/120, 60/100, 90/80, 120/60, 150/40, 180/20,
210/0, 330/160} % Kilômetros
{
\draw[line width=2pt] (\angle:1.7cm) -- (\angle:2cm); % grossura e ângulo dos tracinhos dos KM's
\draw (\angle:1.4cm) node{\textsf{\label}};
}
\foreach \angle / \label in
{15/, 45/, 75/, 105/, 135/, 165/, 195/,345/, 270/SENAC-SP} % traços dos KM's sem número
{\draw[line width=1pt] (\angle:1.8cm) -- (\angle:2cm);
\draw (\angle:1.4cm) node{\textsf{\label}};
}
\foreach \angle in {0,90,180,270}
\draw[line width=2pt] (\angle:2cm) -- (\angle:2cm);
\node[draw=none,font=\tiny,text=red] at (0,0.3cm) {Velocimetro PI - 1}; %texto
\draw[rotate=210,line width=1.5pt] (0,0) -- (-{\imdeg*30}:1cm); % ponteiro%%%
\path [fill=red] (0,0) circle (3pt); % borda do círculo do ponteiro
\path [fill=white] (0,0) circle (2pt); % círculo do ponteiro
\end{tikzpicture}
\end{preview}
}
\end{document}