
나는 대답에서 다음 코드를 사용했습니다.이 질문, (루프 방법 사용)을 사용하여 동심 도형을 그립니다.
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{Spiro using loop}%rounded corners solution 1
\vskip -.6cm
\begin{tikzpicture}
\begin{scope}[scale=2]%transparency group,opacity=.4,
\draw[line width=.2cm,blue!80!black, fill=blue, looseness=1]
(0,-2.2) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-2.2) to [out=0,in=-120] ++ (0.2,0.1) to [out=60,in=-150] ++ (1.9,1.9) to [out=30,in=-90] ++ (0.1,0.2)} -- cycle;
\end{scope}
\begin{scope}[scale=2]
\draw[line width=.2cm,blue, fill=blue!80!white, looseness=1]
(0,-2) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-2) to [out=0,in=-120] ++ (0.2,0.1) to [out=60,in=-150] ++ (1.7,1.7) to [out=30,in=-90] ++ (0.1,0.2)} -- cycle;
\end{scope}
\begin{scope}[scale=2]
\draw[line width=.2cm,blue!80!white, fill=blue!70!white, looseness=1]
(0,-1.8) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-1.8) to [out=0,in=-120] ++ (0.2,0.1) to [out=60,in=-150] ++ (1.5,1.5) to [out=30,in=-90] ++ (0.1,0.2)} -- cycle;
\end{scope}
\begin{scope}[scale=2]
\draw[line width=.2cm,blue!70!white, fill=blue!60!white, looseness=1]
(0,-1.6) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-1.6) to [out=0,in=-120] ++ (0.2,0.1) to [out=60,in=-150] ++ (1.3,1.3) to [out=30,in=-90] ++ (0.1,0.2)} -- cycle;
\end{scope}
\begin{scope}[scale=2]
\draw[line width=.2cm,blue!60!white, fill=blue!50!white, looseness=1]
(0,-1.4) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-1.4) to [out=0,in=-120] ++ (0.2,0.1) to [out=60,in=-150] ++ (1.1,1.1) to [out=30,in=-90] ++ (0.1,0.2)} -- cycle;
\end{scope}
\begin{scope}[scale=2]
\draw[line width=.2cm,blue!50!white, fill=blue!40!white, looseness=1]
(0,-1.2) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-1.2) to [out=0,in=-120] ++ (0.2,0.1) to [out=60,in=-150] ++ (.9,.9) to [out=30,in=-90] ++ (0.1,0.2)} -- cycle;
\end{scope}
\begin{scope}[scale=2]
\draw[line width=.2cm,blue!40!white, fill=blue!30!white, looseness=1]
(0,-1.) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-1.) to [out=0,in=-120] ++ (0.2,0.1) to [out=60,in=-150] ++ (.7,.7) to [out=30,in=-90] ++ (0.1,0.2)} -- cycle;
\end{scope}
\begin{scope}[scale=2]
\draw[line width=.2cm,blue!30!white, fill=blue!20!white, looseness=1]
(0,-.8) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-.8) to [out=0,in=-120] ++ (0.2,0.1) to [out=60,in=-150] ++ (.5,.5) to [out=30,in=-90] ++ (0.1,0.2)} -- cycle;
\end{scope}
\begin{scope}[scale=2]
\draw[line width=.2cm,blue!20!white, fill=blue!10!white, looseness=1]
(0,-.6) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-.6) to [out=0,in=-120] ++ (0.2,0.1) to [out=60,in=-150] ++ (.3,.3) to [out=30,in=-90] ++ (0.1,0.2)} -- cycle;
\end{scope}
\begin{scope}[scale=2]
\draw[line width=.2cm,blue!10!white, fill=blue!0!white, looseness=1]
(0,-.4) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-.4) to [out=0,in=-120] ++ (0.2,0.1) to [out=60,in=-150] ++ (.1,.1) to [out=30,in=-90] ++ (0.1,0.2)} -- cycle;
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}
이 코드를 단순화하는 방법.
답변1
스케일을 통해서도 이 효과를 얻을 수 있습니다. 그것은 당신의 그림과 정확하게 일치하지 않지만, 효과적인 모서리의 호도 크기가 조정되어야 한다고 생각하기 때문에 그것은 의도적인 것입니다.
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{Spirifankerln}
\begin{tikzpicture}[pics/spiro/.style={code={
\draw[line width=.1cm,looseness=1,pic actions]
(0,-2) foreach \X in {0,90,180,270}
{[rotate=\X] -- (0,-2) to[out=0,in=-120] ++ (0.2,0.1) to[out=60,in=-150] ++ (1.7,1.7)
to[out=30,in=-90] ++ (0.1,0.2)} -- cycle;}}]
\foreach \X in {100,90,...,0}
{\pic[draw=blue!\X,fill=blue!\X,scale={1.8*(\X+10)/100}]{spiro};}
\end{tikzpicture}
\end{frame}
\end{document}
답변2
패턴을 찾고 중첩 루프를 사용하세요.
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{Spiro using loop}
\vskip -.6cm
\begin{tikzpicture}
\foreach \i in {0,.2,.4,...,1.8} {
\pgfmathsetmacro\firstcolor{scalar(100-\i*50)}
\pgfmathsetmacro\secondcolor{scalar(90-\i*50)}
\begin{scope}[scale=2]
\draw [
line width=.2cm,color/.expanded=blue!\firstcolor!white,
fill/.expanded=blue!\secondcolor!white, looseness=1
] (0,-2.2+\i) foreach \X in {0,90,180,270} {
[rotate=\X] -- (0,-2.2+\i) to [out=0,in=-120] ++ (0.2,0.1) to
[out=60,in=-150] ++ (1.9-\i,1.9-\i) to [out=30,in=-90] ++ (0.1,0.2)
} -- cycle;
\end{scope}
}
\end{tikzpicture}
\end{frame}
\end{document}