SVGFEDropShadowElement: stdDeviationX 屬性
SVGFEDropShadowElement 介面的只讀屬性 stdDeviationX 反映了給定 <feDropShadow> 元素的 stdDeviation 屬性的 X 分量(可能是自動計算的)。
值
一個 SVGAnimatedNumber 物件。
示例
訪問 stdDeviationX 值
在此示例中,我們透過使用 SVGFEDropShadowElement 介面的只讀屬性 stdDeviationX 來檢索 <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.stdDeviationX.baseVal); // Output: 5
規範
| 規範 |
|---|
| 濾鏡效果模組第 1 級 # dom-svgfedropshadowelement-stddeviationx |
瀏覽器相容性
載入中…