考虑以下:
\documentclass{article}
\usepackage{pstricks-add}
\begin{document}
\begin{figure}
\centering
\begin{pspicture}(2.4,0.6)
\rput(1.2,0.25){Springboldene}
% \psset{linestyle=none}
\multido{\r=0.3+0.45}{5}{\pscircle(\r,0.3){0.3}}
\end{pspicture}
\end{figure}
\end{document}
我如何用渐变色填充这五个圆圈,从左边的橙色开始,到右边的绿色?
我想删除圆圈本身(因此linestyle=none
)但填充它们的内部,正如所解释的那样。
答案1
\documentclass{article}
\usepackage{pst-grad,multido}
\begin{document}
\begin{pspicture}(-12ex,-3.5ex)(12ex,3.5ex)
\pscustom[linestyle=none,fillstyle=gradient,gradangle=-90,
gradbegin=orange!90!red,gradend=green!80!orange,
gradmidpoint=0]{%
\multido{\rA=-8+4}{5}{\pscircle(\rA ex,0){3ex}}}
\rput(0,0){\large\textbf{Springboldene}}
\end{pspicture}
\end{document}
同样适用于gradmidpoint=0.5
答案2
使用 TikZ 的方法如下:填充将覆盖所有使用单个\path
(或\shade
)命令指定的圆圈
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\shade [left color=orange!90!red, right color=green!80!orange]
\foreach \i in {-2,...,2}{
(\i*3.5ex,0) circle [radius=2.5ex]
};
\node [font=\bfseries] (A) {Springboldene};
\end{tikzpicture}
\end{document}
答案3
我的代码看似冗长,但额外的代码实际上是为了获得精确的尺寸和位置。这也使您更方便地调整参数。
\documentclass[pstricks,border=0pt]{standalone}
\usepackage{multido}
\usepackage{pst-grad}
\usepackage[nomessages]{fp}
\newpsstyle{A}
{
fillstyle=gradient,
gradbegin=red,
gradend=yellow,
gradangle=30,
gradmidpoint=0.5,
}
\psset{linestyle=none}
\def\greeting{Springboldene}
\def\hoffset{5pt}
\def\voffset{5pt}
\newsavebox\IBox
\savebox\IBox{\raisebox{\depth}{\greeting}}
\newlength\Left
\newlength\Right
\newlength\Top
\newlength\Bottom
\Left=\dimexpr-0.5\wd\IBox-\hoffset
\Right=\dimexpr0.5\wd\IBox+\hoffset
\Top=\dimexpr0.5\ht\IBox+\voffset
\Bottom=\dimexpr-0.5\ht\IBox-\voffset
% for circles
\FPset\a{-27.00}
\FPset\b{27.00}
\FPset\N{7}
\FPeval\step{round((b-a)/N:2)}
\FPeval\NplusOne{N+1}
\begin{document}
\begin{pspicture}(\Left,\Bottom)(\Right,\Top)
\psclip{\pscustom{\multido{\nx=\a+\step}{\NplusOne}{\pscircle(\nx pt,0){8pt}}}}
\psframe[style=A](\Left,\Bottom)(\Right,\Top)
\endpsclip
\rput(0,0){\usebox\IBox}
\end{pspicture}
\end{document}