Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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}$

share|improve this question
    
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))) + start –  Abdulla Jul 7 '12 at 15:10
    
Why do you have $(x/1)$ instead of $x$? –  Ross Millikan Jul 7 '12 at 16:45

2 Answers 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}$$

share|improve this answer
    
Actually, there was a mistake with the given formula. I've updated the question. Any help would be greatly appreciated. –  Abdulla Jul 7 '12 at 15:19
    
@Abdulla You need the value of $x$ , given $y$ right?? –  Saurabh Jul 7 '12 at 15:24
    
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. –  Abdulla Jul 7 '12 at 15:31
    
@Abdulla Aren't you missing dist ? –  Saurabh Jul 7 '12 at 15:40
    
I wouldn't know why this is the case. However, I've used mathway.com to solve the problem and the answer's working as intended. –  Abdulla Jul 7 '12 at 15:43

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$

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.