SVGFESpotLightElement: pointsAtX 属性
SVGFESpotLightElement
接口的只读属性 pointsAtX
反映了给定 <feSpotLight>
元素的 pointsAtX
属性。
值
一个 SVGAnimatedNumber
对象。
示例
访问 <feSpotLight>
元素的 pointsAtX
属性
在此示例中,我们使用 SVGFESpotLightElement
接口的只读属性 pointsAtX
来访问 SVG 坐标系统中 <feSpotLight>
元素的 x
位置。
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="20"
lighting-color="hotpink"
surfaceScale="30">
<feSpotLight
x="10"
y="50"
z="150"
pointsAtX="150"
pointsAtY="100"
pointsAtZ="0"
specularExponent="20" />
</feSpecularLighting>
</filter>
</defs>
<!-- A circle to display the effect of the lighting -->
<circle cx="100" cy="100" r="50" filter="url(#specularLightingFilter)" />
</svg>
js
// Select the feSpotLight element
const spotLightElement = document.querySelector("feSpotLight");
console.log(spotLightElement.pointsAtX.baseVal); // Output: 150
规范
规范 |
---|
滤镜效果模块第 1 级 # dom-svgfespotlightelement-pointsatx |
浏览器兼容性
加载中…