其他分享
首页 > 其他分享> > pixijs Graphics 透明为0 截图的方法

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 截图的方法

标签:截图,app,graphics,PIXI,Graphics,var,circle,pixijs,bunny1
来源: https://www.cnblogs.com/newmiracle/p/14096058.html