0
$\begingroup$

I just wanna know if you can find a way to simplify this following equation :

originalState + ( ( animatedState * ( 100 - ( finishPos - x ) * 100 / (finishPos - startPos) ) / 100 )

Thanks

  • 0
    Do you mean, $\text{originalState} + \Big(\frac{\text{animatedState} \big(100 - 100( \text{finishPos} - x )\big) }{ 100(\text{finishPos} - \text{startPos})}\Big)$2012-08-14

2 Answers 2

1

Being lazy, I'll replace each variable by its first letter, and I get this (with its unbalanced parens):

$o + ( ( a * ( 100 - ( f - x ) * 100 / (f - s) ) / 100 )$.

The "100"s seems to cancel out, and. balancing the parens, I get

$o + a * ( 1 - \frac{ f - x}{f - s} )$.

Simplifying the expression inside the parens I get this:

$o + a * ( \frac{ x-s}{f - s} )$.

0

The only thing I can see is to work inside the brackets, to get the two finishPos pieces together. $100-\frac {100(\text{finishPos-x})}{\text{finishPos-startPos}}=100\frac {\text{finishPos-startPos}}{\text{finishPos-startPos}}-\frac {100(\text{finishPos-x})}{\text{finishPos-startPos}}=\frac {100(\text{x-startPos})}{\text{finishPos-startPos}}$ then the last division by $100$ takes the $100$ out of the numerator, giving $\text{originalState+animatedState}\times \frac {\text{x-startPos}}{\text{finishPos-startPos}}$ which seems to show the intent.