This example shows Spine bone animation that blends when animation switches.
spine.script
function init(self)
msg.post(".", "acquire_input_focus")
self.state = "idle"
end
function on_input(self, action_id, action)
if action_id == hash("click") and action.pressed then
local properties = { blend_duration = 0.3 }
if self.state == "idle" then
spine.play_anim("#spinemodel", hash("run"), go.PLAYBACK_LOOP_FORWARD, properties)
label.set_text("#label", "Click to idle...")
self.state = "run"
elseif self.state == "run" then
spine.play_anim("#spinemodel", hash("idle"), go.PLAYBACK_LOOP_FORWARD, properties)
label.set_text("#label", "Click to run...")
self.state = "idle"
end
end
end
If you want to play with these examples, you can get the project on Github.
Do you want to see more examples? Why not write a few yourself and submit a pull request? We love contributions.