Spine Skeleton Alpha

I want to fade in my Spine animation but I don’t know how to set/access the Spine skeletons alpha in code. Does anyone know?

Related to this topic: https://forum.playcanvas.com/t/spine-skeleton-color/19392

Thanks

You can get the same materials and change the opacity value on the material:

var spineData = this.entity.spine.data.spine;
for (var materialName in spineData._materials) {
    var spineMaterial = spineData._materials[materialName];
    
    spineMaterial.opacity = 0.5;
    
    spineMaterial.update();
}

this._time = 0;

I would have thought that we use setParameter on the mesh instances but doesn’t seem to be working in my test project :thinking:

I couldn’t get this working either. Instead I’ve made the fade in as a separate Spine animation and just play that back instead. But now I don’t know how to switch to another animation once the fade in animation is completed!??

I can get it working by changing the material opacity each frame: https://playcanvas.com/editor/scene/1134092

mesh instances are temporary only and get recreated as Spine SDK gives us new verticies (almost) each frame … and so settings parameters on the meshInstances likely has no effect, as you would be modifying mesh instances from the previous frame, that get dumped later in this frame when rendering.