SVGFESpotLightElement: limitingConeAngle 属性
SVGFESpotLightElement 接口的只读属性 limitingConeAngle 反映了给定 <feSpotLight> 元素的 limitingConeAngle 属性。
值
一个 SVGAnimatedNumber 对象。
示例
访问 <feSpotLight> 元素的 limitingConeAngle 属性
在此示例中,我们通过使用 SVGFESpotLightElement 接口的只读属性 limitingConeAngle 来访问聚光灯轴(即光源与它指向的点之间的轴)与聚光灯锥之间的角度(以度为单位)。
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="lime"
surfaceScale="5">
<feSpotLight
x="100"
y="100"
z="50"
pointsAtX="100"
pointsAtY="100"
limitingConeAngle="30"
specularExponent="40" />
</feSpecularLighting>
</filter>
</defs>
<!-- A circle to display the effect of the lighting -->
<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 limitingConeAngle property
console.log(spotLightElement.limitingConeAngle.baseVal); // Output: 30
规范
| 规范 |
|---|
| 滤镜效果模块第 1 级 # dom-svgfespotlightelement-limitingconeangle |
浏览器兼容性
加载中…