Import lerp from utils module and remove duplicate function definition

This commit is contained in:
PeaAshMeter 2026-02-08 06:20:22 +03:00
parent 7695fe7698
commit 163906c289

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)