animate를 사용하여 애니메이션 프레임 만들기

animate를 사용하여 애니메이션 프레임 만들기

프레임을 생성하는 이 코드가 있고 \begin{animateinline}을 사용하여 애니메이션을 적용하고 싶기 때문에 먼저 다음을 시도하여 \foreach를 제거하고 두 번째로 코드를 다음과 같이 수정했습니다.

  \newcounter{theangle}
    \setcounter{theangle}{0}
    \begin{animateinline}[loop, poster = first,controls]{40}
    %
    \whiledo{\angle<359}{
     
     \begin{tikzpicture}
        \def\angle{45};
        \fill[fill=red] (0,0) -- plot [domain=0:pi/180*\angle] (\x,{sin(\x r)}) -- (pi/180*\angle,0) -- cycle;
    \end{tikzpicture}
    \begin{tikzpicture}
        %\fill[blue!50] (-1,0) arc (0:\angle:1) -- (-2,0) -- cycle;
        %\fill[blue!50] plot[smooth,domain=0:\angle] (pi/180*\x,{sin(\x)}) |- (0,0);
        \def\radangle{pi/180*\angle};

        \fill[blue!50] (-1,0) arc (0:\angle:1) -- (-2,0) -- cycle;
        %\fill[fill=red] (0,0) -- plot [domain=0:\radangle] (\x,{sin(\x r)}) -- (\radangle,0) -- cycle;
        
        \draw (-2,0) +(\angle:1) circle (2pt) -- (pi/180*\angle,{sin(\angle)}) circle (2pt);
        \draw (-3.5,0) -- (7,0);
        \foreach \deg in {90, 180, 270, 360}
            \draw (pi/180*\deg,2pt) -- (pi/180*\deg,-2pt) node[below] {$\deg^\circ$};
        \draw (0,-1.2) -- (0,1.2);
        \foreach \y in {-1,-0.5,0.5,1}
        \draw (2pt,\y) -- (-2pt,\y) node[left] {$\y$};
        \draw plot[smooth,domain=0:360] (pi/180*\x,{sin(\x)});
        \draw (-2,0) circle (1);
        \end{tikzpicture}
    \stepcounter{theangle}
    \ifthenelse{\theangle<359}{\newframe}{
            \end{animateinline}}
}

하지만 작동하지 않았습니다. 도움을 주시면 감사하겠습니다.

\documentclass[tikz]{standalone}
\usepackage{tikz}

\begin{document}

    \begin{tikzpicture}
        \def\angle{45};
        \fill[fill=red] (0,0) -- plot [domain=0:pi/180*\angle] (\x,{sin(\x r)}) -- (pi/180*\angle,0) -- cycle;
    \end{tikzpicture}

    \foreach \angle in {0,10,...,360}
    {
        \begin{tikzpicture}
        %\fill[blue!50] (-1,0) arc (0:\angle:1) -- (-2,0) -- cycle;
        %\fill[blue!50] plot[smooth,domain=0:\angle] (pi/180*\x,{sin(\x)}) |- (0,0);
        \def\radangle{pi/180*\angle};

        \fill[blue!50] (-1,0) arc (0:\angle:1) -- (-2,0) -- cycle;
        %\fill[fill=red] (0,0) -- plot [domain=0:\radangle] (\x,{sin(\x r)}) -- (\radangle,0) -- cycle;
        
        \draw (-2,0) +(\angle:1) circle (2pt) -- (pi/180*\angle,{sin(\angle)}) circle (2pt);
        \draw (-3.5,0) -- (7,0);
        \foreach \deg in {90, 180, 270, 360}
            \draw (pi/180*\deg,2pt) -- (pi/180*\deg,-2pt) node[below] {$\deg^\circ$};
        \draw (0,-1.2) -- (0,1.2);
        \foreach \y in {-1,-0.5,0.5,1}
        \draw (2pt,\y) -- (-2pt,\y) node[left] {$\y$};
        \draw plot[smooth,domain=0:360] (pi/180*\x,{sin(\x)});
        \draw (-2,0) circle (1);
        \end{tikzpicture}
    }

\end{document}

관련 정보