[0]drawToTexture截大图有问题,会丢失
private nsp:Laya.Sprite;
init(): void {
this.nsp=new Laya.Sprite();
this.nsp.graphics.drawRect(0,0,1600,1600,"#ff0000");
this.nsp.mouseThrough=true;
Laya.stage.addChild(this.nsp);
this.nsp.on(Laya.Event.CLICK,this,this.drawImg,null)
}
drawImg(e:Event=null):void{
var copySpr:Laya.Sprite=new Laya.Sprite();
copySpr.texture=this.nsp.drawToTexture(1600,1600,0,0) as Laya.Texture;
this.nsp.removeSelf();
copySpr.scale(.1,.1);
Laya.stage.addChild(copySpr);
}
init(): void {
this.nsp=new Laya.Sprite();
this.nsp.graphics.drawRect(0,0,1600,1600,"#ff0000");
this.nsp.mouseThrough=true;
Laya.stage.addChild(this.nsp);
this.nsp.on(Laya.Event.CLICK,this,this.drawImg,null)
}
drawImg(e:Event=null):void{
var copySpr:Laya.Sprite=new Laya.Sprite();
copySpr.texture=this.nsp.drawToTexture(1600,1600,0,0) as Laya.Texture;
this.nsp.removeSelf();
copySpr.scale(.1,.1);
Laya.stage.addChild(copySpr);
}
要回复问题请先登录
3 个回复
Yan
赞同来自:
弓长
赞同来自:
弓长
赞同来自: