slider - Inverting alpha value java -


i writing game slider controls alpha value of color. seems working fine except want invert alpha value. example if value 0 value become 255, , if value 255 become 0. unfortunately google searches turned no easy way or built in methods doing this. appreciated thanks.

do simple math :

int alphavalue = 255 - slidervalue 

for example:

when slidervalue = 0, alphavalue = 255 - 0 = 255

when slidervalue = 255, alphavalue = 255 - 255 = 0


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -