Trung0246
Trung0246

Reputation: 689

How to calculate this constant in various easing functions?

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 ?

Upvotes: 3

Views: 853

Answers (1)

Vaschex
Vaschex

Reputation: 1

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

Upvotes: 0

Related Questions