skeleton:updateState()¶
Type:
functionSee also: skeleton, skeleton:draw()
Overview¶
Advances the skeleton’s animation state by deltaTime milliseconds, applying all active animation tracks to the skeleton. Typically followed by skeleton:draw().
It also steps the skeleton’s physics constraints by deltaTime (scaled by skeleton.physicsTimeScale) and poses the
skeleton, so bone and slot world values, skeleton:getBounds() and skeleton:getSize() are current as soon as it returns,
even when skeleton:draw() is not called. Physics steps once per updateState call: calling it several times per frame
steps physics several times, and a frame without updateState leaves physics where it was. Animation events are
dispatched from updateState (see spineEvent).
Syntax¶
skeleton:updateState(deltaTime)
Parameters¶
deltaTime(required):number– Time elapsed in milliseconds since last update.
Example¶
local lastTime = system.getTimer()
local function onEnterFrame(event)
local now = system.getTimer()
local dt = now - lastTime
lastTime = now
spineboy:updateState(dt)
spineboy:draw()
end
Runtime:addEventListener("enterFrame", onEnterFrame)