【发布时间】:2014-10-27 01:51:30
【问题描述】:
我想创建在黑暗中发光的错觉,在示例中,我有两个相互叠加的矩形蒙版,但正如您所见,存在 alpha 混合问题。有没有办法将 2 个蒙版矩形合并在一起?
将鼠标悬停在 codepen 链接上的窗口上以了解我的意思。
<svg width="976" height="549" xmlns="http://www.w3.org/2000/svg">
<defs>
<radialGradient id="lightsource">
<stop offset="0%" stop-color="black" />
<stop offset="50%" stop-color="black" />
<stop offset="100%" stop-color="white" />
</radialGradient>
<mask id="mask1" x="0" y="0" width="976" height="549">
<rect x="0" y="0" width="976" height="549" fill="white" />
<ellipse ry="60" rx="64" id="svg_1" cy="122.5" cx="101.5" stroke-width="none" fill="url(#lightsource)"/>
<ellipse ry="60" rx="64" id="svg_2" cy="175.5" cx="216" stroke-width="none" fill="url(#lightsource)"/>
</mask>
</defs>
<g>
<rect x="0" y="0" id="cool" width="976" height="549" mask="url(#mask1)" fill="black" />
</g>
</svg>
【问题讨论】:
标签: jquery html svg svg-filters