diff --git a/README.md b/README.md index 26a8af4..2aec81a 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/lume.lua b/lume.lua index d1d1985..e70c1cd 100644 --- a/lume.lua +++ b/lume.lua @@ -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