at 0, you want opacity 1?
at 300, you want opacity 0.
that means you want to split the range 1 by the domain 301
(the fraction of 1/301 is assigned therefore to each position in the scroll)
that is, each time the scroll advances 1 point, from 0, the opacity should decrease by 0.00332
or each time the scroll goes down from 300 by 1 point, the opacity should -increase- by 0.00332