1

Where is the missing endgroup in the next code ?

\documentclass[tikz,margin=5pt]{standalone}
\usepackage{calc,animate}

\newcommand{\Cercle}[1]{%
    \begin{tikzpicture}[thick]
    \draw[->,>=stealth] (-.4pt,0) -- (4.5,0) ;
    \foreach \i in {0,...,4} {
        \draw (\i,0) -- (\i,-3pt) node[below] {\i} ; }
    \pgfmathsetmacro\Angle{270-360*#1/3.14159}
    \draw[red] (-.4pt,0) -- (#1,0) arc (270:\Angle:.5);
    \end{tikzpicture}}

\begin{document}

\begin{animateinline}[controls,loop]{12}
  \multiframe{10}{nxb=0+.1}{\Cercle{\nxb}}
\end{animateinline}

\end{document}
2

Change

\documentclass[tikz,margin=5pt]{standalone}
\usepackage{calc,animate}

to

\documentclass[margin=5pt]{standalone}
\usepackage{tikz,calc,animate}

and your code will work again.

From standalone documentation:

For pictures drawn with TikZ a dedicated tikz option is provided which loads the tikz package and also configures the tikzpicture environment to create a single cropped page.

multiframe or animateinline have problem with this single cropped page for every tikzpicture.

I must admit that I've found it by chance but I knew that standalone works with animateinline.

enter image description here

enter image description here

enter image description here

  • @Tarass: The graph gets squeezed vertically while the animation progresses. A common bounding box is required for all frames of the sequence to avoid this. See the animate manual, page 8. – AlexG May 23 '14 at 6:33
1

Maybe the proposed solution does not answer the OP's question. Yet hours of study shows that the macro Cercle is correct. So this solution uses multido skill to tackle the problem and the report is shown below.

enter image description here enter image description here enter image description here enter image description here enter image description here

Code

\documentclass[tikz,margin=5pt]{standalone}
\usepackage{calc,animate,multido}
\usepackage[active,tightpage]{preview}
\newcommand{\Cercle}[1]{%
    \begin{tikzpicture}[thick]
    \draw[->,>=stealth] (-.4pt,0) -- (4.5,0) ;
    \foreach \i in {0,...,4} {
        \draw (\i,0) -- (\i,-3pt) node[below] {\i} ; }
    \pgfmathsetmacro{\Angle}{270-360*(#1)/3.14159}
    \draw[red] (-.4pt,0) -- (#1,0) arc (270:\Angle:.5);
    \end{tikzpicture}
}

\begin{document}
\multido{\rnxb=0+0.1}{40}{
\begin{preview}
\Cercle{\rnxb}
\end{preview}
}
\end{document}
  • Thank you for your answer, but it produces several pages in a pdf file. How to make an animation with controls with them. I know how make an animated gif. But I need the controls to show off. – Tarass May 23 '14 at 3:34
  • 1
    OK, Point to the image and move the wheel on the mouse. – Jesse May 23 '14 at 3:35
  • Thank you. One can avoid animate and multido packages and use foreach instead. I didn't know about preview package. – Tarass May 23 '14 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.