aninhando multiframe

Oct 20 2020

Eu me pergunto se o seguinte é possível. Gostaria de aninhar ambientes animateinline e multiframe para simular a dependência de tempo de um sinal para diferentes parâmetros. Algo parecido:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{animate}

\begin{document}
   \centering
%\begin{animateinline}[poster=first, label=graph_switch,controls=step]{2}
 %     \multiframe{20}{rt=0+5}{%
 \def\rs{1}
\begin{animateinline}[poster=first, label=graph_switch, autoplay]{5}
    \multiframe{15}{rt=0+5}{%
        \begin{tikzpicture}
        %draw coordinate axis
        \draw[thick, color=black, -latex] (-4.05,0) -- (4.05,0) node[right]{$y$};              
        \draw[thick, color=black, -latex] (0,-1.4) -- (0,1.4) node[above]{$t$};
         \draw[scale=1, domain=-4:4, smooth, variable=\t, blue] plot ({\t}, {\rs*sin(100*\t+\rt)});
        \node at (5,5) {};
        \node at (-5,-5) {}; 
        \end{tikzpicture}
    }%
\end{animateinline}
% }%
% \end{animateinline}
 \end{document}

Parece, entretanto, que tal aninhamento é impossível e descomentar as 4 linhas do exemplo traz um erro. Existe alguma solução alternativa para apresentar algo semelhante?

Respostas

1 AlexG Oct 20 2020 at 18:43

Dividir uma animação em várias seções pode ser feito assim. No presente exemplo, as duas seções são separadas por uma pausa ( \newframe*). Clique para continuar.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{animate}

\begin{document}
\begin{animateinline}[poster=first, label=graph_switch, autoplay]{5}
  \multiframe{15}{rt=0+5}{%
    \def\rs{1}%
    \begin{tikzpicture}
    %draw coordinate axis
    \draw[thick, color=black, -latex] (-4.05,0) -- (4.05,0) node[right]{$y$};              
    \draw[thick, color=black, -latex] (0,-1.4) -- (0,1.4) node[above]{$t$};
      \draw[scale=1, domain=-4:4, smooth, variable=\t, blue] plot ({\t}, {\rs*sin(100*\t+\rt)});
      \node [anchor=north east] at (4,2) {$A=1$};
%    \node at (5,5) {};
%    \node at (-5,-5) {}; 
    \end{tikzpicture}
  }%
  \newframe*
  \multiframe{15}{rt=0+5}{%
    \def\rs{0.5}%
    \begin{tikzpicture}
    %draw coordinate axis
    \draw[thick, color=black, -latex] (-4.05,0) -- (4.05,0) node[right]{$y$};              
    \draw[thick, color=black, -latex] (0,-1.4) -- (0,1.4) node[above]{$t$};
      \draw[scale=1, domain=-4:4, smooth, variable=\t, blue] plot ({\t}, {\rs*sin(100*\t+\rt)});
      \node [anchor=north east] at (4,2) {$A=0.5$};
%    \node at (5,5) {};
%    \node at (-5,-5) {}; 
    \end{tikzpicture}
  }%
\end{animateinline}
\end{document}