mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +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:
commit
95c3f8960d
@ -38,7 +38,7 @@ lume.lerp(100, 200, .5) -- Returns 150
|
|||||||
```
|
```
|
||||||
|
|
||||||
### lume.smooth(a, b, amount)
|
### 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.
|
interpolation.
|
||||||
|
|
||||||
### lume.pingpong(x)
|
### lume.pingpong(x)
|
||||||
|
9
lume.lua
9
lume.lua
@ -59,7 +59,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function lume.smooth(a, b, amount)
|
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
|
return a + (b - a) * m
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -434,9 +435,9 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function lume.rgba(color)
|
function lume.rgba(color)
|
||||||
local a = math_floor((color / 2 ^ 24) % 256)
|
local a = math_floor((color / 16777216) % 256)
|
||||||
local r = math_floor((color / 2 ^ 16) % 256)
|
local r = math_floor((color / 65536) % 256)
|
||||||
local g = math_floor((color / 2 ^ 08) % 256)
|
local g = math_floor((color / 256) % 256)
|
||||||
local b = math_floor((color) % 256)
|
local b = math_floor((color) % 256)
|
||||||
return r, g, b, a
|
return r, g, b, a
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user