![TikZ 中的水彩阴影](https://linux22.com/image/324813/TikZ%20%E4%B8%AD%E7%9A%84%E6%B0%B4%E5%BD%A9%E9%98%B4%E5%BD%B1.png)
答案1
我不确定你想要显示的内容。右边的还是左边的?它总是圆形的吗?
我假设并非总是圆形,而是两者都有。不过,我使用圆形作为示例,但这只是为了方便。
有四种可能:
四个圆圈均以相同的方式绘制,gray
不透明度为 50%,宽度为 10 毫米。第一个圆圈使用样式添加了蓝色阴影。其他三个圆圈则pic
使用了各种绘画、阴影等组合。
\documentclass[tikz,border=10pt,multi]{standalone}
\usetikzlibrary{shadows,fit,decorations.pathmorphing}
\tikzset{
overfill/.pic={
\node [pic actions] {};
\scoped[scale=1.25]{\node [fill=#1!50, scale=1.25, opacity=.5] {};}
},
shadow fill/.style={general shadow={shadow scale=1.25, inner color=#1!25, outer color=#1!5}},
over paint/.pic={
\node (a) [pic actions] {};
\scoped[scale=1.25]{\node (b) [shape=rectangle, fit=(a)] {};}
\path [decoration={random steps, segment length=2.5mm}, rounded corners=1.25pt, decorate, fill=#1!50, opacity=.5] (b.north) -| (b.south east) -| (b.north west) -- cycle;
},
shadow over paint/.pic={
\node (a) [pic actions] {};
\scoped[scale=1.25]{\node (b) [shape=rectangle, fit=(a)] {};}
\path [decoration={random steps, segment length=2.5mm}, rounded corners=2pt, decorate, general shadow={shadow scale=1.25, inner color=#1!50, outer color=#1!25, opacity=.5}] (b.north) -| (b.south east) -| (b.north west) -- cycle;
},
}
\begin{document}
\begin{tikzpicture}
\node [circle, draw=gray, draw opacity=.5, minimum size=10mm, shadow fill=blue] {};
\pic [circle, draw=gray, draw opacity=.5, minimum size=10mm] at (2,0) {overfill=green};
\pic [circle, draw=gray, draw opacity=.5, minimum size=10mm] at (0,-2) {over paint=orange};
\pic [circle, draw=gray, draw opacity=.5, minimum size=10mm] at (2,-2) {shadow over paint=red};
\end{tikzpicture}
\end{document}
答案2
我不确定您是否想要整个图表,但这里有一个示例节点。构建它的命令可能会根据您想要的用途而改变。
输出
代码
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{fadings,decorations.pathmorphing}
\tikzfading[name=fade out,
inner color=transparent!0,
outer color=transparent!100]
\tikzset{
nod/.style={circle, draw=blue!50!green, fill=white, inner sep=0, outer sep=0}
}
\newcommand{\mynode}[4][1]{
\scalebox{#1}{
\node[nod, minimum size=3cm] (#2) at (#3) {};
\fill[#4,
decoration={random steps,segment length=4mm,amplitude=3mm},
decorate,
rounded corners,
path fading=fade out
] (#3) circle (2cm);
}
}
\begin{document}
\begin{tikzpicture}
\mynode{A}{0,0}{yellow!30}
\end{tikzpicture}
\end{document}