I'd like to apply destination-out compositing to my SVG so that one shape can "erase" other, existing shapes. According to what I've read on the documentation for the <feComposition>
SVG element, this should work, but it doesn't produce the desired result. I am attempting to use the in="BackgroundImage"
attribute to apply my filter to everything in the SVG document that occurs before the filter is used.
<svg viewBox="0 0 100 100">
<filter id="destination-out">
<feComposite in="BackgroundImage" operator="out" />
</filter>
<polyline points="0,25 100,25" stroke="black" />
<polyline points="0,50 100,50" stroke="black" />
<polyline points="0,20 100,60" stroke="black" filter="url(#destination-out)" />
</svg>
Here's a jsBin showing what this code produces. I would like the third, diagonal <polyline>
to not be visible at all; instead I want it to "erase" the places where it intersects the first two <polyline>
s.
Legacy browser support is not important for my purposes; this just needs to work in the latest version of Chrome.