SVGFEDropShadowElement: stdDeviationY 屬性
SVGFEDropShadowElement 介面的只讀屬性 stdDeviationY 反映了給定 <feDropShadow> 元素的 stdDeviation 屬性的(可能是自動計算的)Y 分量。
值
一個 SVGAnimatedNumber 物件。
示例
訪問 stdDeviationY 值
在此示例中,我們透過使用 SVGFEDropShadowElement 介面的只讀屬性 stdDeviationY 來檢索 <feDropShadow> 模糊操作的垂直標準差。
html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="drop-shadow-filter">
<!-- Drop Shadow with stdDeviationY property set to 10 for vertical blur -->
<feDropShadow
in="SourceGraphic"
dx="10"
dy="10"
stdDeviation="5 10"
flood-color="gray" />
</filter>
</defs>
<!-- Rectangle with a gray shadow -->
<rect
x="50"
y="50"
width="100"
height="100"
fill="red"
filter="url(#drop-shadow-filter)" />
</svg>
js
const dropShadow = document.querySelector("feDropShadow");
console.log(dropShadow.stdDeviationY.baseVal); // Output: 10
規範
| 規範 |
|---|
| 濾鏡效果模組第 1 級 # dom-svgfedropshadowelement-stddeviationy |
瀏覽器相容性
載入中…