SVGFEMorphologyElement:radiusX 屬性
SVGFEMorphologyElement 介面的只讀屬性 radiusX 反映了給定 <feMorphology> 元素的 radius 屬性的 X 分量。
值
一個 SVGAnimatedNumber 物件。
示例
訪問 radiusX 屬性
html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="morphologyFilter">
<!-- Applies a morphology filter with a specific radius -->
<feMorphology in="SourceGraphic" operator="dilate" radius="5 3" />
</filter>
</defs>
<rect
x="20"
y="20"
width="100"
height="100"
fill="lightblue"
filter="url(#morphologyFilter)" />
</svg>
js
// Select the feMorphology element
const morphologyNode = document.querySelector("feMorphology");
// Access the radiusX property
const radiusX = morphologyNode.radiusX.baseVal;
console.log(`The X radius is: ${radiusX}`); // Output: 5
規範
| 規範 |
|---|
| 濾鏡效果模組第 1 級 # dom-svgfemorphologyelement-radiusx |
瀏覽器相容性
載入中…