I have a simple idle and run animation for my character and I have it working where when the character is not moving he displays the idle animation, and when he is moving he displays the run animation. My problem is that it doesn't fade (interpolate) between these animations, it just jumps from idle to running. Here is my current code:
local skeletonData = json:readSkeletonDataFile("examples/spineboy/skeleton.json") local skeleton = spine.Skeleton.new(skeletonData) local stateData = spine.AnimationStateData.new(skeletonData) stateData:setMix("idle", "run", 0.2) stateData:setMix("run", "idle", 0.4) local state = spine.AnimationState.new(stateData) state:setAnimationByName(0, "idle", true, 0) local state2 = spine.AnimationState.new(stateData) state2:setAnimationByName(0, "run", true, 0) local function enterFrame( event ) if ( vx == 0 ) then --If the player's velocity is equal to 0... state:apply(skeleton) elseif ( vx ~= 0 ) then -- if the player's velocity doesn't equal 0... state2:apply(skeleton) end end
Is there a better way to handle animations? I looked at the examples on GitHub and the Spineboy example was the only one that showed multiple animations being played, but they didn't show any interpolating. I also looked at their documentation and the functions they show that are supposed to utilize interpolating don't seem to work in Corona. Does anyone have any ideas or examples? Any help is appreciated!