我正在尝试为节点添加带有褪色边缘的阴影。使用以下文档,我只得到一个灰色圆圈,带有硬边,位于节点的右下方。这是我的代码片段。我做错了什么?
\documentclass[a4paper,10pt]{article}
\usepackage{tikz}
\usetikzlibrary{shapes,fadings}
\begin{document}
\maketitle
\begin{center}
\begin{tikzpicture}[scale=4, transform shape]
\node[circle,fill=white,draw=black,thick,preaction={fill=black,opacity=.3,transform canvas={xshift=1mm,yshift=-1mm,path fading=circle with fuzzy edge 20 percent}}] (1) at (0,0) {1};
\end{tikzpicture}
\end{center}
\end{document}
答案1
必须path fading=circle with fuzzy edge 20 percent
在参数中preaction
但在参数之外包括transform canvas
:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fadings}
\begin{document}
\begin{tikzpicture}[scale=4]
\node[circle,fill=white,draw=black,thick,
preaction={
fill=black,opacity=.3,
path fading=circle with fuzzy edge 20 percent,
transform canvas={xshift=1mm,yshift=-1mm}
}] (1) at (0,0) {1};
\end{tikzpicture}
\end{document}
结果:
(PDF->PNG 和缩小尺寸后褪色效果没有完全保留)