admin管理员组文章数量:1399754
I want to create a faux extrusion effect by stacking multiple feOffset
in my filter.
Is this possible?
Something like:
<svg height="150" width="150" xmlns="">
<defs>
<filter id="f1" width="120" height="120">
<feOffset in="SourceAlpha" dx="10" dy="10" />
<feBlend in="SourceGraphic" in2="offOut" />
<feOffset in="SourceAlpha" dx="20" dy="20" />
<feBlend in="SourceGraphic" in2="offOut" />
</filter>
</defs>
<rect width="90" height="90" fill="yellow" filter="url(#f1)" />
</svg>
I want to create a faux extrusion effect by stacking multiple feOffset
in my filter.
Is this possible?
Something like:
<svg height="150" width="150" xmlns="http://www.w3./2000/svg">
<defs>
<filter id="f1" width="120" height="120">
<feOffset in="SourceAlpha" dx="10" dy="10" />
<feBlend in="SourceGraphic" in2="offOut" />
<feOffset in="SourceAlpha" dx="20" dy="20" />
<feBlend in="SourceGraphic" in2="offOut" />
</filter>
</defs>
<rect width="90" height="90" fill="yellow" filter="url(#f1)" />
</svg>
Share
Improve this question
asked Mar 26 at 3:19
user500665user500665
1,3801 gold badge13 silver badges45 bronze badges
2
|
1 Answer
Reset to default 0Yes it's possible - multiple ways of doing it. The most straightforward is to do multiple offsets, label each one with a result and then use a feMerge to condense them. (The code that you have won't retain the result of the first offset, it will be discarded. You have to label something with a result= if you want to use it as an input to anything other than the next primitive.)
<svg height="150" width="150" xmlns="http://www.w3./2000/svg">
<defs>
<filter id="f1" width="120" height="120">
<feOffset in="SourceAlpha" dx="10" dy="10" result="off1" />
<feOffset dx="10" dy="10" result="off2"/>
<feOffset dx="10" dy="10" result="off3"/>
<feMerge>
<feMergeNode in="SourceGraphic"/>
<feMergeNode in="off1"/>
<feMergeNode in="off2"/>
<feMergeNode in="off3"/>
</feMerge>
</filter>
</defs>
<rect width="90" height="90" fill="yellow" filter="url(#f1)" />
</svg>
本文标签: How can I add multiple feOffset shadows in an SVG filterStack Overflow
版权声明:本文标题:How can I add multiple feOffset shadows in an SVG filter? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744166921a2593590.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
feMerge
is what I was after. Maybe add that as an answer? – user500665 Commented Mar 27 at 20:16