1
$\begingroup$

I'm a programmer who could use some help reversing an easing method:

public static float easeInExpo(float start, float end, float value){     end -= start;     return end * Mathf.Pow(2, 10 * (value / 1 - 1)) + start; } 

The method takes a start and end variable and a value. The value is then eased based on an exponential function.

$\text{value} = \text{dist} \times (10((x/1)-1))^2 + \text{start}$

I am trying to reverse it so that the original value is produced with the input of the eased value.

What I have so far is:

$x = \left.\sqrt{\frac{\text{value}+\text{start}}{\text{dist}}}\right/10+1$

This doesn't seem to work. How would you reverse this method?

Edit: It seems that I got it all wrong. What must be solved is $\text{value} = \text{dist}(2^{10((x/1)-1)}) + \text{start}$

  • 0
    Why do you have $(x/1)$ instead of $x$?2012-07-07

2 Answers 2

2

start=$a$
end=$b$
value=$x$
eased value=$y$
So $y=(b-a)2^{10(x-1)}+a$ Hence $x=1+\frac{1}{10}\log_2\frac{y-a}{b-a}$

  • 0
    I wouldn't know why this is the case. However, I've used http://www.mathway.com to solve the problem and the answer's working as intended.2012-07-07
1

For the new problem:

$\text{value} = \text{dist}(2^{10((x/1)-1)}) + \text{start}$

$\text{value} = \text{dist}(2^{10(x-1)}) + \text{start}$

$\frac {\text{value - start}}{\text{dist}}=2^{10(x-1)}$

$\log_2(\frac {\text{value - start}}{\text{dist}})=10(x-1)$

$(\log_2(\frac {\text{value - start}}{\text{dist}}))/10+1=x$