【发布时间】:2017-09-05 03:10:43
【问题描述】:
我正在尝试将point light effect 添加到SVG 矩形。问题是我得到了不同的结果,具体取决于我使用的浏览器。例如,在 Chrome 和 Safari 中,我得到了以下信息:
如何在不同浏览器上使用 svg 过滤器获得一致的结果?
*, *:before, *:after {
box-sizing: border-box;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.css" rel="stylesheet"/>
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<filter id="customPointLight">
<feSpecularLighting result="lightBuffer" specularConstant="1.5"
specularExponent="80" lighting-color="#fff">
<fePointLight x="100" y="100" z="80"/>
</feSpecularLighting>
<feComposite in="SourceGraphic" in2="lightBuffer" operator="out"
k1="0" k2="1" k3="1" k4="0"/>
</filter>
</defs>
<rect x="50" y="50" width="100" height="100" fill="blue" filter="url(#customPointLight)"></rect>
</svg>
【问题讨论】:
标签: svg lighting svg-filters