How do I swap around this formula to get the opposite value?

mink23 :

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?

Fogmeister :

To make it run the other way you can just subtract it from 1.

So...

button.alpha = 1 - (1 - x) / 0.2

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=33233&siteId=1