add animation.stop

This commit is contained in:
MihailRis 2026-09-10 00:14:15 +03:00
parent 48ca3ab5f9
commit aa6ac5f5bd

View file

@ -68,13 +68,26 @@ end
local running_actions = {} local running_actions = {}
local playing_tracks = {} local playing_tracks = {}
local next_track_id = 1
function this.action(func) function this.action(func)
table.insert(running_actions, coroutine.create(func)) table.insert(running_actions, coroutine.create(func))
end end
function this.play(name, target) function this.play(name, target)
table.insert(playing_tracks, {name=name, target=target, timer=0.0}) local id = next_track_id
table.insert(playing_tracks, {id=id, name=name, target=target, timer=0.0})
next_track_id = id + 1
return id
end
function this.stop(id)
for i, entry in pairs(playing_tracks) do
if entry.id == id then
table.remove(playing_tracks, i)
return
end
end
end end
function internals.on_animation_frame() function internals.on_animation_frame()