feature/task-tweens #30

Merged
PeaAshMeter merged 9 commits from feature/task-tweens into main 2026-02-12 00:07:35 +03:00
Showing only changes of commit 163906c289 - Show all commits

View File

@ -1,4 +1,5 @@
local easing_lib = require "lib.utils.easing"
local lerp = require "lib.utils.utils".lerp
--- Обобщенная асинхронная функция (Task).
--- По сути это функция, принимающая коллбэк: `fun(callback: fun(value: T): nil): nil`
@ -13,17 +14,6 @@ local activeTweens = {} -- list of tweens
-- But if we animate the SAME property, we have a conflict.
-- For now, let's just add task.cancel(target) which kills ALL tweens for that target.
--- Внутренний хелпер для интерполяции (числа или Vec3)
local function lerp(a, b, t)
if type(a) == "number" then
return a + (b - a) * t
elseif type(a) == "table" and getmetatable(a) then
-- Предполагаем, что это Vec3 или другой объект с операторами +, -, *
return a + (b - a) * t
end
return b
end
--- Обновление всех активных анимаций (твинов).
--- Нужно вызывать в love.update(dt)
function task.update(dt)