尝试在 Word 文档中模仿标题页。我知道如何进行自定义阴影处理,但不知道如何在其上应用淡入淡出(透明度)
这是一个 MWE(除了衰落部分)。
\documentclass[paper=a4]{standalone}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{shadings}
\begin{document}
\definecolor{color1}{RGB}{42,137,149}
\definecolor{color2}{RGB}{11,59,93}
\pgfdeclarehorizontalshading{myshading}{100bp}{color(0cm)=(color1); color(16bp)=(color1); color(100bp)=(color2)}
\pgfdeclarehorizontalshading{myshadingtransparent}{100bp}{color(0cm)=(pgftransparent!0); color(16bp)=(pgftransparent!0); color(100bp)=(pgftransparent!50)}
\pgfdeclarefading{fade1}{\pgfuseshading{myshadingtransparent}}
\begin{tikzpicture}
\pgfpathmoveto{\pgfpointorigin}
\pgfpathlineto{\pgfpoint{0}{3cm}}
\pgfpathlineto{\pgfpoint{3cm}{1.5cm}}
\pgfpathclose
\pgfshadepath{myshading}{0}
\pgfsetfading{fade1}{}
\end{tikzpicture}
\end{document}
顺便问一下,我真的必须用 pgf 做所有事情吗,还是使用 tikz 指令可以部分完成?我尝试将两者混合使用,但我的阴影不适用。
答案1
我稍微改变了颜色和效果。以下是两个版本:
\documentclass[tikz]{standalone}
\usetikzlibrary{shadings}
\pgfdeclarehorizontalshading{myshading}{100bp}{color(0cm)=(blue); color(16bp)=(blue); color(80bp)=(blue!40!yellow); color(100bp)=(yellow)}
\pgfdeclarehorizontalshading{myshadingtransparent}{100bp}{color(0cm)=(pgftransparent!0); color(16bp)=(pgftransparent!20); color(100bp)=(pgftransparent!100)}
\pgfdeclarefading{fade1}{\pgfuseshading{myshadingtransparent}}
\begin{document}
\begin{tikzpicture}
\shade[shading=myshading,path fading=fade1] (0,0) -- +(90:2) -- +(30:2) -- cycle;
\end{tikzpicture}
\end{document}
在较低级别的版本中
\documentclass[tikz]{standalone}
\usetikzlibrary{shadings}
\begin{document}
\pgfdeclarehorizontalshading{myshading}{100bp}{color(0cm)=(blue); color(16bp)=(blue); color(80bp)=(blue!40!yellow); color(100bp)=(yellow)}
\pgfdeclarehorizontalshading{myshadingtransparent}{100bp}{color(0cm)=(pgftransparent!0); color(16bp)=(pgftransparent!20); color(100bp)=(pgftransparent!100)}
\pgfdeclarefading{fade1}{\pgfuseshading{myshadingtransparent}}
\begin{tikzpicture}
\pgfpathmoveto{\pgfpointorigin}
\pgfpathlineto{\pgfpoint{0}{3cm}}
\pgfpathlineto{\pgfpoint{3cm}{1.5cm}}
\pgfpathclose
\pgfsetfadingforcurrentpath{fade1}{}
\pgfshadepath{myshading}{0}
\end{tikzpicture}
\end{document}