yChannelSelector 属性指定使用 in2 的哪个颜色通道,沿 y 轴对 in 中的像素进行位移。
元素
你可以将此属性与 feDisplacementMap SVG 元素一起使用。
使用说明
<table class="properties"> <tbody> <tr> <th scope="row">值</th> <td><code>R</code> | <code>G</code> | <code>B</code> | <code>A</code></td> </tr> <tr> <th scope="row">默认值</th> <td><code>A</code></td> </tr> <tr> <th scope="row">动画性</th> <td>是</td> </tr> </tbody> </table>
R- : 该关键字指定使用 in2 所定义输入图像的红色通道,沿 y 轴对 in 所定义输入图像中的像素进行位移。
G- : 该关键字指定使用 in2 所定义输入图像的绿色通道,沿 y 轴对 in 所定义输入图像中的像素进行位移。
B- : 该关键字指定使用 in2 所定义输入图像的蓝色通道,沿 y 轴对 in 所定义输入图像中的像素进行位移。
A- : 该关键字指定使用 in2 所定义输入图像的 alpha 通道,沿 y 轴对 in 所定义输入图像中的像素进行位移。
示例
html,
body,
svg {
height: 100%;
}
<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"
yChannelSelector="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"
yChannelSelector="B" />
</filter>
<text x="10" y="60" font-size="50" filter="url(#displacementFilter)">
一些位移文本
</text>
<text x="10" y="120" font-size="50" filter="url(#displacementFilter2)">
一些位移文本
</text>
</svg>
示例
规范
浏览器兼容性
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
