circuitikz vs. tikzpicture: generating multipage standalone documents for animations
If you say \documentclass[border = 5pt, tikz]{standalone}
this does not just load tikz
but also tells standalone
that it should produce single pdf pages for each tikzpicture
. In order to generate separate pdf pages for circuitikz you could do
\documentclass[border = 5pt, tikz]{standalone}
\usepackage{circuitikz}
\standaloneenv{circuitikz}
\begin{document}
\foreach \k in {1,...,10}
{
\begin{circuitikz}
\draw (0, 0) rectangle (2, 2);
\fill[red] (\k/5, 1) circle (0.1);
\end{circuitikz}
}
\end{document}
Note that this possibility is not unique. Another possibility is to use
\documentclass[border = 5pt, multi={circuitikz}]{standalone}
\usepackage{circuitikz}
\begin{document}
\foreach \k in {1,...,10}
{
\begin{circuitikz}
\draw (0, 0) rectangle (2, 2);
\fill[red] (\k/5, 1) circle (0.1);
\end{circuitikz}
}
\end{document}
instead. For further information, please consult the standalone
manual on p. 10.
The same as an animated SVG, using the animations
library of TikZ/Pgf-3.1:
Compile with
latex example dvisvgm --zoom=-1 example
example.tex
:
\documentclass[dvisvgm]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{animations}
\begin{document}
\begin{circuitikz}
\draw (0, 0) rectangle (2, 2);
\scoped [name=circle, animate = {
object=circle, :shift = { 0s = "{(1/5,1)}", 3s = "{(2,1)}", repeats }
}
] \fill[red] (0,0) circle (0.1);
\end{circuitikz}
\end{document}