FeTurbulences 的 SVG 形状扭曲

Eva*_*gne 2 javascript animation svg distortion svg-filters

我的问题很简单:是否可以使用 SVG 滤镜重现这种效果(圆形扭曲动画)?

我认为将 FeTurbulences 与 FeDisplacementMap 一起使用会很有趣,因为它以静态方式工作。但实际上,我不知道应该补间哪个属性以使动画好看。

<feTurbulence type="fractalNoise" baseFrequency="0.01" numOctaves="2" result="warp" seed="0" stichTitles="stitch"></feTurbulence>
<feDisplacementMap xChannelSelector="R" yChannelSelector="G" scale="30" in="SourceGraphic" in2="warp" />
Run Code Online (Sandbox Code Playgroud)

如果您有其他解决方案(js 库、过滤器等):请不要犹豫。我对所有解决方案持开放态度;)

谢谢您的考虑。

Mic*_*any 6

这就是进行此类过滤的方法。baseFrequency 控制扭曲的粒度,scale 控制位移的大小,Animate 中的 dur 控制速度。我对比例进行了动画处理并添加了阴影以更好地匹配原始内容。

  <svg width="800px" height="600px">
  <defs>
<filter id="distort">
  <feTurbulence baseFrequency=".015" type="fractalNoise"/>
  <feColorMatrix type="hueRotate" values="0">
    <animate attributeName="values" from="0" to="360" dur="1s" repeatCount="indefinite"/>
  </feColorMatrix>
  <feDisplacementMap in="SourceGraphic" xChannelSelector="R" yChannelSelector="B" scale="20">
    <animate attributeName="scale" values="0;20;50;0" dur="5s" repeatCount="indefinite"/>
    </feDisplacementMap>
  <feGaussianBlur stdDeviation="3"/>
  <feComponentTransfer result="main">
    <feFuncA type="gamma" amplitude="50" exponent="5"/>
  </feComponentTransfer>
  
  <feColorMatrix type="matrix" values="0 0 0 0 0 
                                       0 0 0 0 0
                                       0 0 0 0 0
                                       0 0 0 1 0"/>
  <feGaussianBlur stdDeviation="10"/>
  <feComposite operator="over" in="main"/>

</filter>
  </defs>
  <circle filter="url(#distort)" cx="200" cy="200" r="150" fill="red"/>
</svg>
Run Code Online (Sandbox Code Playgroud)