值
一個 SVGAnimatedString 物件。
示例
在此示例中,filter 中定義了兩個 <feBlend> 元素,每個元素都有不同的 in2 屬性。
html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<filter id="blend-filter">
<feBlend in="SourceGraphic" in2="SourceAlpha" operator="over" />
<feBlend in="SourceGraphic" in2="BackgroundImage" operator="in" />
</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>
我們可以訪問 in2 屬性
js
const feBlends = document.querySelectorAll("feBlend");
console.log(feBlends[0].in2.baseVal); // Output: "SourceAlpha"
console.log(feBlends[1].in2.baseVal); // Output: "BackgroundImage"
規範
| 規範 |
|---|
| 濾鏡效果模組第 1 級 # dom-svgfeblendelement-in2 |
瀏覽器相容性
載入中…