# How to make a horizontal line with varying opacity or gradient?

Can you please let me know how to draw a horizontal line with variable transparency similar to the figure attached below. Thank you!

There is a similar question answered by @Emma and @Sigur, which addresses horizontal rule with a color gradient. But, I couldn't figure out how to make the horizontal rule fade at both ends.

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Tiuri Dec 4 '19 at 10:27

\documentclass{article}
\usepackage{lipsum}%dummy text only
\usepackage{tikz}
\begin{tikzpicture}
\end{tikzpicture}%
}
\begin{document}
\lipsum[1]
\lipsum[2]
\end{document}


Here is another version that controls the appearance of the rule with various pgf keys and draws the thing in one stretch.

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
left color=transparent!100,right color=transparent!100,
middle color=transparent!0]

\path(-\textwidth/2,0) -- (\textwidth/2,0);
rectangle (\pv{width}/2,\pv{height}/2);}}

\begin{document}
\lipsum[1]

\lipsum[2]