3

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 ?

Trung0246
  • 689
  • 1
  • 10
  • 21
  • That link you’ve just posted explains step by step how the author got to that number, can you clarify what precisely you don’t understand? I’m not sure this is really a programming question. – jonrsharpe Oct 07 '17 at 20:01
  • The post ended up with 1.7015401988668, so I'm not sure if it accurate. – Trung0246 Oct 07 '17 at 20:02
  • The post also comments on that. – jonrsharpe Oct 07 '17 at 20:04
  • So should I replace 1.70158 with that new constant in the code ? – Trung0246 Oct 07 '17 at 20:12
  • How much difference do you realistically think that would make?! I would imagine such a small tweak would be imperceptible in practice. Is there actually a *problem* you’re trying to solve? – jonrsharpe Oct 07 '17 at 20:13
  • I guess no. As I did not understand the post clearly because of lack of English and thought that google translate may translate wrong sometimes... Thank for help... – Trung0246 Oct 07 '17 at 21:07

1 Answers1

0

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
Vaschex
  • 1
  • 1