Hello, i'm new at Spine, i created a animation for my game, but i hard to control animation.
Here i my weird animation:
Here i my hopefull display: (GIF, i export from spine, but i dont why it not repeat)
Code used to play and stop animation, i copied from Spine example
local function playAnim(event)
local currentTime = event.time / 1000
local delta = currentTime - _lastTime
_lastTime = currentTime
local skeleton = M.skeleton;
local state = M.state;
state:update(delta)
state:apply(skeleton)
skeleton:updateWorldTransform();
end;
function M.roll(point)
M.tops = ResultDb.getResult(point);
Runtime:addEventListener("enterFrame", playAnim);
end;
local function onRollComplete(trackIndex, event)
updateResourceName();
Runtime:removeEventListener("enterFrame", playAnim);
end;
function M.load()
local spineData = Skeleton.load("res/game/dice/skeleton", centerX + 120, centerY - 200, 0.5, "shake");
M.skeleton = spineData.skeleton;
M.state = spineData.state;
---
End roll event
M.state.onEvent = onRollComplete;
M.skeleton.group.rotation = 175;
end;
Here is images about frame 0, 30, 40
If i use setAnimationByName with loop = false, it's alway show last frame and dont play animation.
If i use setAnimationByName with loop = true, it's display like weird.... and i dont know how to stop at last frame to show dice result.
If i call Runtime:removeEventListener("enterFrame", playAnim); with loop = true, it turn to frame 0 in the end animation
Anyone can give me some advice... i tried to search all day but i can't improve my animation