pixijs Graphics 透明为0 截图的方法
const app = new PIXI.Application(); document.body.appendChild(app.view); var imgURL = "/moban/images/share.jpg"; //加载图像,加载完成后执行setup函数 PIXI.loader.add(imgURL).load(setup); function setup() { // var bunny1 = PIXI.Sprite.from('/moban/images/share.jpg'); // // bunny1.width = 330; // // bunny1.height = 360; // bunny1.name = 'sharejpg'; // bunny1.x = 192; // bunny1.y = 22; // app.stage.addChild(bunny1); // bunny1.alpha=0; const graphics = new PIXI.Graphics(); // Rectangle graphics.beginFill(0xDE3249); graphics.drawRect(50, 50, 100, 100); graphics.endFill(); // app.stage.addChild(graphics); //需要转化成精灵 var txture = app.renderer.generateTexture(graphics); var circle = new PIXI.Sprite(txture); // circle.anchor.set(0.5); circle.x=50; circle.y=50; app.stage.addChild(circle); circle.alpha=0; var huayuanbas64 = app.renderer.extract.base64(circle); // addbunny(huayuanbas64, 100, 150, 150, 99999); console.log(huayuanbas64); }
pixijs Graphics 截图的方法
如果遇到什么不懂的地方直接关注公众号留言(本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利。)
作者:newmiracle
出处:https://www.cnblogs.com/newmiracle/