使用 \foreach 循环旋转绘图

使用 \foreach 循环旋转绘图

要制作以下图纸,

在此处输入图片描述

我使用了以下代码来回答这个问题

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{rounded corners solution 1}
\vskip -3.cm
\includegraphics[width=14.cm,keepaspectratio]{./rotat45.png}
\vskip -11.cm
\begin{tikzpicture}
\begin{scope}[transparency group,opacity=.4, scale=2]
\hskip 2.96cm
\draw[line width=.1cm,blue, fill=blue!40!white, looseness=1] 
(0,0) node {x} (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}  
\end{tikzpicture}
\end{frame}
\end{document}

我如何制作旋转的绘图以获得以下效果。我还想将其旋转几次,例如 30 度和 60 度。

在此处输入图片描述

答案1

如果你多次重复绘画,最好将其制作成图片。然后可以说

\path pic {fcross} pic[rotate=30] {fcross} pic[rotate=60] {fcross};

或者

\path foreach \Y in {0,30,60} {pic[rotate=\Y] {fcross}};

如果您也想旋转x节点,则必须添加transform shape

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{rounded corners solution 1}
\begin{tikzpicture}[pics/fcross/.style={code={
\begin{scope}[transparency group,opacity=.4, scale=2]
\draw[line width=.1cm,blue, fill=blue!40!white, looseness=1] 
(0,0) node {x} (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}  
}}]
 \path pic {fcross} pic[rotate=30] {fcross} pic[rotate=60] {fcross};
\end{tikzpicture}
\end{frame}
\end{document}

在此处输入图片描述

相关内容