add animation.action

This commit is contained in:
MihailRis 2026-09-01 23:01:47 +03:00
parent c19733b594
commit 39a3c1201f
6 changed files with 45 additions and 13 deletions

View file

@ -299,4 +299,27 @@ function __vc_internals.load_vca_animation(filepath, identifier)
this.load_vca(filepath, identifier)
end
local running_actions = {}
function this.action(func)
table.insert(running_actions, coroutine.create(func))
end
function __vc_internals.on_animation_frame()
for i=#running_actions,1,-1 do
local co = running_actions[i]
local status, result = coroutine.resume(co)
if not status then
debug.error("error in animation action: "..result)
table.remove(running_actions, i)
elseif coroutine.status(co) == "dead" then
table.remove(running_actions, i)
end
end
end
function __vc_internals.stop_all_actions()
running_actions = {}
end
return this