首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

fedisplacementmap

<feDisplacementMap>SVG过滤器原语从使用来自图像的像素值in2在空间上置换从图像in

转换公式如下所示:

P'(x,y) ← P( x + scale * (XC(x,y) - 0.5), y + scale * (YC(x,y) - 0.5))

其中 p (x、y) 是输入图像, in 和 p "(x、y) 是目标。XC (x、y) 和 YC (x,y) 是 xChannelSelector 和 yChannelSelector 指定的通道的分量值。

用法上下文

分类

过滤基元

允许的内容

以任意顺序包含以下任意数量的元素:<animate>,<set>

属性

全局属性

  • Core attributes
  • Presentation attributes
  • Filter primitive attributes
  • class
  • style

具体属性

  • in
  • in2
  • scale
  • xChannelSelector
  • yChannelSelector

DOM接口

这个元素实现了SVGFEDisplacementMapElement接口。

代码语言:javascript
复制
<svg width="200" height="200" viewBox="0 0 220 220"
     xmlns="http://www.w3.org/2000/svg">
  <filter id="displacementFilter">
    <feTurbulence type="turbulence" baseFrequency="0.05"
        numOctaves="2" result="turbulence"/>
    <feDisplacementMap in2="turbulence" in="SourceGraphic"
        scale="50" xChannelSelector="R" yChannelSelector="G"/>
  </filter>

  <circle cx="100" cy="100" r="100"
      style="filter: url(#displacementFilter)"/>
</svg>

产品规格

Specification

Status

Comment

Filter Effects Module Level 1The definition of '<feDisplacementMap>' in that specification.

Working Draft

No changes

Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<feDisplacementMap>' in that specification.

Recommendation

Initial definition

浏览器兼容性

Feature

Chrome

Edge

Firefox (Gecko)

Internet Explorer

Opera

Safari

Basic support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

?

Feature

Android

Edge

Firefox Mobile (Gecko)

IE Phone

Opera Mobile

Safari Mobile

Basic support

?

(Yes)

?

?

?

?

扫码关注腾讯云开发者

领取腾讯云代金券