mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-28 11:02:20 +00:00
Merge pull request #3 from icrawler/Dev2
Stripped all trailing whitespace, changed ease function, and pre-computed po2
This commit is contained in:
@@ -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)
|
||||
|
9
lume.lua
9
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
|
||||
|
||||
@@ -434,9 +435,9 @@ end
|
||||
|
||||
|
||||
function lume.rgba(color)
|
||||
local a = math_floor((color / 2 ^ 24) % 256)
|
||||
local r = math_floor((color / 2 ^ 16) % 256)
|
||||
local g = math_floor((color / 2 ^ 08) % 256)
|
||||
local a = math_floor((color / 16777216) % 256)
|
||||
local r = math_floor((color / 65536) % 256)
|
||||
local g = math_floor((color / 256) % 256)
|
||||
local b = math_floor((color) % 256)
|
||||
return r, g, b, a
|
||||
end
|
||||
|
Reference in New Issue
Block a user