# Animating TikZ without beamer

I have the following code:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{frame}
\begin{tikzpicture}
\fill[white] (1,1) circle (2pt);
\foreach \n in {1,2,...,10}{
\pgfmathsetmacro{\ang}{(10-\n)*90/10}
\draw<\n>[thick,dashed,->] (1,0) node[below]{%
Rotating by $90^\circ$%
} arc (0:\ang:1);
}
\end{tikzpicture}
\end{frame}

\end{document}


Which yields a nice(?) animation of a growing arrow. Now, I want to generate one PDF file where each page contains one cropped slide - as if I was using standalone. Cropped means for me that it will contain only the result of the tikz environment, and nothing else (not even border or something like that).

I tried to use standalone with the multi=true but then it doesn't crop the page, and I don't know how to generate a loop there...

What is the best way to do it?

-

E. g., by means of the preview package.

Instead of placing an invisible dot at the top edge you could use something like

%\fill[white] (1,1) circle (2pt);
\useasboundingbox (-0.25,-0.45) rectangle (2.2,1.05);


to fine-tune the picture bounding box.

\documentclass{article}

\usepackage[active,tightpage]{preview}
\usepackage{tikz}
\usetikzlibrary{calc}

\PreviewEnvironment{tikzpicture}

\begin{document}

\foreach \n in {1,2,...,10}{%
\begin{tikzpicture}
\fill[white] (1,1) circle (2pt);
\pgfmathsetmacro{\ang}{(10-\n)*90/10}
\draw[thick,dashed,->] (1,0) node[below]{%
Rotating by $90^\circ$%
} arc (0:\ang:1);
\end{tikzpicture}%
}

\end{document}

-

The standalone class does understand the option tikz.

## Code

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\begin{document}
\foreach \n in {1,2,...,10}{
\begin{tikzpicture}
\fill[white] (1,1) circle (2pt);
\pgfmathsetmacro{\ang}{(10-\n)*90/10}
\draw [thick,dashed,->] (1,0) node[below]{%
Rotating by $90^\circ$%
} arc (0:\ang:1);
\end{tikzpicture}
}
\end{document}


-