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 |
浏览器兼容性
加载中…