js+svg实现图片悬浮扭曲动画效果代码
代码语言:html
所属分类:悬停
代码描述:js+svg实现图片悬浮扭曲动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { height: 100vh; margin: 0px; display: grid; place-items: center; background-color: #000; overflow: hidden; } svg { position: absolute; z-index: -1; } img { max-width: 80vw; max-height: 80vh; cursor: pointer; } img.distort { filter: url(#distort); } </style> </head> <body > <svg> <defs> <filter id="distort"> <feTurbulence baseFrequency=".005,.005" numOctaves="3" seed="0" type="fractalNoise" result="noise" /> <feDisplacementMap in="SourceGraphic" in2="noise" scale="0" xChannelSelector="R" yChannelSelector="G" result="distorteda" /> <feDisplacementMap in="SourceGraphic" in2="noise" scale="0" xChannelSelector="R" yChannelSelector="G" result="distortedb" /> <feDisplacementMap in="SourceGraphic" in2="noise" scale="0" xChannelSelector="R" yChannelSelector="G" result="distortedc" /> <feColorMatrix in="distorteda" type="matrix" values="1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0" result="r" /> <feColorMatrix in="distortedb" type="matrix" values="0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0" result="g" /> <feColorMatrix in="distortedc" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0" r.........完整代码请登录后点击上方下载按钮下载查看
网友评论0