![animate / TikZ: foreach 결과를 애니메이션 PDF로 변환하는 방법](https://rvso.com/image/400383/animate%20%2F%20TikZ%3A%20foreach%20%EA%B2%B0%EA%B3%BC%EB%A5%BC%20%EC%95%A0%EB%8B%88%EB%A9%94%EC%9D%B4%EC%85%98%20PDF%EB%A1%9C%20%EB%B3%80%ED%99%98%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95.png)
좌표 목록에서 곡선을 그리고 6개의 독립형 페이지를 얻습니다.
animate-package를 사용하여 PDF에 애니메이션 그림으로 표시하는 간단한 방법이 있습니까?
\documentclass[margin=5pt, tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{intersections}
\usepackage{amsmath, amssymb}
\begin{document}
\newcommand{\List}{}% reserve name
\let\List=\empty% create list
\def\Range{0,30,60,90,120,360}
\foreach \w in \Range{%%%%%%%%%%%%%%%
\pgfmathsetmacro\Winkel{\w} %
\begin{tikzpicture}[]
\coordinate[] (M) at (0,0);
\draw[] (M) circle[radius=3];
\draw[name path=kreis] (M) circle[radius=1.4];
\draw[name path=zeiger] (M) -- (90-\Winkel:3);
% Create List of Coordinates
\makeatletter
\path[name intersections={of=kreis and zeiger, name=S}] ;
\coordinate[label=left:$S_{\w}$] (S-\w) at (S-1);
\pgfmathsetmacro\temp{"(S-\w)"}%
\ifx\empty\List{} \xdef\List{\temp}%
\else \xdef\List{\List \temp}%
\fi
\makeatother
\draw[red] plot[mark=*] coordinates{\List};
\node[anchor=north west, text width=6 cm] at (-3,-3){List: \List};
\end{tikzpicture}
}%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
답변1
@AndéC의 팁을 통해 저는
% sub.tex
\documentclass[margin=5pt, tikz]{standalone}
\usepackage{animate}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{intersections}
\usepackage{amsmath, amssymb}
\begin{document}
\newcommand{\List}{}% reserve name
\let\List=\empty% create list
\def\Range{0,30,60,90,120,360}
\foreach \w in \Range{%%%%%%%%%%%%%%%
\pgfmathsetmacro\Winkel{\w} %
\begin{tikzpicture}[]
\useasboundingbox (-4,-4) rectangle (4,4);
\coordinate[] (M) at (0,0);
\draw[] (M) circle[radius=3];
\draw[name path=kreis] (M) circle[radius=1.4];
\draw[name path=zeiger] (M) -- (90-\Winkel:3);
% Create List of Coordinates
\makeatletter
\path[name intersections={of=kreis and zeiger, name=S}] ;
\coordinate[label=left:$S_{\w}$] (S-\w) at (S-1);
\pgfmathsetmacro\temp{"(S-\w)"}%
\ifx\empty\List{} \xdef\List{\temp}%
\else \xdef\List{\List \temp}%
\fi
\makeatother
\draw[red] plot[mark=*] coordinates{\List};
\node[anchor=north west, text width=6 cm] at (-3,-3){List: \List};
\end{tikzpicture}
}%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
% arara: pdflatex
% arara: pdflatex
% main.tex
\documentclass[tikz]{standalone}
\usepackage{animate}
\begin{document}
\animategraphics[autoplay,loop,controls]{1}{sub}{}{}
\end{document}