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
    Assume dist is given, which is equal to the end variable minus the start variable. Edit: It seems that I got it all wrong. What must be solved is value = dist(2^(10((x/1)-1))) + start2012-07-07
  • 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
    Actually, there was a mistake with the given formula. I've updated the question. Any help would be greatly appreciated.2012-07-07
  • 0
    @Abdulla You need the value of $x$ , given $y$ right??2012-07-07
  • 0
    Thanks a lot for the help Saurabh, I managed to find a solution to the problem: x = 1 + ln(y-a)/10*ln(2). I haven't tested it yet but I'm assuming it's correct.2012-07-07
  • 0
    @Abdulla Aren't you missing _dist_ ?2012-07-07
  • 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$