I have a circuit, I want to show how the current move in this circuit, i use this code:
\documentclass[tikz]{standalone}
\usepackage{tikz}
\usepackage{animate}
\usepackage{circuitikz}
\begin{document}
\begin{animateinline}[auto play]{1}
\multiframe{2}{i=0+0.2}{
\begin{circuitikz}
\draw (0,0)
to[V,v=$U_q$] (0,2) % The voltage source
to[short] (2,2)
to[R=$R_1$] (2,0) % The resistor
to[short] (0,0);
\draw (2,2)
to[short] (4,2)
to[R=$R_2$] (4,0)
to[short] (2,0);
\draw (0,0)
to[thick,color=red, -*] (0,\i) % The voltage source
to[thick,color=red, -*] (\i,2)
to[thick,color=red, -*] (2,{2-\i}) % The resistor
to[thick,color=red, -*] ({2-\i},0);
\draw (2,2)
to[thick,color=red, -*] ({2+\i},2)
to[thick,color=red, -*] ({2+\i},0)
to[thick,color=red, -*] ({4-\i},0);
\end{circuitikz}}
\end{animateinline}
\end{document}
in this animations I will explain the Ohm's law, and show how the current move in the conductor and slow down through a resistor
Update I modified the code, that work well, but i need to show how the current slow down through a resistor, can anyone help me to complete this code?
\documentclass[border=30pt, tikz]{standalone}
\usepackage{tikz,tikz-3dplot}
\usepackage{xparse}
\usepackage{animate, calc}%%%%%%%%%%%%
\usepackage{animate}
\usepackage{circuitikz}
\ExplSyntaxOn
\NewDocumentCommand { \xifnum } { }
{
\fp_compare:nTF
}
\ExplSyntaxOff
\begin{document}
\foreach \x in {0.1,0.2,...,4}{
\begin{tikzpicture}
\begin{circuitikz}
\draw (0,0)
to[V,v=$U_q$] (0,2) % The voltage source
to[short] (2,2)
to[R=$R_1$] (2,0) % The resistor
to[short] (0,0);
\draw (2,2)
to[short] (4,2)
to[R=$R_2$] (4,0)
to[short] (2,0);
\xifnum{\x<2}{\fill[color=red] (0,\x) circle (3pt);}{\fill[color=red] ({\x-2},2) circle (3pt);}
\end{circuitikz}
\end{tikzpicture}
}
\end{document}

See the xkeyval package documentation for explanation. Type H for immediate help.
...
l.8 \begin{animateinline}[auto play]{1}`.