How to calculate this constant in various easing functions?

712 Views Asked by At

Based on this blog post (japanese, so I used google translate to read that) and other various source, it's seems that the magic constant 1.70158 equal 10% "bounce". The constant appear in various easing functions such as inBack, outBack, ...

How did one come up with this constant, and how to calculate it ?

1

There are 1 best solutions below

0
On

This is late, but here's a function to calculate it:

function calc(p)
    p = p/10
    local m = (27*40^2*-27*p+2*(-27*p)^3-9*40*-27*p*-54*p)/(54*40^3)
    local r = (m^2+((3*40*-54*p-(-27*p)^2)/(9*40^2))^3)^0.5
    local s = (-m+r)^(1/3)+(-m-r)^(1/3)-(-27*p)/(3*40)
    return s, 1-(s+3)/(3*s+3)
end