SVGFEDropShadowElement: dy 属性
SVGFEDropShadowElement
接口的只读属性 dy
反映了给定 <feDropShadow>
元素的 dy
属性。
值
一个 SVGAnimatedNumber
对象。
示例
访问 dy
值
在此示例中,我们通过使用 SVGFEDropShadowElement
接口的只读属性 dx
来检索 <feDropShadow>
的垂直偏移量。
html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="drop-shadow-filter">
<!-- Drop Shadow with dy property set to 10 -->
<feDropShadow
in="SourceGraphic"
dx="10"
dy="10"
stdDeviation="5"
flood-color="red" />
</filter>
</defs>
<!-- Rectangle with a red shadow -->
<rect
x="20"
y="20"
width="100"
height="100"
fill="red"
filter="url(#drop-shadow-filter)" />
<!-- Circle with a red shadow -->
<circle
cx="100"
cy="100"
r="50"
fill="blue"
filter="url(#drop-shadow-filter)" />
</svg>
js
const dropShadow = document.querySelector("feDropShadow");
console.log(dropShadow.dy.baseVal); // Output: 10
规范
规范 |
---|
滤镜效果模块第 1 级 # dom-svgfedropshadowelement-dy |
浏览器兼容性
加载中…