TweenMax实现svg变形动画效果代码
代码语言:html
所属分类:动画
代码描述:TweenMax实现svg变形动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { background-color: #fff; margin: 0; padding: 0; overflow: hidden; } video { position: absolute; z-index: 1; top: 50%; left: 50%; min-width: 100%; min-height: 100%; width: auto; height: auto; transform: translate(-50%, -50%); } svg { position: absolute; z-index: 2; width: 100vw; height: 100vh; mix-blend-mode: multiply; } #path1, #path2 { mix-blend-mode: multiply; } #path2 { opacity: 0.7; } linearGradient stop { transition: all 0.4s ease-in-out; } .section1 #fill1 .stop1 { stop-color: #f23b3e; } .section1 #fill1 .stop2 { stop-color: #6d3a83; } .section1 #fill2 .stop1 { stop-color: #ee3a9e; } .section1 #fill2 .stop2 { stop-color: #2f7ebf; } .section2 #fill1 .stop1 { stop-color: #713a80; } .section2 #fill1 .stop2 { stop-color: #cc3b58; } .section2 #fill2 .stop1 { stop-color: #b13496; } .section2 #fill2 .stop2 { stop-color: #4a4587; } .section3 #fill1 .stop1 { stop-color: #f33b47; } .section3 #fill1 .stop2 { stop-color: #bb3b60; } .section3 #fill2 .stop1 { stop-color: #2c94c6; } .section3 #fill2 .stop2 { stop-color: #39449c; } /* Button */ button.btn { color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 2px; cursor: pointer; position: relative; z-index: 1; padding: 15px 30px; border: none; border-radius: 4px; box-shadow: 0px 16px 47px -15px #80101a; background: none; transition: box-shadow 0.2s ease-in-out; overflow: hidden; position: absolute; bottom: 20px; right: 20px; z-index: 3; outline: none; } button.btn span { position: relative; z-index: 2; } button.btn:before, button.btn:after { content: ""; z-index: -1; background: #e23b48; content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; } button.btn:after { background: #23467a; transform: scaleY(0); transform-origin: top; transition: transform 0.2s ease-in-out; transition-delay: 0.1s; } button.btn:hover { box-shadow: 0px 16px 47px -15px #08162b; } button.btn:hover:after { transform: scaleY(1); transform-origin: bottom; transition-delay: 0s; } .logo { position: absolute; top: 50%; left: 50%; z-index: 100; width: 50%; height: auto; transform: translate(-50%, -50%); fill: #fff; mix-blend-mode: normal; opacity: 0.9; filter: drop-shadow(0 3px 7px rgba(64, 34, 100, 0.4)); } </style> </head> <body> <svg id="pieces" class="section1"> <defs> <linearGradient id="fill1"> <stop class="stop1" offset="0%"></stop> <stop class="stop2" offset="100%"></stop> </linearGradient> <linearGradient id="fill2"> <stop class="stop1" offset="0%"></stop> <stop class="stop2" offset="100%"></stop> </linearGradient> </defs> <polygon id="path1" points="0,0 174,0 609,578 0,578 " fill="url(#fill1)"></polygon> <polygon id="path2" points="0,0 0,0 870,578 0,578 " fill="url(#fill2)"></polygon> </svg> <button class="btn">change</button> <svg width="93" height="18" viewBox="0 0 93 18" class="logo"> <path fill="#fff" d="M82.664 6.228h2.9c3.535 0 6.718 1.102 6.694 5.337 0 4.025-3.583 5.43-6.6 5.43-3.82 0-6.732-1.38-6.744-5.267v-.538h3.63v.538h.002c0 1.477 1.696 2.038 3.063 2.038.896 0 3.017-.327 3.017-2.2.023-1.826-1.956-2.2-3.064-2.2h-6.32V.426h12.094v3.276h-8.673v2.526zm-16.02 10.555h-6.768V.403h6.767c5.68 0 8.203 3.788 8.203 8.073 0 4.283-2.428 8.307-8.203 8.307zm0-13.08h-3.138.........完整代码请登录后点击上方下载按钮下载查看
网友评论0