I have this svg composition:
<svg width="400" height="200">
<circle id="circle-1" cx="50" cy="100" r="40"></circle>
<circle id="circle-2" cx="150" cy="100" r="40"></circle>
</svg>
I would like to apply filter: saturate(0.2) to the second circle but the CSS filter property is not working.
In SVG elements we have to use SVG Color Matrix Transformations.
For the specific case we have to do:
<svg width="400" height="200">
<filter id="saturate" filterUnits="objectBoundingBox">
<feColorMatrix type="saturate" in="SourceGraphic" values="0.2"/>
</filter>
<circle id="circle-1" cx="50" cy="100" r="40" ></circle>
<circle id="circle-2" cx="250" cy="100" r="40" filter="url(#saturate)"></circle>
</svg>
Working example: https://jsfiddle.net/fguillen/dx947a36/19/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With