[Tex/LaTex] Color fade a line in tikzpicture

colorgradienttikz-pgf

I had already a similar question. I know now how to color fade rectangles. But I was trying now for almost an hour and I couldn't figure out how to do a fading for a line.

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[remember picture,overlay]

\draw[line width=4pt,orange] 
  ([yshift=-62pt]current page.north west) -- +(14cm,0pt);
\draw[orange,line width=1pt] 
  ([yshift=-175pt,xshift=+14cm]current page.north west) -- +(5.1cm,0pt);


\end{tikzpicture}
\end{document}

I want the lines to fade from left orange to right white.

Best Answer

A line can be be considered as a very thin rectangle...

enter image description here

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
\path[left color=orange,right color=white]
([yshift=-62pt]current page.north west)
+(0,-2pt) rectangle +(14cm,2pt); 

\path[left color=orange,right color=white]
([yshift=-175pt,xshift=+14cm]current page.north west)
+(0,-.5pt) rectangle +(5.1cm,0.5pt);
\end{tikzpicture}
\end{document}