我正在撞墙。我无法在pixijs中渲染简单的圆圈。任何治疗都受到赞赏吗?
Playgroud链接-https://pixiplayground.com/#/edit/eE~VcTxQSEi_I_DZk6Agz
已解决:
var gr = new PIXI.Graphics();
gr.beginFill(0xFFFFFF);
gr.lineStyle(0);
gr.drawCircle(30, 30, 30);
gr.endFill();
var texture = app.renderer.generateTexture(gr);
var circle = new PIXI.Sprite(texture);
app.stage.addChild(circle);
答案 0 :(得分:0)
如果您只是想绘制一个圆,这就是您所需要的:
var app = new PIXI.Application({
width: window.innerWidth,
height: window.innerHeight,
backgroundColor: 0x2c3e50
});
document.body.appendChild(app.view);
const gr = new PIXI.Graphics();
gr.beginFill(0xffffff);
gr.drawCircle(30, 30, 30);
gr.endFill();
app.stage.addChild(gr)
这是一个有效的示例:https://www.pixiplayground.com/#/edit/5_EeuD2_YmdV8oleXRZ2P