gsap实现照片飘动动画效果代码
代码语言:html
所属分类:动画
代码描述:gsap实现照片飘动动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> html, body { display: flex; justify-content: center; align-items: center; height: 100%; background: black; } #container { height: 100%; display: flex; justify-content: center; align-items: center; filter: blur(2px) contrast(120%); } #theImage { display: flex; flex-flow: row wrap; position: relative; } </style> </head> <body translate="no" > <div id="container"> <div id="theImage"></div> </div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.5.2.js"></script> <script > function buildImage() { const theImg = document.querySelector("#theImage"); const imgPieces = []; const imgSize = 300; const piecesPerRow = 18; const waveOffset = 20; const imgUrl = "//repo.bfw.wiki/bfwrepo/image/5d653d54ed035.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_200,h_200,/quality,q_90"; // The percentage of the background position // we want to increment each time to actually // build the image pieces to resemble the full image const percentageIncrement = imgSize / piecesPerRow / imgSize * 100; // This increment determines the angle of // each piece per row to make .........完整代码请登录后点击上方下载按钮下载查看
网友评论0