Changed ease function from cosine to cubic

This commit is contained in:
Phoenix Enero 2014-05-06 09:39:53 +08:00
parent 17b58ec63d
commit 1a82d308af
2 changed files with 3 additions and 2 deletions

View File

@ -38,7 +38,7 @@ lume.lerp(100, 200, .5) -- Returns 150
```
### lume.smooth(a, b, amount)
Similar to `lume.lerp()` but uses cosine interpolation instead of linear
Similar to `lume.lerp()` but uses cubic interpolation instead of linear
interpolation.
### lume.pingpong(x)

View File

@ -59,7 +59,8 @@ end
function lume.smooth(a, b, amount)
local m = (1 - math_cos(lume.clamp(amount, 0, 1) * math_pi)) / 2
local t = lume.clamp(amount, 0, 1)
local m = t*t*(3-2*t)
return a + (b - a) * m
end