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>
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744166921a4561344.html
feMerge
is what I was after. Maybe add that as an answer? – user500665 Commented Mar 27 at 20:16