嘿!能帮帮我吗,我在把自定义Path渲染成RenderTexture时遇到了一些麻烦
如何用颜色填充路径??
我已经为我的问题准备了沙箱示例:https://stackblitz.com/edit/set-bounce-phaser-3-so-ixfkeq这里是代码示例:
function create() {
this.add.image(400, 300, 'sky');
graphics = new Phaser.GameObjects.Graphics(this);
graphics.lineStyle(4, 0x00ff00);
graphics.fillStyle(0x00ff00); // how to fill it??
rt = this.add.renderTexture(100, 100, 100, 100).setOrigin(0.5);
var circle = this.add
.circle(0, 0, 50, 0xff7e00)
.setAlpha(0.8)
.setVisible(false);
rt.draw(circle, 50, 50);
// This is just example, I need complex path with curves
const path = new Phaser.Curves.Path(); // how to fill it??
path.lineTo(50, 0);
path.lineTo(50, 50);
path.lineTo(0, 50);
path.closePath();
path.draw(graphics);
rt.draw(graphics, 25, 25);
}有了这段代码,我可以看到满是圆圈,只有笔画的路径。

我错过了什么?
发布于 2021-09-25 10:40:27
找到答案了!
graphics.fillPoints(path.getPoints())https://stackoverflow.com/questions/69316380
复制相似问题