spine换肤
作者:互联网
const component = this.spineNode.getComponent(sp.Skeleton);
const slot = component.findSlot('right-hand-item2');
const region = new sp.spine.TextureAtlasRegion();
region.width = texture.width;
region.height = texture.height;
region.originalWidth = texture.width;
region.originalHeight = texture.height;
region.rotate = false;
region.u = 0;
region.v = 0;
region.u2 = 1;
region.v2 = 1;
region.x = 0;
region.y = 0;
//非mesh插槽;
const attachment = new sp.spine.RegionAttachment('11');
attachment.path = '11';
attachment.width = region.width;
attachment.height = region.height;
attachment.rotation = 90;
region.texture = {
_image:{width:texture.width,height:texture.height},
_texture:texture
};
attachment.setRegion(region);
slot.setAttachment(attachment);
attachment.updateOffset();
});
标签:换肤,const,spine,region,texture,height,width,attachment 来源: https://www.cnblogs.com/JackerCao/p/14709790.html