gsap+svg实现两个正方形相互依附旋转动画效果代码
代码语言:html
所属分类:动画
代码描述:gsap+svg实现两个正方形相互依附旋转动画效果代码
代码标签: gsap svg 两个 正方形 相互 依附 旋转 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> body { background-color: #F6F1D1; overflow: hidden; text-align:center; display: flex; align-items: center; justify-content: center; } body, html { height: 100%; width: 100%; margin: 0; padding: 0; } svg { min-height: 100%; visibility: hidden; } </style> </head> <body> <svg id="mainSVG" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600"> <g> <rect id="big" x="325" y="250" width="100" height="100" fill="#EF2D56" /> <rect id="small" x="425" y="250" width="50" height="50" fill="#363537" /> </g> </svg> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.9.1.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/CustomEase3.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/CustomBounce3.min.js"></script> <script> gsap.config({ trialWarn: false }); let select = s => document.querySelector(s), q = gsap.utils.selector(document), toArray = s => gsap.utils.toArray(s), mainSVG = select('#mainSVG'); gsap.set('svg', { visibility: 'visible' }); CustomBounce.create("myBounce", { st.........完整代码请登录后点击上方下载按钮下载查看
网友评论0