No one wrote an actual answer, so I thought there should also be a text-written simple explaination
I don't know if this is the professional term, but with masks you can set opacity very specificly, and in a great way.
To be exact, when you have a layer with an image, and you apply mask to it (select it, and click at the bottom of the layers panel on it, looks like a gray rectangle, with a white circle inside), after that you can paint on the layer, OR on the mask.
To the mask:
100% Black = 0% Opacity
100% White = 100% Opacity
And every gray color in the middle, the more black it is, the less opacity.
to understand this better, try to take an image, any image. apply a mask, and use the gradient tool.
you'll see that the black color is actually 0% opacity, and white is 100% opacity as mentioned above.