xChannelSelector

xChannelSelector 屬性指示要使用 in2 中的哪個顏色通道沿 x 軸移動 in 中的畫素。

元素

您可以將此屬性與 <feDisplacementMap> SVG 元素一起使用。

使用說明

R | G | B | A
預設值 A
可動畫
R

此關鍵字指定將使用在 in2 中定義的輸入影像的紅色顏色通道沿 x 軸移動在 in 中定義的輸入影像的畫素。

G

此關鍵字指定將使用在 in2 中定義的輸入影像的綠色顏色通道沿 x 軸移動在 in 中定義的輸入影像的畫素。

B

此關鍵字指定將使用在 in2 中定義的輸入影像的藍色顏色通道沿 x 軸移動在 in 中定義的輸入影像的畫素。

A

此關鍵字指定將使用在 in2 中定義的輸入影像的 alpha 通道沿 x 軸移動在 in 中定義的輸入影像的畫素。

示例

html
<svg viewBox="0 0 440 160" xmlns="http://www.w3.org/2000/svg">
  <filter id="displacementFilter">
    <feImage
      href="mdn.svg"
      x="0"
      y="0"
      width="100%"
      height="100%"
      result="abc" />
    <feDisplacementMap
      in2="abc"
      in="SourceGraphic"
      scale="30"
      xChannelSelector="R" />
  </filter>
  <filter id="displacementFilter2">
    <feImage
      href="mdn.svg"
      x="0"
      y="0"
      width="100%"
      height="100%"
      result="abc" />
    <feDisplacementMap
      in2="abc"
      in="SourceGraphic"
      scale="30"
      xChannelSelector="B" />
  </filter>

  <text x="10" y="60" font-size="50" filter="url(#displacementFilter)">
    Some displaced text
  </text>
  <text x="10" y="120" font-size="50" filter="url(#displacementFilter2)">
    Some displaced text
  </text>
</svg>

規範

規範
過濾器效果模組級別 1
# element-attrdef-fedisplacementmap-xchannelselector

瀏覽器相容性

BCD 表格僅在瀏覽器中載入