[LayaAir 2.0]spine动画放大后,遮罩显示不正常
项目中部分spine动画在缩放后设置遮罩,动画角色会显示不全,如下图,左边设置了遮罩,右边未设置遮罩
详细设置见下图代码和附件DEMO中的TestScene.scene文件
export default class GameUI extends Laya.Scene {
constructor() {
super();
//设置单例的引用方式,方便其他类引用
GameUI.instance = this;
//关闭多点触控,否则就无敌了
Laya.MouseManager.multiTouchEnabled = false;
//加载场景文件
this.loadScene("test/TestScene.scene");
}
onEnable() {
this.loadActor(this.actor1,"comp/r_01_01.sk");
this.loadActor(this.actor2,"comp/r_01_01.sk");
}
loadActor(parent,path){
const
Templet = Laya.Templet,
Event = Laya.Event;
let mFactory = new Templet();
mFactory.on(Event.COMPLETE, this, this.parseComplete,[parent,mFactory]);
mFactory.on(Event.ERROR, this, this.onError);
mFactory.loadAni(path);
}
onError() {
trace("error");
}
parseComplete(parent,mFactory) {
// 创建模式为1,使用动画自己的缓冲区,可以启用换装(相当耗费内存)
let mArmature = mFactory.buildArmature(1);
parent.addChild(mArmature);
mArmature.pos(parent.x+parent.width/2, parent.y+parent.height/2);
mArmature.scale(3, 3);
mArmature.on(Laya.Event.STOPPED, this, this.completeHandler);
mArmature.play(1, true);
}
completeHandler() {
}
}
详细设置见下图代码和附件DEMO中的TestScene.scene文件
export default class GameUI extends Laya.Scene {
constructor() {
super();
//设置单例的引用方式,方便其他类引用
GameUI.instance = this;
//关闭多点触控,否则就无敌了
Laya.MouseManager.multiTouchEnabled = false;
//加载场景文件
this.loadScene("test/TestScene.scene");
}
onEnable() {
this.loadActor(this.actor1,"comp/r_01_01.sk");
this.loadActor(this.actor2,"comp/r_01_01.sk");
}
loadActor(parent,path){
const
Templet = Laya.Templet,
Event = Laya.Event;
let mFactory = new Templet();
mFactory.on(Event.COMPLETE, this, this.parseComplete,[parent,mFactory]);
mFactory.on(Event.ERROR, this, this.onError);
mFactory.loadAni(path);
}
onError() {
trace("error");
}
parseComplete(parent,mFactory) {
// 创建模式为1,使用动画自己的缓冲区,可以启用换装(相当耗费内存)
let mArmature = mFactory.buildArmature(1);
parent.addChild(mArmature);
mArmature.pos(parent.x+parent.width/2, parent.y+parent.height/2);
mArmature.scale(3, 3);
mArmature.on(Laya.Event.STOPPED, this, this.completeHandler);
mArmature.play(1, true);
}
completeHandler() {
}
}
要回复问题请先登录
1 个回复
YUIL
赞同来自: