SVGFESpotLightElement: specularExponent 属性
SVGFESpotLightElement 接口的只读属性 specularExponent 反映了给定 <feSpotLight> 元素的 specularExponent 属性。
值
一个 SVGAnimatedNumber 对象。
示例
访问 <feSpotLight> 元素的 specularExponent 属性
在此示例中,我们通过使用 SVGFESpotLightElement 接口的只读属性 specularExponent 来访问控制 <feSpotLight> 滤镜元素的光源焦点的指数值。
html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="specularLightingFilter">
<!-- Apply a specular light effect to the SourceGraphic -->
<feSpecularLighting
in="SourceGraphic"
specularExponent="40"
lighting-color="hotpink"
surfaceScale="5">
<feSpotLight
x="100"
y="100"
z="50"
pointsAtX="100"
pointsAtY="100"
specularExponent="40" />
</feSpecularLighting>
</filter>
</defs>
<circle
cx="100"
cy="100"
r="50"
fill="lightblue"
filter="url(#specularLightingFilter)" />
</svg>
js
// Select the feSpotLight element
const spotLightElement = document.querySelector("feSpotLight");
// Access the specularExponent property
console.log(spotLightElement.specularExponent.baseVal); // Output: 40
规范
| 规范 |
|---|
| 滤镜效果模块第 1 级 # dom-svgfespotlightelement-specularexponent |
浏览器兼容性
加载中…