Spine Model

The SpineModel component is used to bring Spine skeletal animations to life in Defold.

Creating SpineModel components

Select a game object to hold the new component:

Either create the component in-place (right click the game object and select Add Component ▸ Spine Model)

Or create it on file first (right click a location in the Assets browser, then select New... ▸ Spine Model from the context menu), then add the file to the game object by right clicking the game object and selecting Add Component File).

Set the Properties on the component:

Spine scene
Set this to the Spine scene file you created earlier.
Blend Mode
If you want a blend mode other than the default Alpha, change this property.
If you need to render the model with a custom material, change this property.
Default animation
Set this to the animation you want the model to start with.
If your model has skins, select the one you want it to start with.

You should now be able to view your Spine model in the editor:

Spine model in editor

Runtime animation

Defold provides powerful support for controlling animation in runtime:

local play_properties = { blend_duration = 0.1 }
spine.play_anim("#spinemodel", "jump", go.PLAYBACK_ONCE_FORWARD, play_properties)

The animation playback cursor can be animated either by hand or throught the property animation system:

-- set the run animation
spine.play_anim("#spinemodel", "run", go.PLAYBACK_NONE)
-- animate the cursor
go.animate("#spinemodel", "cursor", go.PLAYBACK_LOOP_PINGPONG, 1, go.EASING_LINEAR, 10)