I want to make the gradient color to follow the pipe curve below rather than to span from the left to the right.
The following MWE shows the default behavior which is not what I'm looking for.
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-slpe}
\begin{document}
\begin{pspicture}(8,-7)
\pscustom[fillstyle=slope]{
\psline(6,0)
\psarcn(6,-2){2}{90}{-90}
\psline(2,-4)
\psarc(2,-5){1}{90}{-90}
\psline(8,-6)
\psline(8,-7)(2,-7)
\psarcn(2,-5){2}{-90}{90}
\psline(6,-3)
\psarc(6,-2){1}{-90}{90}
\psline(0,-1)
\closepath}
\end{pspicture}
\end{document}
Could you help me to accomplish my objective?
Update
Using Pierre's solution, here is what I ended up with:
\documentclass{article}
\usepackage{pst-plot}
\makeatletter
\pst@addfams{pst-HSB}
\define@key[psset]{pst-HSB}{HueBegin}{%
\def\PstParametricplotHSB@HueBegin{#1}}
\define@key[psset]{pst-HSB}{HueEnd}{%
\def\PstParametricplotHSB@HueEnd{#1}}
\define@boolkey[psset]{pst-HSB}[Pst@]{HSB}[true]{}
% Default values
\psset[pst-HSB]{HueBegin = 0, HueEnd = 1, HSB = true}
\psset{dimen = outer}
\def\parametricplotHSB{\pst@object{parametricplotHSB}}
\def\parametricplotHSB@i#1#2#3{{%
\begin@ClosedObj
\addto@pscode{%
/t #1 def
/dt #2 t sub \psk@plotpoints\space div def
/t t dt sub def
/Counter 0 def
1 setlinejoin
\psk@plotpoints {
/t t dt add def
/Counter Counter 1 add def
#3
\pst@number\psyunit mul exch
\pst@number\psxunit mul exch
1 Counter eq { moveto currentpoint /OldY ED /OldX ED }
{\ifPst@HSB
/PointY exch def
/PointX exch def
Counter \psk@plotpoints\space div
\PstParametricplotHSB@HueEnd\space
\PstParametricplotHSB@HueBegin\space sub mul
\PstParametricplotHSB@HueBegin\space add
1 1 sethsbcolor
OldX OldY PointX PointY lineto lineto
stroke
PointX PointY moveto
/OldX PointX def /OldY PointY def
\else lineto \fi } ifelse
} repeat }%
\end@ClosedObj}
\ignorespaces}
\makeatother
\begin{document}
\begin{pspicture}(-0.5,-0.5)(4.5,4.5)
\psset{
linewidth = 1cm,
plotpoints = 300
}
\parametricplotHSB[
HueBegin = 0.70,
HueEnd = 0.66
]{3.05}{0}{t 4}
\parametricplotHSB[
HueBegin = 0.70,
HueEnd = 0.78
]{0}{180}{t sin 3 add t cos 3 add}
\parametricplotHSB[
HueBegin = 0.78,
HueEnd = 0.86
]{3.05}{0.95}{t 2}
\parametricplotHSB[
HueBegin = 0.86,
HueEnd = 0.92
]{0}{-180}{t sin 1 add t cos 1 add}
\parametricplotHSB[
HueBegin = 0.92,
HueEnd = 1
]{0.95}{4}{t 0}
\end{pspicture}
\end{document}
Update 2
I've not managed to get vertical ends on the curve and a black boundry; can anyone help with this?
Update 3
I've now found http://pstricks.blogspot.dk/2015/10/helice-tournant-autour-de-son-axe-et.html; can a similar coloring as alone the helix be obtained?
slopebegin = {rgb:orange,0;black,100}, slopeend = {rgb:orange,80;black,20},
).{rgb:orange,0;black,100}
(i.e., black, as it is now) and the other end (where the pipe is coming out of the furnace and the lower right part of it) should have the colour{rgb:orange,80;black,20}
.:)
linearc
and have a look at tug.org/PSTricks/main.cgi?file=Examples/Colors/colors#contColor