Subtract one circle from another in SVG

前端 未结 4 1901
自闭症患者
自闭症患者 2021-02-01 14:12

I\'m trying to find a way to subtract one shape from another in SVG, creating a hole in the middle or a bite out of the side of it. Kind of like a clipping path, but instead of

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-01 14:50

    A mask is what you want. To create a , make things you want to keep white. The things you want to be invisible make black. Colours in between will result in translucency.

    So the resulting SVG is similar to your pseudo-markup and looks like this:

    We are filling the mask with a white rectangle, and then we put a black circle where we want the hole to be.

提交回复
热议问题