I have a simple spine animation for the gui.
I want to play it back and forth but problem is that when after using PLAYBACK_ONCE_BACKWARD twice the spine animation immediately shows the last frame of the animation and calls the callback function without animating.
function on_input(self, action_id, action)
if action_id == hash("space") and action.pressed == true then
gui.play_spine_anim(self.spine, hash("clouds_enter"), gui.PLAYBACK_ONCE_BACKWARD, {}, function()
print("done")
end)
end
end
In short, when pressing space, the above code will animate it correct twice (!) but then it will immediately be on the last frame and print done as soon as I press space instead of animating first. Weird huh?
I have setup a test project for anyone who would like to take a look at it.
edit: Found the error, will continue to work on a fix for this. In the meantime here is a workaround, put this line right after your call to gui.play_spine_anim:
gui.set_spine_cursor(self.spine, 1.0)
(It will force the cursor to the “correct” location, which otherwise at the third run seems to default to 0.)