pixijs照明灯做法

pixijs照明灯做法

 

   <script src="js/pixi.min.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    const app = new PIXI.Application({ width: 750, height: 1206 });
    document.body.appendChild(app.view);


   const bgdi = PIXI.Sprite.from('https://pixijs.io/examples/examples/assets/bg_rotate.jpg');
     bgdi.width=750;
     bgdi.height=1206;
    app.stage.addChild(bgdi);

    const graphics = new PIXI.Graphics();


   graphics.beginFill(0x000000,0.6);
   graphics.drawRect(0, 0, 750, 1206);
   graphics.endFill();

app.stage.addChild(graphics);




    const bg = PIXI.Sprite.from('https://pixijs.io/examples/examples/assets/bg_rotate.jpg');
     bg.width=750;
     bg.height=1206;
     


    app.stage.addChild(bg);

      const yuan = PIXI.Sprite.from('/moban/images/yuan.png');
     yuan.width=400;
     yuan.height=400;     
     yuan.x=100;
     bg.mask=yuan;
         app.stage.addChild(yuan);
    </script>

 

上一篇:pixijs释放纹理的方法


下一篇:pixijs Graphics 透明为0 截图的方法