Reputation: 1318
i am writing a game where their is a slider that controls the alpha value of a color. It seems to be working fine except that now i want to invert the alpha value. For example if the value is 0 the value would become 255, and if the value was 255 it would become 0. Unfortunately my google searches turned up no easy way or built in methods for doing this. All help would be appreciated thanks.
Upvotes: 0
Views: 143
Reputation: 5683
Do simple math :
int alphaValue = 255 - sliderValue
for example:
when
sliderValue
= 0,alphaValue
= 255 - 0 = 255when
sliderValue
= 255,alphaValue
= 255 - 255 = 0
Upvotes: 3