以下使用 PGF/TikZ 声明衰落的方式有什么问题?:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,fadings}
\begin{document}
\begin{tikzpicture}
\pgfdeclarehorizontalshading{FOne}{100bp}
{color(0bp)=(pgftransparent!100); color(25bp)=(pgftransparent!100);
color(75bp)=(pgftransparent!0); color(100bp)=(pgftransparent!0)}
\pgfdeclarefading{myfading}{\pgfuseshading{FOne}}
\path[draw,fill=black,path fading=west] (0,-3) rectangle (10,1);
\path[draw,fill=black,path fading=myfading] (0,-8) rectangle (10,-4);
\end{tikzpicture}
\end{document}
请注意,“FOne”是“pgf@lib@fade@west”的 PGF 定义的一对一复制,因此,“FOne”应该类似于“west”路径衰落。然而,结果是这样的:
所以,自定义填充没有任何效果。这到底是哪里出了问题?
答案1
看来必须fading
建立前环境tikzpicture
:
代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,fadings}
\pgfdeclarehorizontalshading{FOne}{100bp}
{color(0bp)=(pgftransparent!100); color(25bp)=(pgftransparent!100);
color(75bp)=(pgftransparent!0); color(100bp)=(pgftransparent!0)}
\pgfdeclarefading{myfading}{\pgfuseshading{FOne}}
\begin{document}
\begin{tikzpicture}
\path[draw,fill=black,path fading=west] (0,-3) rectangle (10,1);
\path[draw,fill=black,path fading=myfading] (0,-8) rectangle (10,-4);
\end{tikzpicture}
\end{document}