Reputation: 154
I'm guessing this is simple but I am having a hard time working this out. The formula I have is this: (1-x) / 0.20. x equals between 0.8 and 1. Example:
(1-0.8) / 0.20 = 1
(1-0.9) / 0.20 = 0.5
(1-1) / 0.20 = 0
This is the code I currently have but I a just trying to make it run in the opposite direction button.alpha = (1-x) / 0.20)
. How do I solve this and what type of math is this called?
Upvotes: 0
Views: 43
Reputation: 77651
To make it run the other way you can just subtract it from 1.
So...
button.alpha = 1 - (1 - x) / 0.2
Upvotes: 2