2

我正在使用 Spark:Path 在 Flex 中绘制路径。

我想从这条路径中减去一个圆形,如下图所示:

在此处输入图像描述

(小路又黑又宽)

有任何想法吗?

我尝试使用 Shape 对象创建蒙版,但无法完全创建具有圆孔的蒙版。

4

2 回答 2

8

找到了。

不涉及口罩。

我拿起Path并包裹了Group它:

<s:Group blendMode="layer">
    <s:Path id="connector" ... />
    <s:Ellipse id="hole" blendMode="erase">

我将其设置为“图层”,并在使用 blendMode 的路径blendMode添加了一个椭圆erase

于 2012-04-05T14:18:12.800 回答
2

您不需要为此使用掩码,只需使用curveTo()Graphics 类的方法:

var shape1:Shape = new Shape();
shape1.graphics.beginFill(0x000000);
shape1.graphics.moveTo(0,0);
shape1.graphics.lineTo(80,0);
shape1.graphics.curveTo(110,30,140,0);
shape1.graphics.lineTo(300,0);
shape1.graphics.lineTo(300,20);
shape1.graphics.lineTo(0,20);
shape1.graphics.lineTo(0,0);
shape1.graphics.endFill();

这给了你:

在此处输入图像描述

这显然不是使用您的确切尺寸,而是演示了原理。

于 2012-04-05T13:58:08.317 回答