box-of-eases/ease.lua
2021-09-18 01:44:36 +03:00

38 lines
No EOL
591 B
Lua

local self = {}
local easelib = require 'easelib'
function self.mixEase(e1, e2, point)
if not point then point = 0.5 end
return function(a)
if a < point then
return e1(a / point) * point
else
return e2((a - point) / (1 - point)) * (1 - point) + point
end
end
end
self.eases = {}
for i,v in pairs(easelib) do
local min = 0
local q = 10
for i = 0, q do
local s = v[2](i / q)
if s < 0 then min = -1 end
end
self.eases[v[1]] = {
f = v[2],
max = 1,
min = min,
i = i
}
end
self.ease = nil
self.minEase = false
return self