SVGFEConvolveMatrixElement: divisor 屬性
SVGFEConvolveMatrixElement 介面中只讀的 divisor 屬性反映了給定 <feConvolveMatrix> 元素的 divisor 屬性。
值
一個 SVGAnimatedNumber 物件。
示例
訪問 divisor 屬性
應用卷積濾鏡於一個矩形,divisor 用於控制亮度。
html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="convolveFilterWithDivisor">
<feConvolveMatrix
in="SourceGraphic"
order="3"
kernelMatrix="0 -1 0 -1 4 -1 0 -1 0"
divisor="1" />
</filter>
</defs>
<rect
x="20"
y="20"
width="100"
height="100"
fill="lightgreen"
filter="url(#convolveFilterWithDivisor)" />
</svg>
js
const convolveMatrix = document.querySelector("feConvolveMatrix");
console.log(convolveMatrix.divisor.baseVal); // Output: 1
規範
| 規範 |
|---|
| 濾鏡效果模組第 1 級 # dom-svgfeconvolvematrixelement-divisor |
瀏覽器相容性
載入中…