如何用轮廓绘制形状并在AS3中填充任何内容?

时间:2022-03-16 13:33:36

How to draw shapes like rectangle, circle with only outline (fill with transparent color inside) in AS3 like this rectangle and circle

如何在AS3中绘制像矩形,圆形一样的轮廓(在内部填充透明颜色),如此矩形和圆形

1 个解决方案

#1


Use graphics.lineStyle with graphics.drawRect or graphics.drawCircle.

将graphics.lineStyle与graphics.drawRect或graphics.drawCircle一起使用。

// this means you want to draw a line on the outer edge
// 1 is thickness, and you got more options like color, etc.
graphics.lineStyle(1);
// draw rect
graphics.drawRect(x, y, width, height);
// draw circle
graphics.drawCircle(x, y, radius);

Thanks to @BotMaster for pointing out you don't need begin/end fill.

感谢@BotMaster指出你不需要开始/结束填充。

#1


Use graphics.lineStyle with graphics.drawRect or graphics.drawCircle.

将graphics.lineStyle与graphics.drawRect或graphics.drawCircle一起使用。

// this means you want to draw a line on the outer edge
// 1 is thickness, and you got more options like color, etc.
graphics.lineStyle(1);
// draw rect
graphics.drawRect(x, y, width, height);
// draw circle
graphics.drawCircle(x, y, radius);

Thanks to @BotMaster for pointing out you don't need begin/end fill.

感谢@BotMaster指出你不需要开始/结束填充。