その他一覧へ戻る

コーヒーカップ

鉄TeX機能紹介/TikZサンプル/コーヒーカップ.tex鉄TeX機能紹介 / TikZhybrid

レンダリング結果

4ページ / 同名PDFあり
コーヒーカップ preview
コーヒーカップ preview
コーヒーカップ preview

先頭3ページのみプレビューしています。

PDFを開く
TeXソース
TeXソース
入力コード
\documentclass{tetsujsarticle}
\usepackage{tetsuryoku}

\begin{document}

\tikzfading[name=fade out,
  inner color=transparent!0, outer color=transparent!100]


\begin{tikzpicture}
  \foreach \c [count=\i from 0] in {white,red!75!black,blue!25,orange}{

    \tikzset{xshift={mod(\i,2)*3cm}, yshift=-floor(\i/2)*3cm}
    \colorlet{cup}{\c}

    % Saucer
    \begin{scope}[shift={(0,-1-1/16)}]
      \fill [black!87.5, path fading=fade out] 
        (0,-2/8) ellipse [x radius=6/4, y radius=3/4];
      \fill [cup, postaction={left color=black, right color=white, opacity=1/3}] 
        (0,0) ++(180:5/4) arc (180:360:5/4 and 5/8+1/16);
      \fill [cup, postaction={left color=black!50, right color=white, opacity=1/3}] 
        (0,0) ellipse [x radius=5/4, y radius=5/8];
      \fill [cup, postaction={left color=white, right color=black, opacity=1/3}]
        (0,1/16) ellipse [x radius=5/4/2, y radius=5/8/2];
      \fill [cup, postaction={left color=black, right color=white, opacity=1/3}] 
        (0,0) ellipse [x radius=5/4/2-1/16, y radius=5/8/2-1/16];
    \end{scope} 

    % Handle
    \begin{scope}[shift=(10:7/8), rotate=-30, yslant=1/2, xslant=-1/8]
      \fill [cup, postaction={top color=black, bottom color=white, opacity=1/3}] 
        (0,0) arc (130:-100:3/8 and 1/2) -- ++(0,1/4) arc (-100:130:1/8 and 1/4)
        -- cycle;
      \fill [cup, postaction={top color=white, bottom color=black, opacity=1/3}] 
        (0,0) arc (130:-100:3/8 and 1/2) -- ++(0,1/32) arc (-100:130:1/4 and 1/3)
        -- cycle;
    \end{scope}

    % Cup
    \fill [cup!25!black, path fading=fade out] 
      (0,-1-1/16) ellipse [x radius=3/4, y radius=1/3];
    \fill [cup, postaction={left color=black, right color=white, opacity=1/3/2},
      postaction={bottom color=black, top color=white, opacity=1/3/2}] 
      (-1,0) arc (180:360:1 and 5/4);
    \fill [cup, postaction={left color=white, right color=black, opacity=1/3}] 
      (0,0) ellipse [x radius=1, y radius=1/2];
    \fill [cup, postaction={left color=black, right color=white, opacity=1/3/2},
      postaction={bottom color=black, top color=white, opacity=1/3/2}] 
      (0,0) ellipse [x radius=1-1/16, y radius=1/2-1/16];

    % Coffee
    \begin{scope}
      \clip ellipse [x radius=1-1/16, y radius=1/2-1/16];
      \fill [brown!25!black] 
        (0,-1/4) ellipse [x radius=3/4, y radius=3/8];
      \fill [brown!50!black, path fading=fade out] 
        (0,-1/4) ellipse [x radius=3/4, y radius=3/8];
    \end{scope}
  }
\end{tikzpicture}


  \begin{tikzpicture}
    
    \clip (-5,-3) rectangle (5,3);

    % the sky
    \fill[blue!10!black] (-6,1) rectangle (6,3);
    \fill[yellow] (-6,-3) rectangle (6,1);
    \fill[inner color=blue!50!,outer color=blue!10!black] (-12,-6) rectangle (9,2);

    % orange fadings
    \draw[draw=none] 
    [postaction={path fading=north,fill=orange!80!yellow,opacity=0.6}]
    (-7,-2.5) rectangle (7,-1.5);%
    \draw[draw=none] 
    [postaction={path fading=north,fill=orange,opacity=0.8}]
    (-7,-2.5) rectangle (7,-2);

    % the line of mountains
    \fill[black]
    decorate [decoration={random steps,segment length=3pt,amplitude=1pt}] %
    {(-5,-2.25) -- (-3.5,-2.25)}%
    decorate [decoration={random steps,segment length=5pt,amplitude=4pt}] %
    {-- (-2.5,-2.25) -- (-1,-2.25)}%
    decorate [decoration={random steps,segment length=3pt,amplitude=1pt}] %
    {-- (-1,-2.25) -- (5,-2.25)}%
    -- (5,-3) -- (-5,-3) -- (-5,-2.25);

    % a planet or a star
    \draw[color=white] (3.6,1) circle (0.005);
  \end{tikzpicture}  

\begin{tikzpicture}
	\draw[gray,fill=gray,path fading=south] (0,0) rectangle +(0.3,-0.3);% <- MAGIC
		% (if this is not present none of the shadings work)

	%top
	\shade[left color=black!10!white,right color=black!40!white] (-1,0.75)
		-- ++(2,0) -- ++(0.25,-0.25) -- ++(-2.5,0) -- cycle;
	\draw (-1,0.75) -- ++(2,0) -- ++(0.25,-0.25) -- ++(-2.5,0) -- cycle;

	%source
	\shade[left color=black!10!white,right color=black!40!white] (1.25,0.5)
		-- ++(0,-1.75) -- ++(-2.5,0) -- ++(0,1.75) -- cycle;
	\draw (1.25,0.5) -- ++(0,-1.75) -- ++(-2.5,0) -- ++(0,1.75) -- cycle;

	%top condenser system
	\shade[left color=black!10!white,right color=black!40!white] (1.25,-1.25)
		-- ++(0.25,-0.25) -- ++(-3,0) -- ++(0.25,0.25) -- cycle;
	\draw (1.25,-1.25) -- ++(0.25,-0.25) -- ++(-3,0) -- ++(0.25,0.25) -- cycle;

	%condenser system
	\shade[left color=black!10!white,right color=black!40!white] (1.5,-1.5)
		-- ++(0,-2) -- ++(-3,0) -- ++(0,2) -- cycle;
	\draw (1.5,-1.5) -- ++(0,-2) -- ++(-3,0) -- ++(0,2) -- cycle;

	%condenser bottom
	\shade[left color=black!10!white,right color=black!40!white] (1.5,-3.5)
		-- ++(-0.25,-0.25) -- ++(-2.5,0) -- ++(-0.25,0.25) -- cycle;
	\draw (1.5,-3.5) -- ++(-0.25,-0.25) -- ++(-2.5,0) -- ++(-0.25,0.25) -- cycle;

	%specimen and objective
	\shade[left color=black!10!white,right color=black!40!white] (1.25,-3.75)
		-- ++(0,-2.5) -- ++(-2.5,0) -- ++(0,2.5) -- cycle;
	\draw (1.25,-3.75) -- ++(0,-2.5) -- ++(-2.5,0) -- ++(0,2.5) -- cycle;

	%projector system top
	\shade[left color=black!10!white,right color=black!40!white] (1.25,-6.25)
		-- ++(0.25,-0.25) -- ++(-3,0) -- ++(0.25,0.25) -- cycle;
	\draw (1.25,-6.25) -- ++(0.25,-0.25) -- ++(-3,0) -- ++(0.25,0.25) -- cycle;

	%projector system
	\shade[left color=black!10!white,right color=black!40!white] (1.5,-6.5)
		-- ++(0,-1.5) -- ++(-3,0) -- ++(0,1.5) -- cycle;
	\draw (1.5,-6.5) -- ++(0,-1.5) -- ++(-3,0) -- ++(0,1.5) -- cycle;

	%image
	\shade[left color=black!10!white,right color=black!40!white] (1.5,-8)
		-- ++(1,-1.5) -- ++(0,-0.75) -- ++(-5,0) -- ++(0,0.75) -- ++(1,1.5) -- cycle;
	\draw (1.5,-8) -- ++(1,-1.5) -- ++(0,-0.75) -- ++(-5,0) -- ++(0,0.75)
		-- ++(1,1.5) -- cycle;

	%sample entrance
	\shade[left color=black!10!white,right color=black!40!white] (-1.25,-4.5)
		-- ++(-0.5,0) -- ++(-0.2,-0.2) -- ++(0,-0.6) -- ++(0.2,-0.2)
		-- ++(0.5,0) -- cycle;
	\draw (-1.25,-4.5) -- ++(-0.5,0) -- ++(-0.2,-0.2) -- ++(0,-0.6)
		-- ++(0.2,-0.2)  -- ++(0.5,0) -- cycle;

	%sample holder
	\draw[fill=black] (-1.95,-4.8) -- ++(-0.08,0) -- ++(-0.02,-0.02)
		-- ++(0,-0.36) -- ++(0.02,-0.02) -- ++(0.08,0) -- cycle;

	%inside
	\begin{scope}
		\path[clip,decoration={random steps, segment length=6pt, amplitude=2pt},
			decorate] (0,0.5) -- ++(0.4,0) -- ++(0.4,-0.4) -- ++(0,-8.5)
			-- ++(1,-1.3) -- ++(-0.4,-0.4) -- ++(-2.8,0) -- ++(-0.4,0.4)
			-- ++(1,1.3) -- ++(0,8.5) -- ++(0.4,0.4) -- cycle;
		\shade[left color=black!40!white,right color=black!10!white] (-1,0.75)
			-- ++(2,0) -- ++(0.25,-0.25) -- ++(0,-1.75) -- ++(0.25,-0.25) -- ++(0,-2)
			-- ++(-0.25,-0.25) -- ++(0,-2.5) -- ++(0.25,-0.25) -- ++(0,-1.5)
			-- ++(1,-1.5) -- ++(0,-0.75) -- ++(-5,0) -- ++(0,0.75) -- ++(1,1.5)
			-- ++ (0,1.5) -- ++(0.25,0.25) -- ++(0,2.5) -- ++(-0.25,0.25) -- ++(0,2)
			-- ++(0.25,0.25) -- ++(0,1.75) -- cycle;
 
 	%source
	\draw (-0.25,0.15) -- ++(0,-0.05) .. controls +(0,-0.08) and +(-0.08,0)
		.. ++(0.1,-0.1) -- ++(0.05,0) .. controls +(0.08,0) and +(0,0.08)
		.. ++(0.1,-0.1) .. controls +(0,0.08) and +(-0.08,0) .. ++(0.1,0.1) --
		++(0.05,0) .. controls +(0.08,0) and +(0,-0.08) .. ++(0.1,0.1) -- ++(0,0.05);

	%C1
	\draw[fill=brown!80!yellow] (-0.4,-1.75) -- ++(-0.5,0) -- ++(0,-0.5)
		-- ++(0.5,0) -- cycle;
	\draw (-0.4,-1.75) ++(-0.04,-0.04) -- ++(-0.42,0) -- ++(0,-0.42)
		-- ++(0.42,0) -- cycle;
	\begin{scope}
		\path[clip,draw] (-0.4,-1.75) ++(-0.04,-0.04) -- ++(-0.42,0)
			-- ++(0,-0.42) -- ++(0.42,0) -- cycle;
		\foreach \j in {-0.07,-0.14,...,-0.42}
			\foreach \i in {-0.07,-0.14,...,-0.42} {
				\draw[fill=brown!40!yellow] (-0.4,-1.75) ++(-0.04,-0.04)
					++(0.035,0.035) ++(\i,\j) circle (0.035);
			}
	\end{scope}
	\draw[fill=brown!80!yellow] (0.9,-1.75) -- ++(-0.5,0) -- ++(0,-0.5)
		-- ++(0.5,0) -- cycle;
	\draw (0.9,-1.75) ++(-0.04,-0.04) -- ++(-0.42,0) -- ++(0,-0.42)
		-- ++(0.42,0) -- cycle;
	\begin{scope}
		\path[clip,draw] (0.9,-1.75) ++(-0.04,-0.04) -- ++(-0.42,0)
			-- ++(0,-0.42) -- ++(0.42,0) -- cycle;
		\foreach \j in {-0.07,-0.14,...,-0.42}
			\foreach \i in {-0.07,-0.14,...,-0.42} {
				\draw[fill=brown!40!yellow] (0.9,-1.75) ++(-0.04,-0.04)
					++(0.035,0.035) ++(\i,\j) circle (0.035);
			}
	\end{scope}

	%C2
	\draw[fill=brown!80!yellow] (-0.4,-2.75) -- ++(-0.5,0) -- ++(0,-0.5)
		-- ++(0.5,0) -- cycle;
	\draw (-0.4,-2.75) ++(-0.04,-0.04) -- ++(-0.42,0) -- ++(0,-0.42)
		-- ++(0.42,0) -- cycle;
	\begin{scope}
		\path[clip,draw] (-0.4,-2.75) ++(-0.04,-0.04) -- ++(-0.42,0)
			-- ++(0,-0.42) -- ++(0.42,0) -- cycle;
		\foreach \j in {-0.07,-0.14,...,-0.42}
			\foreach \i in {-0.07,-0.14,...,-0.42} {
				\draw[fill=brown!40!yellow] (-0.4,-2.75) ++(-0.04,-0.04)
					++(0.035,0.035) ++(\i,\j) circle (0.035);
			}
	\end{scope}
	\draw[fill=brown!80!yellow] (0.9,-2.75) -- ++(-0.5,0) -- ++(0,-0.5)
		-- ++(0.5,0) -- cycle;
	\draw (0.9,-2.75) ++(-0.04,-0.04) -- ++(-0.42,0) -- ++(0,-0.42)
		-- ++(0.42,0) -- cycle;
	\begin{scope}
		\path[clip,draw] (0.9,-2.75) ++(-0.04,-0.04) -- ++(-0.42,0)
			-- ++(0,-0.42) -- ++(0.42,0) -- cycle;
		\foreach \j in {-0.07,-0.14,...,-0.42}
			\foreach \i in {-0.07,-0.14,...,-0.42} {
				\draw[fill=brown!40!yellow] (0.9,-2.75) ++(-0.04,-0.04)
					++(0.035,0.035) ++(\i,\j) circle (0.035);
			}
	\end{scope}

	%condenser aperture
	\draw[fill=black] (-1,-3.45) -- ++(0.6,0) -- ++(-0.1,-0.1)
		-- ++(-0.5,0) -- cycle;
	\draw[fill=black] (1,-3.45) -- ++(-0.6,0) -- ++(0.1,-0.1)
		-- ++(0.5,0) -- cycle;

	%specimen
	\draw[fill=brown!70!yellow] (-1,-4.95) -- ++(0.75,0) -- ++(0.05,-0.045)
		-- ++(0,-0.01) -- ++(-0.05,-0.045) -- ++(-0.75,0) -- cycle;
	\draw[fill=black] (-0.2,-4.995) -- ++(0.4,0) -- ++(0,-0.01)
		-- ++(-0.4,0) -- cycle;
		
	%objective
	\draw[fill=brown!80!yellow] (-0.4,-5.25) -- ++(-0.5,0) -- ++(0,-0.5)
		-- ++(0.5,0) -- cycle;
	\draw (-0.4,-5.25) ++(-0.04,-0.04) -- ++(-0.42,0) -- ++(0,-0.42)
		-- ++(0.42,0) -- cycle;
	\begin{scope}
		\path[clip,draw] (-0.4,-5.25) ++(-0.04,-0.04) -- ++(-0.42,0)
			-- ++(0,-0.42) -- ++(0.42,0) -- cycle;
		\foreach \j in {-0.07,-0.14,...,-0.42}
			\foreach \i in {-0.07,-0.14,...,-0.42} {
				\draw[fill=brown!40!yellow] (-0.4,-5.25) ++(-0.04,-0.04)
					++(0.035,0.035) ++(\i,\j) circle (0.035);
			}
	\end{scope}
	\draw[fill=brown!80!yellow] (0.9,-5.25) -- ++(-0.5,0) -- ++(0,-0.5)
		-- ++(0.5,0) -- cycle;
	\draw (0.9,-5.25) ++(-0.04,-0.04) -- ++(-0.42,0) -- ++(0,-0.42)
		-- ++(0.42,0) -- cycle;
	\begin{scope}
		\path[clip,draw] (0.9,-5.25) ++(-0.04,-0.04) -- ++(-0.42,0)
			-- ++(0,-0.42) -- ++(0.42,0) -- cycle;
		\foreach \j in {-0.07,-0.14,...,-0.42}
			\foreach \i in {-0.07,-0.14,...,-0.42} {
				\draw[fill=brown!40!yellow] (0.9,-5.25) ++(-0.04,-0.04)
					++(0.035,0.035) ++(\i,\j) circle (0.035);
			}
	\end{scope}
		
	%objective aperture
	\draw[fill=black] (-1,-5.95) -- ++(0.7,0) -- ++(-0.1,-0.1)
		-- ++(-0.6,0) -- cycle;
	\draw[fill=black] (1,-5.95) -- ++(-0.7,0) -- ++(0.1,-0.1)
		-- ++(0.6,0) -- cycle;
		
		

	%projector system
	\draw[fill=brown!80!yellow] (-0.4,-6.75) -- ++(-0.5,0)
		-- ++(0,-1) -- ++(0.5,0) -- cycle;
	\draw (-0.4,-6.75) ++(-0.04,-0.04) -- ++(-0.42,0) -- ++(0,-0.92)
		-- ++(0.42,0) -- cycle;
	\begin{scope}
		\path[clip,draw] (-0.4,-6.75) ++(-0.04,-0.04) -- ++(-0.42,0)
			-- ++(0,-0.92) -- ++(0.42,0) -- cycle;
		\foreach \j in {-0.07,-0.14,...,-0.92}
			\foreach \i in {-0.07,-0.14,...,-0.42} {
				\draw[fill=brown!40!yellow] (-0.4,-6.75) ++(-0.04,-0.04)
					++(0.035,0.035) ++(\i,\j) circle (0.035);
			}
	\end{scope}
	\draw[fill=brown!80!yellow] (0.9,-6.75) -- ++(-0.5,0) -- ++(0,-1)
		-- ++(0.5,0) -- cycle;
	\draw (0.9,-6.75) ++(-0.04,-0.04) -- ++(-0.42,0) -- ++(0,-0.92)
		-- ++(0.42,0) -- cycle;
	\begin{scope}
		\path[clip,draw] (0.9,-6.75) ++(-0.04,-0.04) -- ++(-0.42,0)
			-- ++(0,-0.92) -- ++(0.42,0) -- cycle;
		\foreach \j in {-0.07,-0.14,...,-0.92}
			\foreach \i in {-0.07,-0.14,...,-0.42} {
				\draw[fill=brown!40!yellow] (0.9,-6.75) ++(-0.04,-0.04)
					++(0.035,0.035) ++(\i,\j) circle (0.035);
			}
	\end{scope}

	%image
	\draw[fill=gray] (2,-10) -- ++(0,-0.2) -- ++(-4,0) -- ++(0,0.2) -- cycle;
		
	%beam
	\draw[blue] (0,-0.1) ++(260:0.3) -- (-0.3,-2) -- ++(0.6,-1) -- ++(-0.3,-2)
		-- ++(-0.3,-0.5) -- ++(0.35,-1.25);
	\draw[blue] (0,-0.1) ++(280:0.3) -- (0.3,-2) -- ++(-0.6,-1) -- ++(0.3,-2)
		-- ++(0.3,-0.5) -- ++(-0.35,-1.25);
	\draw[blue] (-0.3,-7.75) -- ++(-1,-2.25);
	\draw[blue] (0.3,-7.75) -- ++(1,-2.25);
	\draw[blue,dash pattern=on 4pt off 1pt on 1pt off 1pt on 1pt off 1pt]
		(0,-0.4) -- (0,-10);

	\end{scope}

	%labels
	\draw (2,0) node[right] {source};
	\draw (-2,-2) node[left] {C1};
	\draw (-2,-3) node[left] {C2};
	\draw (-2,-3.5) node[left] {condenser aperture};
	\draw (2,-2.5) node[right] {condenser system};
	\draw (2,-5) node[right] {sample};
	\draw (-2.3,-5) node[left] {sample holder};
	\draw (2,-5.5) node[right] {objective lens};
	\draw (2,-6) node[right] {objective aperture};
	\draw (2,-7.25) node[right] {projector system};
	\draw (3,-10) node[right] {imaging};

	\end{tikzpicture}
	
	\pgfdeclareradialshading{someshade}{\pgfpointorigin}{%
  color(0mm)=(pgftransparent!40);color(5mm)=(pgftransparent!50);%
  color(10mm)=(pgftransparent!70);color(2cm)=(pgftransparent!100)}
\pgfdeclareradialshading{somenodeshade}{\pgfpointorigin}{%
  color(0mm)=(pgftransparent!0);color(2mm)=(pgftransparent!5);%
  color(5mm)=(pgftransparent!95);color(20mm)=(pgftransparent!100)}
\pgfdeclareradialshading{invertshade}{\pgfpointorigin}{%
  color(0mm)=(pgftransparent!100);color(6mm)=(pgftransparent!95);%
  color(10mm)=(pgftransparent!60);color(2cm)=(pgftransparent!0)}
\pgfdeclarefading{fadeit}{\pgfuseshading{someshade}}
\pgfdeclarefading{fadein}{\pgfuseshading{invertshade}}
%

\begin{tikzpicture}[projectile/.style={decorate,decoration={random steps,
  segment length=3pt,amplitude=0.5pt}}]
  \fill[black] (-4,-4) rectangle (6,5);

  \begin{scope}[xshift=0cm,yshift=-0.4cm,transparency group]
    \pgfsetfading{fadein}{\pgftransformshift{\pgfpointorigin}}
    \foreach \x in {0,6,..., 360}{\draw[blue!80!white,projectile,line width=1.1pt]
      (0,0) to [in=90] (10*rand+\x:rand*1mm+2cm);};
  \end{scope}

  \begin{scope}[xshift=2cm,yshift=1cm]
    \foreach \x in {0,8,..., 360}{\draw [yellow!5,thick,projectile] (0.7,0)
      to  (3*rand+\x :1mm*rand+2.2cm)  node[circle,inner sep=1mm,
      shade,shading=somenodeshade,opacity=0.1] {};}
    {\pgfsetfading{fadeit}{\pgftransformshift{\pgfpoint{2.5cm}{1cm}}}};
    \fill[white] (-3,-3) rectangle (3,3);
  \end{scope}

  \begin{scope}[xshift=3cm,yshift=-1cm]
    \foreach \x in {0,10,..., 360}{\def\r1{rand}\draw [yellow]
      ($(0,0)!abs{\r1}!(\x :5mm)$) to [in=90] ($(0,0)!abs{\r1}+0.2!(\x :8mm)$);}
    {\pgfsetfading{fadeit}{\pgftransformshift{\pgfpoint{3cm}{-1cm}}}};
    \fill[yellow,opacity=0.6] (-3,-3) rectangle (3,3);
  \end{scope}

  \begin{scope}[xshift=-1cm,yshift=1.5cm]
    \foreach \x in {0,12,..., 360}{\def\r2{rand}\draw [red,line width=0.5pt]
      ($(0,0)!abs{\r2}!(\x :3mm)$) -- ($(0,0)!abs{\r2}+0.1!(\x :7mm)$);}
    {\pgfsetfading{fadeit}{\pgftransformshift{\pgfpoint{-1cm}{1.5cm}}}};
    \fill[red,opacity=0.6] (-3,-3) rectangle (3,3);
  \end{scope}
\end{tikzpicture}


\tikzfading[name=fade out, inner color=transparent!0,
  outer color=transparent!100]

\def\petal { 
  [rounded corners=0.5] %
  (-1,0)%
  .. controls (-1,0.6) and (-0.07,0.8).. (0,1)%
  .. controls (0.07,0.8) and (1,0.6).. (1,0)%
  .. controls (0.7,-1) and (-0.7,-1).. (-1,0)%
}

%%%%% circles in the background %%%%%
\def\background[#1,#2]{
  \fill[#1] (0,0) circle (3.9);
  \fill[#2] (0,0) circle (1);
}

%%%%% star and small circle in the center %%%%%
\def\center[#1]{
  \foreach \a in {51.4285,102.857,...,360} { %
    \draw[color=yellow,rotate=\a,fill=#1]
    (-0.08,0) -- (0,0.46) -- (0.08,0); %
  }
  \draw[color=yellow,fill=#1] (0,0) circle (0.1);
}

%%%%%%%%%% Mandala with fixed colouring %%%%%%%%%%
\def \mandala {
  \background[red!30!blue!70!black,blue!70!yellow!50];

  % ysh - yshift
  % xs - xscale
  % ys - yscale
  % af - first angle in foreach
  % as - second angle in foreach
  % y - number in the color specification after yellow
  % b - number in the color specification before blue
  % r - number in the color specification of the shading after red
  % bl - number in the color specification of the shading before black
  \foreach \ysh/\xs/\ys/\af/\as/\y/\b/\w/\r/\bl in {%
    3.06/0.72/0.8/   25.71425/51.4285/    70/100/100/ 100/100,%
    2.34/1/0.9/        25.71425/77.14275/   6/90/92/       80/80,%
    1.8/0.8/0.9/       51.4285/102.857/       0/75/100/     60/70,%
    1.5/0.6/0.6/       25.71425/77.14275/   0/55/100/     40/60,%
    1.1/0.53/0.58/   51.4285/102.857/       0/40/100/     20/50,%
    0.8/0.37/0.45/   25.71425/77.14275/   0/45/85/       20/40,%
    0.53/0.1/0.24/   25.71425/77.14275/   0/10/100/     0/30,%
    0.49/0.22/0.32/ 51.4285/102.857/       0/10/100/     0/50%
  }
  {
    \foreach \a in {\af,\as,...,360}
    {
      \begin{scope}[rotate=\a,shift={(0,\ysh)},xscale=\xs,yscale=\ys]
        \draw[color=yellow,fill=yellow!\y!red!\b!blue!\w] %
        [drop shadow={shadow xshift=0.5pt, shadow yshift=-0.5pt}]
        \petal;
      \end{scope}
      
      \begin{scope}[transform canvas={rotate=\a},shift={(0,\ysh)},xscale=\xs,yscale=\ys]
        \clip \petal; %
        \fill[path fading=fade out,fill=red!\r!blue!\bl!black, opacity=0.7]%
        (0,-0.35) ellipse (1.2 and 0.75);
        \fill[path fading=fade out,fill=red!\r!blue!\bl!black, opacity=0.3]%
        (0,-0.2) ellipse (1.2 and 0.4);

        \fill[path fading=fade out,fill=red!\r!blue,opacity=0.2] %
        (-0.4,0.6) -- (0,0.9) -- (0.4,0.6);
      \end{scope}
    }
  }

  \center[blue]
}
%%%%%%%%%% End of Mandala with fixed colouring %%%%%%%%%%

%%%%% one layer of petals %%%%%
\def\mainbody{
  \foreach \a in {\af,\as,...,360}
  {
    \begin{scope}[rotate=\a,shift={(0,\ysh)},xscale=\xs,yscale=\ys]
      \draw[color=yellow,fill=\c] %
      [drop shadow={shadow xshift=0.5pt, shadow yshift=-0.5pt}]
      \petal;
    \end{scope}

    % fadings
    \begin{scope}[transform canvas={rotate=\a}, shift={(0,\ysh)},xscale=\xs,yscale=\ys]
      \clip \petal; %
      \fill[path fading=fade out,fill=\fc, opacity=0.7]%
      (0,-0.35) ellipse (1.2 and 0.75);
      \fill[path fading=fade out,fill=\fc, opacity=0.3]%
      (0,-0.2) ellipse (1.2 and 0.4);
      \fill[path fading=fade out,fill=\fc,opacity=0.2] %
      (-0.4,0.6) -- (0,0.9) -- (0.4,0.6);
    \end{scope}
  }
}

%%%%%%%%%%% Mandalas with parametrized colouring %%%%%%%%%%
% #1 - the color of the outer most (first) layer
% #2 - the color of the third layer
% #3 - the color of the fifth layer
% #4 - the color of the seventh layer
% #5 - the color of the fading, gets denser closer to the center
\def \mandalac[#1,#2,#3,#4,#5]{
  \background[#3!30!#4!70!#5,#4!70!#2!50];

  % ysh - yshift
  % xs - xscale
  % ys - yscale
  % af - first angle in foreach
  % as - second angle in foreach
  % c - color of the petal
  % fc - color of the fading
  \foreach \ysh/\xs/\ys/\af/\as/\c/\fc in {%
    3.06/0.72/0.8/   25.71425/51.4285  /#1/#1!50!#2!90!#5,%
    2.34/1/0.9/        25.71425/77.14275/#1!50!#2/#2!80!#5,%
    1.8/0.8/0.9/       51.4285/102.857    /#2/#2!50!#3!70!#5,%
    1.5/0.6/0.6/       25.71425/77.14275/#2!50!#3/#3!60!#5,%
    1.1/0.53/0.58/   51.4285/102.857    /#3/#3!50!#4!50!#5,%
    0.8/0.37/0.45/   25.71425/77.14275/#3!50!#4/#4!40!#5,%
    0.53/0.1/0.24/   25.71425/77.14275/#4/#4!50!#5,%
    0.49/0.22/0.32/ 51.4285/102.857    /#4/#4!50!#5%
  }
  {
    \mainbody
  }
  \center[#4]
}

% #1 - the color of the outer most (first) layer
% #2 - the color of the second layer
% #3 - the color of the third layer
% #4 - the color of the forth layer
% #5 - the color of the fifth layer
% #6 - the color of the sixth layer
% #7 - the color of the seventh layer
% #8 - the color of the fading, gets denser closer to the center
\def \mandalab[#1,#2,#3,#4,#5,#6,#7,#8]{
  \background[#6!30!#7!70!#8,#7!70!#4!50];

  % ysh - yshift
  % xs - xscale
  % ys - yscale
  % af - first angle in foreach
  % as - second angle in foreach
  % c - color of the petal
  % fc - color of the fading
  \foreach \ysh/\xs/\ys/\af/\as/\c/\fc in {%
    3.06/0.72/0.8/   25.71425/51.4285  /#1/#2!90!#8,%
    2.34/1/0.9/        25.71425/77.14275/#2/#3!90!#8,%
    1.8/0.8/0.9/       51.4285/102.857    /#3/#4!80!#8,%
    1.5/0.6/0.6/       25.71425/77.14275/#4/#5!80!#8,%
    1.1/0.53/0.58/   51.4285/102.857    /#5/#6!70!#8,%
    0.8/0.37/0.45/   25.71425/77.14275/#6/#7!70!#8,%
    0.53/0.1/0.24/   25.71425/77.14275/#7/#7!50!#8,%
    0.49/0.22/0.32/ 51.4285/102.857    /#7/#7!50!#8%
  }
  {
    \mainbody
  }
  \center[#7]
}
%%%%%%%%%%% End of Mandalas with parametrized colouring %%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%% BEGIN DOCUMENT %%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{empty}
\setlength{\parindent}{0pt}
\tikz\mandala;

\tikz\mandalac[magenta!30!,magenta,purple,violet,];

\tikz\mandalac[blue!40!black,violet,purple,pink,];

\tikz\mandalac[lime!90!black,yellow!95!black,orange,red,];

\tikz\mandalac[green!80!black,yellow,pink,purple!90!,red];

\tikz\mandalab[green!50!black, green!60!black, green!70!black!80!, green!50!,
  green!10!, pink!40!, red!40!,];

\tikz\mandalab[blue!30!black, blue!40!black, blue!60!black, blue!70!black!80!,
  blue!50!, yellow!40!, yellow!70!,];
  
  
\end{document}