如何制作矩形径向辉光

如何制作矩形径向辉光

考虑一下代码

\documentclass[a5paper,12pt,onecolumn,openany,final]{book}
\usepackage[hmargin=0.7in,vmargin=0.75in]{geometry}

\usepackage{tikz}
\usepackage{calc}
\usetikzlibrary{fadings}

\definecolor{forestgreen}{rgb}{.13, .55, .13}
\definecolor{sunriseyellow}{RGB}{255,219,0}


% I compile this code with Xelatex
\begin{document}
\thispagestyle{empty}

\centering
\tikzfading[name=fade out, inner color=transparent!0,
outer color=transparent!100]
\tikzset{
  star/.style={forestgreen, fill=sunriseyellow, path fading=fade out}
}
\begin{tikzpicture}
    \clip (-1.65, -2.15) rectangle (1.65, 2.15);
     \draw[forestgreen!35!black, shading=mradial, inner color=sunriseyellow!65!white, 
     middle color=forestgreen!60!black, outer color=forestgreen!35!black]
    (-1.65, -2.15) rectangle (1.65, 2.15)
    ;
\end{tikzpicture} 
\end{document}

产生输出

在此处输入图片描述

问题:我该如何修改代码,以使径向光晕延伸到整个矩形区域?目前,代码产生圆形径向光晕。(实际上,圆形径向光晕在本例中呈蛋形,因为不是tikzpicture完美的正方形。)

谢谢。

相关内容