clip path - SVG clipPath showing black background with transparent fill -
for svg path having fill="transparent"
, expected not shown anyway.
<path d="m 0 40 l 200 40 l 200 70 l 0 70 l 0 40 z" fill="transparent" fill-opacity="1" stroke="none"></path>
it works if doesn't have clip-path show above, or have single clip-path.
but when has clip-path clip-path, show black background, not ideal case.
here's svg:
<svg width="1000" height="800"> <path id="rect" d="m 0 40 l 200 40 l 200 70 l 0 70 l 0 40 z" fill="transparent" fill-opacity="1" stroke="none" clip-path="url(#zr-clip-2)"></path> <defs> <clippath id="zr-clip-2" clip-path="url(#zr-clip-1)"> <path d="m 30 10 l 50 10 l 50 180 l 30 180 l 30 10 z" fill="#ff0" fill-opacity="1" stroke="none"></path> </clippath> <clippath id="zr-clip-1"> <path d="m 40 50 l 60 50 l 60 75 l 40 75 l 40 50 z" fill="#0f0"></path> </clippath> </defs> </svg>
i want path id="rect"
clip intersection of zr-clip-1
, zr-clip-2
when fill not transparent, , show nothing when it's transparent.
but instead, shows black background , it's not same size when fill red:
<svg width="1000" height="800"> <path d="m 0 40 l 200 40 l 200 70 l 0 70 l 0 40 z" fill="transparent" fill-opacity="1" stroke="none" clip-path="url(#zr-clip-2)"></path> <path d="m 0 40 l 200 40 l 200 70 l 0 70 l 0 40 z" fill="red" fill-opacity="1" stroke="none" clip-path="url(#zr-clip-2)"></path> <defs> <clippath id="zr-clip-2" clip-path="url(#zr-clip-1)"> <path d="m 30 10 l 50 10 l 50 180 l 30 180 l 30 10 z" fill="#ff0" fill-opacity="1" stroke="none"></path> </clippath> <clippath id="zr-clip-1"> <path d="m 40 50 l 60 50 l 60 75 l 40 75 l 40 50 z" fill="#0f0"></path> </clippath> </defs> </svg>
this seems chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=659790
for time, may set fill=rgba(0, 0, 0, 0.002)
hide element.
Comments
Post a Comment