Distance to alpha

Im trying to fade in and out text

The max distance is 1000 an min is 0

how do i work out the alpha so that if its at 1000 max distance alpha(0) its faded away and when close it has no alpha (255)

i know its to do with math but i cant work it out
i have googled.
Last edited on
(1000 - d) * 255

(255 = opaque)
that dont seem to work.

with that if the distance is 45 or so there almost transparent
150 no transparent
700 no transparent

so its all kinda over the place. thanks anyway
Whoops. My bad.
(1000 - d) * 255 / 1000
thank you works good :)
Topic archived. No new replies allowed.