iOS need a math formula

alexandergre

macrumors member
Original poster
Jul 28, 2009
58
0
mybutton.location.x=158;
mylable.alpha=0;

mybutton is dragable in 259>x>158
I want the mylable.alpha to grow from 0 to 1.0 as the x grows from 158 to 259;


I came up with this:
mylabel.alpha=((myButton.location.x)/259);

It works
but the alpha start from 0.613900 and not 0. becase 158/259=0.61003861
I need another forumla. can you please help.

mylabel.alpha=((myButton.location.x-158)/259) didnt work either.
when x= 158; alpha is 0;
but when x=259 alpha is 0.39
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.