SVG内发光实现

编程入门 行业动态 更新时间:2024-10-22 17:17:00

<a href=https://www.elefans.com/category/jswz/34/1769128.html style=SVG内发光实现"/>

SVG内发光实现

百度了好久都没找到,最后谷歌在外网找到的一个关于SVG内发光实现(svg inset shadow)

<svg width="600" height="600"><filter id="inset-shadow" x="-50%" y="-50%" width="200%" height="200%"><feComponentTransfer in=SourceAlpha><feFuncA type="table" tableValues="1 0" /></feComponentTransfer><feGaussianBlur stdDeviation="4"/><feOffset dx="0" dy="1" result="offsetblur"/><feFlood flood-color="#0d619d" result="color"/><feComposite in2="offsetblur" operator="in"/><feComposite in2="SourceAlpha" operator="in" /><feMerge><feMergeNode in="SourceGraphic" /><feMergeNode /></feMerge></filter><rect x=100 y=100 width=20% height=50% fill=#0a112b filter="url(#inset-shadow)" />
</svg>

实现的效果差不多就是这个样子 

 

更新:

实现任意SVG元素内发光效果

<filter id="inset-shadow"><feFlood flood-color="red" /><feComposite in2="SourceGraphic" operator="out" /><feGaussianBlur stdDeviation="3" result="blur" /><feComposite operator="atop" in2="SourceGraphic"/>
</filter>
<text x="100" y="250" font-size="80" font-weight="bold" fill="#0000ff" filter="url(#inset-shadow)">INSET SHADOW</text>

实现的效果如下图:

更多推荐

SVG内发光实现

本文发布于:2024-03-06 01:49:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1714039.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:SVG

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!