Controlsaligned e os controles não estão funcionando no tikz

Controlsaligned e os controles não estão funcionando no tikz

Estou tentando usar controlsalignede mostrar apenas os play,stop,stepbotões dos controladores. Aqui está o código que estou usando

 \documentclass[12pt]{article}
    \usepackage{tikz}
    \usepackage[utf8]{inputenc}
    \usepackage{xcolor}
    \definecolor{lava}{rgb}{0.81, 0.06, 0.13}
    \definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
    \usepackage{gensymb}
    \usetikzlibrary{shapes}
    \usepgflibrary{shapes.symbols}
    \usetikzlibrary{mindmap,trees,arrows,shapes.symbols,shapes.misc}
    \usepackage[ampersand]{easylist}
    \usepackage{lmodern}  
    \pagestyle{empty}
    \usetikzlibrary{decorations.markings}
    \usepackage{ifthen}
\usepackage{animate}  
   \newcounter{angle}
\setcounter{angle}{0}
\begin{document}
\begin{center}
  \begin{animateinline}[loop, poster = first,controls={[play,stop,speed]},controlsaligned=right+-4em]
\whiledo{\theangle<359}{
\vspace{-1em}
    \begin{tikzpicture}[scale=0.9]    
    % Axis
    \draw[thick,->,black] (-3,0)--(3,0) node[below] {$\Re$}; % x axis
    \draw[thick,->,black] (0,-3)--(0,3) node[left] {$\Im$}; % y axis
    \draw[black,thick] (0,0) circle (2.5cm);
    \node[black,below] at (2.6,0) {$V_m$};
    \node[black,above] at (0.1,-2.5) {$V_m$};
    %
    \draw[ultra thick,lava] (0,0) -- (0,0 |- \theangle:2.5cm); % UpOn x axis
    \draw[ultra thick,myblue] (0,0) -- (\theangle:2.5cm |- 0,0); % UpOn y axis
    %
    \draw[densely dotted,lava] (\theangle:2.5cm) -- (\theangle:2.5cm |- 0,0); % vertical line
    \draw[densely dotted,myblue] (\theangle:2.5cm) -- (0,0 |- \theangle:2.5cm); % horizontal line
    \draw[ultra thick,black,->,rotate=\theangle] (0,0) -- (2.5,0); 
    \node[red,myblue,right] at (0,-3.1) 
            {\footnotesize$\cos(\theangle^{\degree}) = \pgfmathcos{\theangle}\pgfmathresult$};
    \node[lava,lava,right] at (0,-3.5) 
            {\footnotesize$\sin(\theangle^{\degree}) = \pgfmathsin{\theangle}\pgfmathresult$};
    \end{tikzpicture}
    %
    \stepcounter{angle}
    \ifthenelse{\theangle<359}{
            \newframe
    }{
    
            \end{animateinline}
    }
}
\end{center}
\end{document}

O erro é

​! Número faltando, tratado como zero.

Responder1

Existem alguns erros sintáticos no código: The [e ]around play,stop,speedestão errados e o argumento framerate está faltando no animateinlineambiente.

Além disso, o código usa um \whiledoloop em torno de quadros parametrizados, o que é uma prática obsoleta. Use \multiframeem vez disso.

Para evitar que a animação em execução oscile, um nó invisível é colocado no tikzpicturepara empurrar um pouco a borda direita da caixa delimitadora. Isso garante que todos os quadros tenham o mesmo tamanho.

Observe que as dimensões negativas usadas controlsalignedfazem com que os controles se projetem para fora do widget de animação. Não tenho certeza se esta é sua intenção. (Eu o removi no código abaixo.)

\documentclass[12pt]{article}

\usepackage{tikz}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}  
\usepackage{lmodern}  
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
\usepackage{gensymb}
\pagestyle{empty}
\usepackage{animate}   
    
\begin{document}
\begin{center}
\begin{animateinline}[loop, poster = first,controls={play,stop,speed},controlsaligned=right]{30}
  \multiframe{360}{iAngle=0+1}{
    \begin{tikzpicture}[scale=0.9]
    \node at (3.9,0) {}; % push right bounding box border somewhat 
    % Axis
    \draw[thick,->] (-3,0) -- (3,0) node[right] {$\Re$}; % x axis
    \draw[thick,->] (0,-3)--(0,3) node[left] {$\Im$}; % y axis
    \draw[black,thick] (0,0) circle (2.5cm);
    \node[black,below] at (2.6,0) {$V_m$};
    \node[black,above] at (0.1,-2.5) {$V_m$};
    %
    \draw[ultra thick,lava] (0,0) -- (0,0 |- \iAngle:2.5cm); % UpOn x axis
    \draw[ultra thick,myblue] (0,0) -- (\iAngle:2.5cm |- 0,0); % UpOn y axis
    %
    \draw[densely dotted,lava] (\iAngle:2.5cm) -- (\iAngle:2.5cm |- 0,0); % vertical line
    \draw[densely dotted,myblue] (\iAngle:2.5cm) -- (0,0 |- \iAngle:2.5cm); % horizontal line
    \draw[ultra thick,black,->,rotate=\iAngle] (0,0) -- (2.5,0);
    \node[red,myblue,right] at (0,-3.1)
            {\footnotesize$\cos(\iAngle^{\degree}) = \pgfmathcos{\iAngle}\pgfmathresult$};
    \node[lava,lava,right] at (0,-3.5)
            {\footnotesize$\sin(\iAngle^{\degree}) = \pgfmathsin{\iAngle}\pgfmathresult$};
    \end{tikzpicture}
  }
\end{animateinline}
\end{center}
\end{document}

informação relacionada