如何在代码中为白色矩形添加如下图所示的阴影效果?

如何在代码中为白色矩形添加如下图所示的阴影效果?

在此处输入图片描述

\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]

答案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}

带有模糊蓝色阴影的白色矩形的顶部

相关内容