简体   繁体   English

如何在各种缓动函数中计算这个常数?

[英]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".根据这篇博文(日语,所以我用谷歌翻译来阅读)和其他各种来源,似乎魔术常数1.70158等于 10% 的“反弹”。 The constant appear in various easing functions such as inBack, outBack, ...常量出现在各种缓动函数中,例如 inBack、outBack、...

How did one come up with this constant, and how to calculate it ?这个常数是怎么得出的,又是怎么计算出来的?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM