SVGFEBlendElement: mode 属性
SVGFEBlendElement
接口的只读属性 mode
反映了给定元素的 mode
属性。它接受此接口上定义的 SVG_FEBLEND_MODE_*
常量之一。
值
一个 SVGAnimatedEnumeration
。
示例
访问 mode
属性
html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<filter id="blend-filter">
<feBlend in="SourceGraphic" in2="SourceAlpha" mode="multiply" />
<feBlend in="SourceGraphic" in2="BackgroundImage" mode="screen" />
</filter>
<rect
x="20"
y="20"
width="100"
height="100"
fill="red"
filter="url(#blend-filter)" />
<circle cx="100" cy="100" r="50" fill="blue" filter="url(#blend-filter)" />
</svg>
js
const blends = document.querySelectorAll("feBlend");
console.log(blends[0].mode.baseVal); // Output: 2 (SVG_FEBLEND_MODE_MULTIPLY)
console.log(blends[1].mode.baseVal); // Output: 3 (SVG_FEBLEND_MODE_SCREEN)
规范
规范 |
---|
滤镜效果模块第 1 级 # dom-svgfeblendelement-mode |
浏览器兼容性
加载中…