I found this old thread on how to create noise gradients, but it doesn't properly fade to transparent which creates a hard border effect. I was wondering if it was possible to have only the gradient be noisy, not the transparency in the end.
Here is what I tried so far:
.black-bar {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100px;
background-size: cover;
background-position: center;
background-repeat: repeat;
stop-color: black;
background-image: linear-gradient(to bottom,
rgba(0, 0, 0, 1) 0%,
rgba(0, 0, 0, 1) 50%,
rgba(0, 0, 0, 0) 100%),
url('/noise.svg');
z-index: -1;
}
<svg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'>
<filter id='noiseFilter'>
<feTurbulence
type='fractalNoise'
baseFrequency='5'
numOctaves='3'
stitchTiles='stitch'/>
</filter>
<rect width='100%' height='100%' filter='url(#noiseFilter)'/>
</svg>
And here is the border effect I'm talking about:
Hard border effect I don't want
Noisy gradient I'm looking for (Mockup created in Photoshop)
I found the solution. Inverting the noise while fading itself to transparent while applying it after the gradient seemed to create the transition I'm looking for. Here is the scss
And here is the final result