I'm trying to have an animated tikz graph with floating point values. While I can use floating point values as parameters for the graph, I can't seem to find a way to do so for displayed equations. Below is a MWE using beamer. The green line is animated properly - but the parameter does not appear in simplified form. The blue line shows the parameter appearing the way I would like it to (as a simplified number) but it is not updated in the tikz picture, even though it is updated outside that picture.
\documentclass[12pt]{beamer}
\usepackage{animate}
\usepackage{fp}
\usepackage{tikz}
\begin{document}
\newcounter{step}
\setcounter{step}{1}
\newcommand{\scalevalues}{ %
\FPmul{\scaled}{\thestep}{0.1}
\FPtrunc{\scaled}{\scaled}{1}
}
\scalevalues
\scaled % will print 0.1 above picture
\begin{animateinline}[loop, poster = first, controls, palindrome]{10}
\whiledo{\thestep < 21}{
\begin{tikzpicture}
%\useasboundingbox (-1,-1) rectangle (5,5);
%
\draw[->] (-1,0) -- (5,0) node[anchor=west]{\color{gray}x};
\draw[->] (0,-1) -- (0,5) node[anchor=south]{\color{gray}y};
%
\draw[-, thick, blue] (\scaled,-1) -- (5,4) node[anchor=east]{$\scaled x $};
\draw[-, thick, green] (0.1*\thestep,-1) -- (2,3) node[anchor=east]{$0.1*\thestep x $};
\end{tikzpicture}
\stepcounter{step}
\scalevalues
\scaled % will print updated values below picture
\ifthenelse{\thestep < 21}{
\newframe
}{
\end{animateinline}\relax
}
}
\end{document}
