Add detailed comments to AnimationNode explaining its behavior and usage

example
This commit is contained in:
PeaAshMeter 2025-10-23 19:21:06 +03:00
parent f790a4dcf8
commit 70d1d72b83

View File

@ -1,6 +1,26 @@
--- @alias voidCallback fun(): nil --- @alias voidCallback fun(): nil
--- @alias animationRunner fun(node: AnimationNode) --- @alias animationRunner fun(node: AnimationNode)
--- Узел дерева анимаций.
---
--- Отслеживает завершение всех анимаций всех дочерних узлов и оповещает вышестоящий узел.
---
--- Дочерние узлы одного уровня запускают свою анимацию одновременно после завершения анимации родителя.
--- Example:
--- ```lua
--- AnimationNode {
--- function (node) residentsleeper:sleep(1000, node) end, -- must pass itself down as the parameter
--- onEnd = function() print("completed") end,
--- children = { -- children run in parallel after the parent animation is completed
--- AnimationNode {
--- function (node) sprite:animate("attack", node) end
--- },
--- AnimationNode {
--- function (node) other_sprite:animate("hurt", node) end
--- },
--- }
--- }:run()
--- ```
--- @class AnimationNode --- @class AnimationNode
--- @field count integer --- @field count integer
--- @field run animationRunner --- @field run animationRunner