嘿,我的文档中有以下代码:
\begin{tikzpicture}
\shade[inner color=blue,outer color=white] (3,0) circle (1);
\draw[fill=white] (3,0) circle [radius=0.7];
\shade[inner color=blue,outer color=white] (4.8,0) circle (1);
\draw[fill=white] (4.8,0) circle [radius=0.7];
\end{tikzpicture}
结果我得到:
如何使圆圈重叠的阴影看起来更自然?
答案1
我会用 来fadings
代替shadings
。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{fadings}
\tikzfading[name=fade out,
inner color=transparent!0,
outer color=transparent!100]
\begin{document}
\begin{tikzpicture}
\fill [blue,path fading=fade out] (3,0) circle (1);
\draw[fill=white] (3,0) circle [radius=0.7];
\fill [blue,path fading=fade out] (4.8,0) circle (1);
\draw[fill=white] (4.8,0) circle [radius=0.7];
\end{tikzpicture}
\end{document}
编辑:以稍微不同的方式构造环可能会更有利,以避免绘制白色圆盘。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{fadings}
\tikzfading[name=fade out,
inner color=transparent!0,
outer color=transparent!100]
\begin{document}
\begin{tikzpicture}
\fill [blue,path fading=fade out] (4,0) arc(0:360:1) -- (3.7,0) arc(360:0:0.7);
\fill [blue,path fading=fade out] (5.8,0) arc(0:360:1) -- (5.5,0) arc(360:0:0.7);
\end{tikzpicture}
\end{document}