这是我的 MWE:
\documentclass[border=5pt,tikz]{standalone}
\definecolor{forestgreen}{RGB}{34,139,34}
\definecolor{limegreen}{RGB}{0,255,0}
\begin{document}
\begin{tikzpicture}
%% \clip (5,-4) rectangle (-1,1);
%% \fill[left color=red,right color=magenta] (-1,1) -- (5,-4) -- (5,1) -- cycle;
% \foreach \x in {0,30,...,350}
% {
% \fill[green] (0,0) -- (\x-10:1) arc(\x-10:\x+10:1) -- (\x+10:1) -- cycle;
% }
\begin{scope}[xshift=0cm]
\foreach \x in {0,30,...,350}
{
\pgfmathsetmacro{\a}{(1/5)*\x}
\fill[green!\a!yellow] (0,0) -- (\x-10:1) arc(\x-10:\x+10:1) -- (\x+10:1) -- cycle;
}
\end{scope}
\begin{scope}[yshift=-3cm]
\fill[inner color=orange!30,outer color=orange!80] (0,0) circle(1);
\foreach \x in {0,30,...,350}
{
\fill[inner color=red!80,outer color=red] (0,0) -- (\x-10:1) arc(\x-10:\x+10:1) -- (\x+10:1) -- cycle;
}
\begin{scope}[xshift=3.5cm]
\foreach \x in {0,30,...,350}
{
\pgfmathsetmacro{\a}{(1/5)*\x}
\fill[red!\a!blue] (0,0) -- (\x-10:1) arc(\x-10:\x+10:1) -- (\x+10:1) -- cycle;
}
\end{scope}
\end{scope}
\begin{scope}[xshift=1.75cm,yshift=-1.5cm]
\foreach \x in {0,30,...,350}
{
\fill[orange] (0,0) -- (\x-10:1) arc(\x-10:\x+10:1) -- (\x+10:1) -- cycle;
\fill[left color=blue!80,right color=blue!40] (0,0) -- (\x-10:.6) arc(\x-10:\x+10:1) -- (\x+10:.5) -- cycle;
}
\end{scope}
\begin{scope}[xshift=3.5cm]
\fill[inner color=blue!30,outer color=blue!80] (0,0) circle(1);
\foreach \x in {0,30,...,350}
{
\fill[inner color=yellow!80,outer color=yellow] (0,0) -- (\x-10:1) arc(\x-10:\x+10:1) -- (\x+10:1) -- cycle;
}
\end{scope}
\fill[left color=red,right color=magenta] (3,-5.5) circle(1);
\fill[left color=limegreen,right color=forestgreen] (.5,-5.5) circle(1);
\end{tikzpicture}
\end{document}
输出如下:
我的问题是:如何清理代码(例如使用saveboxes
)?