![如何在代码中为白色矩形添加如下图所示的阴影效果?](https://linux22.com/image/474113/%E5%A6%82%E4%BD%95%E5%9C%A8%E4%BB%A3%E7%A0%81%E4%B8%AD%E4%B8%BA%E7%99%BD%E8%89%B2%E7%9F%A9%E5%BD%A2%E6%B7%BB%E5%8A%A0%E5%A6%82%E4%B8%8B%E5%9B%BE%E6%89%80%E7%A4%BA%E7%9A%84%E9%98%B4%E5%BD%B1%E6%95%88%E6%9E%9C%EF%BC%9F.png)
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows, shapes, positioning}
\begin{document}
\pagestyle{empty}
\pagecolor{blue!50}
\begin{tikzpicture}[remember picture, overlay]
\fill[fill=white]([xshift=23mm, yshift=-23mm]current page.north west)rectangle([xshift=-23mm, yshift=-227mm]current page.north east);
\end{tikzpicture}
\end{document}
[
答案1
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\begin{document}
\pagestyle{empty}
\pagecolor{blue!50}
\begin{tikzpicture}[remember picture, overlay]
\fill[blur shadow={shadow xshift=5pt, shadow yshift=0pt, shadow blur radius=5pt}, white] ([xshift=23mm, yshift=-23mm]current page.north west)rectangle([xshift=-23mm, yshift=-227mm]current page.north east);
\end{tikzpicture}
\end{document}
编辑:
阴影不太明显:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\begin{document}
\pagestyle{empty}
\pagecolor{blue!20}
\begin{tikzpicture}[remember picture, overlay]
\fill[blur shadow={shadow xshift=5pt, shadow yshift=0pt, shadow blur radius=5pt, shadow opacity=20}, white,
] ([xshift=23mm, yshift=-23mm]current page.north west)rectangle([xshift=-23mm, yshift=-227mm]current page.north east);
\end{tikzpicture}
\end{document}
shadows.blur
无法改变颜色,但您可以手动添加阴影,如下所示:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\pagestyle{empty}
\pagecolor{blue!20}
\begin{tikzpicture}[remember picture, overlay]
\foreach \x in {0,0.025,...,1}
\draw[blue!50, opacity=\x, thick] ([xshift=-23mm+10-10*\x, yshift=-23mm]current page.north east) -- ([xshift=-23mm+10-10*\x, yshift=-227mm]current page.north east);
\fill[white] ([xshift=23mm, yshift=-23mm]current page.north west)rectangle([xshift=-23mm, yshift=-227mm]current page.north east);
\end{tikzpicture}
\end{document}