SVG: Mask not working as expected -
i have rather basic svg vertical line going through 4 circles. mask have vertical line has same definition line itself, difference being stroke color (#fff in case) because want able see through mask. but, unknown reasons, mask still acts if color black, hiding element. if knows why it's behaving this, please let me know.
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 400 400"> <defs> <mask id="education"> <path class="through" fill="none" stroke="#fff" stroke-width="2" stroke-miterlimit="10" d="m200 325.6v42.5m200 325.6v44.2"/> </mask> </defs> <path class="arrow" fill="#c57773" d="m191.9 41.5l8.1-14 8.1 14"/> <path style="mask: url(#education);" class="through" fill="none" stroke="#58595b" stroke-width="2" stroke-miterlimit="10" d="m200 325.6v42.5m200 325.6v44.2"/> <path class="circle2" fill="#c95147" d="m200 234.7c-4.6 0-8.3 3.7-8.3 8.3s3.7 8.3 8.3 8.3c4.6 0 8.3-3.7 8.3-8.3s-3.7-8.3-8.3-8.3z"/> <path class="circle1" fill="#c95147" d="m200 317.2c-4.6 0-8.3 3.7-8.3 8.3s3.7 8.3 8.3 8.3c4.6 0 8.3-3.7 8.3-8.3s-3.7-8.3-8.3-8.3z"/> <path class="circle3" fill="#c95147" d="m200 152c-4.6 0-8.3 3.7-8.3 8.3 0 4.6 3.7 8.3 8.3 8.3 4.6 0 8.3-3.7 8.3-8.3 0-4.5-3.7-8.3-8.3-8.3z"/> <path class="circle4" fill="#c95147" d="m200 67.1c-4.6 0-8.3 3.7-8.3 8.3s3.7 8.3 8.3 8.3c4.6 0 8.3-3.7 8.3-8.3s-3.7-8.3-8.3-8.3z"/> </svg>
p.s. started tinkering around svg, (the element dissapearing) happens no matter shape define in mask or color give shape.
svg not css, doesn't use stroke-width when calculating dimensions masks , filters, can't mask shape horizontal or vertical line (zero-height/zero-width bounding box) using default mask parameters. add "maskunits="userspaceonuse" mask element fix.
<mask id="education" maskunits="userspaceonuse">
Comments
Post a Comment