i'm trying to generate an animation using tikz.
The animation should show a fixed coordinate system placed at an arbitrary position (x,y) on the current page. Additionally a rotating line should be animated with the axis of rotation also placed at the position (x,y). i wrote the following code
\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}
\usepackage{ifthen}
\begin{document}
\begin{frame}
\begin{tikzpicture}[remember picture, overlay, shift={(current page.center)}]
%draw coordinate system at the center of current page
\draw[thick, color=black, -latex] (-3,0) -- (3,0) node[right]{$x$};
\draw[thick, color=black, -latex] (0,-3) -- (0,3) node[above]{$y$};
\end{tikzpicture}
\begin{animateinline}[poster=first,controls]{8}%
% draw rotating line
\multiframe{11}{rt=0+0.1,icount=1+1}{%
\begin{tikzpicture}[scale=.75]
\ifthenelse{\icount > 0}%
{\draw[thick, color=red!50] ({0},{0}) -- ({cos(\rt)*5}, {sin(\rt)*5});}{}
\end{tikzpicture}%
}
\end{animateinline}
\end{frame}
\end{document}
The animation doesn't do what i wish.
- How do i shift the axis of rotation to position (x,y)?
shift={(current page.center)}
somehow doesn't work with animateinline
- The line doesn't rotate as i wish (starting from a horizontal position and rotating counterclockwise)?
I'm grateful for any help!
PS: Does anyone know a way to hold the lines which are drawn on the previous frames such that on the first frame, there will only be one line, on the second frame there would be the line from the first frame plus the new drawn line and for the following frames respectively?