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).
Spine model properties
Apart from the properties Id, Position and Rotation the following component specific properties exist:
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.
Material
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.
Skin
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:
Blend modes
The Blend Mode property defines how the component graphics should be blended with the graphics behind it. These are the available blend modes and how they are calculated:
The animation playback cursor can be animated either by hand or through the property animation system:
-- set the run animationspine.play_anim("#spinemodel","run",go.PLAYBACK_NONE)-- animate the cursorgo.animate("#spinemodel","cursor",go.PLAYBACK_LOOP_PINGPONG,1,go.EASING_LINEAR,10)
Changing properties
A spine model also has a number of different properties that can be manipulated using go.get() and go.set():
animation
The current model animation (hash) (READ ONLY). You change animation using spine.play_anim() (see above).
cursor
The normalized animation cursor (number).
material
The spine model material (hash). You can change this using a material resource property and go.set(). Refer to the API reference for an example.
The color tint of the spine model (vector4). The vector4 is used to represent the tint with x, y, z, and w corresponding to the red, green, blue and alpha tint.
Project configuration
The game.project file has a few project settings related to spine models.