หลายเฟรมซ้อนกัน

Oct 20 2020

ฉันสงสัยว่าสิ่งต่อไปนี้เป็นไปได้หรือไม่ ฉันต้องการซ้อนสภาพแวดล้อมแบบ animateinline และ multiframe เพื่อจำลองการพึ่งพาเวลาของสัญญาณสำหรับพารามิเตอร์ต่างๆ อะไรแบบนั้น:

\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}

อย่างไรก็ตามดูเหมือนว่าการทำรังดังกล่าวเป็นไปไม่ได้และการไม่ใส่ข้อคิดเห็น 4 บรรทัดจากตัวอย่างทำให้เกิดข้อผิดพลาด มีวิธีแก้ปัญหาในการนำเสนอสิ่งที่คล้ายกันหรือไม่?

คำตอบ

1 AlexG Oct 20 2020 at 18:43

การแบ่งภาพเคลื่อนไหวออกเป็นหลาย ๆ ส่วนสามารถทำได้เช่นนี้ ในตัวอย่างปัจจุบันทั้งสองส่วนจะคั่นด้วยการหยุดชั่วคราว ( \newframe*) คลิกเพื่อดำเนินการต่อ

\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}