【发布时间】:2021-11-19 23:37:30
【问题描述】:
我觉得我快到了。我试图在 sn-p 中实现与 GIF 相同的结果(主要是对“太阳”的涟漪效应)。欢迎提供有关如何执行此操作或更清洁的替代方法的建议。
body {
background: grey
}
svg {
background-color: #fff
}
<svg width="200" height="200" viewBox="0 0 200 220" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="vapourwave">
<feTurbulence id="turb" type="fractalNoise" numOctaves="1" baseFrequency=".04,.2" seed="5" result="turb"/>
<feColorMatrix in="turb" type="hueRotate" values="0" result="turb">
<animate attributeName="values" from="0" to="360" dur="2s" repeatCount="indefinite"/>
</feColorMatrix>
<feDisplacementMap xChannelSelector="R" yChannelSelector="G" in="SourceGraphic" in2="turb" scale="20"/>
</filter>
<clipPath id="clip-1">
<rect x="0" y="140" width="300" height="200" />
</clipPath>
<linearGradient id="myGradient" gradientTransform="rotate(90)">
<stop offset="5%" stop-color="gold" />
<stop offset="95%" stop-color="red" />
</linearGradient>
</defs>
<circle cx="100" cy="100" r="100" fill="url('#myGradient')"/>
<circle cx="100" cy="105" r="100" filter="url(#vapourwave)" clip-path="url(#clip-1)"/>
</svg>
<img src="https://s9.gifyu.com/images/ezgif.com-gif-maker36ade78f49932edd.gif" alt="">
【问题讨论】:
-
请看一下codepen.io/enxaneta/pen/oYMxqe?editors=0010,我正在使用 feTurbulence 并且正在为 baseFrequency 设置动画
标签: svg svg-animate svg-filters