Weishaupt
if the player overlap the sprite, every tick you do a lerp(currentOpacity, 100, 5*dt)
(forget the min and max function they are useless... just to scare some n00bs)
basically while you are overlapping the sprite, every tick you travel a little percentage of the distance between your current Opacity and 100.
But this percentage is fixed and is equal to 5*dt.
So as the distance decrease, the same fraction of this distance decrease, so you basically ease in the value
the primary goal of lerp() isn't to be used like that. You usually have a starting point, an end point and a percentage (from 0 to 1)
so you usually do lerp(start,end,percent) and you make the percent value evolve to create movement.
But here the percent is fixed and you apply the result of the lerp to the start value, so the distance between start and end decrease... etc I explained that already.
And you do exaclty the same when you don't overlap. But toward 0 instead of 100