我使用了以下代码来回答这个问题
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{Spirifankerln using scale}
\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)% node {1}
to[out=0,in=-90] ++ (0.2,0.1)% node {2}
to[out=90,in=-180] ++ (1.7,1.7)% node {3}
to[out=0,in=-90] ++ (0.1,0.2)% node[red] {4}
} -- cycle;}}]
\pic[draw=orange!100,fill=orange!40,scale=2, rotate=11.25]{spiro};
\pic[draw=orange!100,fill=orange!40,scale=2, rotate=-11.25]{spiro};
\pic[draw=orange!100,fill=orange!40,scale=2, rotate=33.75]{spiro};
\pic[draw=orange!100,fill=orange!40,scale=2, rotate=-33.75]{spiro};
\pic[draw=brown!100,fill=brown!40,scale=2, rotate=-22.5]{spiro};
\pic[draw=brown!100,fill=brown!40,scale=2, rotate=22.5]{spiro};
\pic[draw=red!100,fill=red!40,scale=2, rotate=45]{spiro};
\pic[draw=purple!100,fill=purple!40,scale=2]{spiro};
\end{tikzpicture}
\end{frame}
\end{document}
如何简化它,以及如何使角变得尖锐,类似于下面的图画。
答案1
您只需重新绘制pic
。由于您的颜色实际上没有模式,因此几乎不需要简化。
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{Spirifankerln using scale}
\begin{tikzpicture}[pics/spiro/.style={code={
\draw[line width=.1cm,looseness=1,pic actions]
(0,-2) arc (180:90:2) arc (270:180:2) arc (360:270:2) arc (90:0:2);
}
}]
\foreach \i in {-33.75,-11.25,11.25,33.75}
\pic[draw=orange!100,fill=orange!40,scale=2,rotate=\i]{spiro};
\pic[draw=brown!100,fill=brown!40,scale=2, rotate=-22.5]{spiro};
\pic[draw=brown!100,fill=brown!40,scale=2, rotate=22.5]{spiro};
\pic[draw=red!100,fill=red!40,scale=2, rotate=45]{spiro};
\pic[draw=purple!100,fill=purple!40,scale=2]{spiro};
\end{tikzpicture}
\end{frame}
\end{document}
将所有内容添加到循环中(请注意顺序很重要!)。
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{Spirifankerln using scale}
\begin{tikzpicture}[pics/spiro/.style={code={
\draw[line width=.1cm,looseness=1,pic actions]
(0,-2) arc (180:90:2) arc (270:180:2) arc (360:270:2) arc (90:0:2);
}
}]
\foreach \i/\clr in {3/orange,1/orange,2/brown,4/red,0/purple} {
\pic[draw/.expanded=\clr!100,fill/.expanded=\clr!40,scale=2,rotate=\i*11.25]{spiro};
\pic[draw/.expanded=\clr!100,fill/.expanded=\clr!40,scale=2,rotate=-\i*11.25]{spiro};
}
\end{tikzpicture}
\end{frame}
\end{document}
(与上面输出相同)