你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
Monica - 知识达人
赞同来自:
liqunyang
// test drawToCanvas const sp1 = new Sprite(); sp1.loadImage('bet/cheer_1_3.png'); const sp2 = new Sprite(); sp2.x = 100; sp2.loadImage('bet/cheer_1_4.png'); sp1.addChild(sp2); this.addChild(sp1); const htmlCanvas = sp1.drawToCanvas(640, 200, 0, 0); const canvas = htmlCanvas.getCanvas(); trace(canvas.toDataURL('image/png')); const texture = new Laya.Texture(htmlCanvas); const sp = new Sprite(); sp.graphics.drawTexture(texture); this.shot.addChild(sp);
const sp1 = new Laya.Image(); sp1.skin = 'bet/cheer_1_3.png'; this.addChild(sp1); const htmlCanvas = sp1.drawToCanvas(640, 200, 0, 0); const canvas = htmlCanvas.getCanvas(); trace(canvas.toDataURL('image/png')); const texture = new Laya.Texture(htmlCanvas); const sp = new Sprite(); sp.graphics.drawTexture(texture); this.shot.addChild(sp);
要回复问题请先登录
2 个回复
Monica - 知识达人
赞同来自:
liqunyang
赞同来自:
这里还有一个问题:
为什么我这里sp1是Image类,无法截图。