gsap+MorphSVGPlugin+svg模拟手机底部导航条菜单点击效果代码
代码语言:html
所属分类:菜单导航
代码描述:gsap+MorphSVGPlugin+svg模拟手机底部导航条菜单点击效果代码
代码标签: gsap MorphSVGPlugin svg 模拟 手机 底部 导航条 菜单
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> .tab-bar { margin-top: auto; display: flex; justify-content: space-between; width: 100%; padding: 24px 36px 36px 36px; background-color: #151519; box-shadow: inset 0 1.5px 0 0 #212126; border-radius: 31px 31px 41px 41px; } .tab-bar button { cursor: pointer; display: block; position: relative; background-color: transparent; border: 0; padding: 12px; margin: 0; color: #656472; transition: color 0.35s; -webkit-tap-highlight-color: transparent; } .tab-bar button.active { color: #7EE9F2; } .tab-bar button.home { --tab-bar-home-scale: .7; --tab-bar-home-opacity: 1; } .tab-bar button.home:before { content: ""; width: 10px; height: 10px; border-radius: 5px; box-shadow: inset 0 0 0 2px currentColor; transform: translateX(-50%) scale(var(--tab-bar-home-scale)) translateZ(0); opacity: var(--tab-bar-home-opacity); position: absolute; left: 50%; top: 42.5%; } .tab-bar button.chart { --tab-bar-chart-1-offset: 6px; --tab-bar-chart-2-offset: 18px; --tab-bar-chart-3-offset: 10px; --tab-bar-chart-4-offset: 17px; } .tab-bar button.chart svg g path:nth-child(1) { stroke-dasharray: 3px; stroke-dashoffset: var(--tab-bar-chart-1-offset); } .tab-bar button.chart svg g path:nth-child(2) { stroke-dasharray: 9px; stroke-dashoffset: var(--tab-bar-chart-2-offset); } .tab-bar button.chart svg g path:nth-child(3) { stroke-dasharray: 5px; stroke-dashoffset: var(--tab-bar-chart-3-offset); } .tab-bar button.chart svg g path:nth-child(4) { stroke-dasharray: 10px; stroke-dashoffset: var(--tab-bar-chart-4-offset); } .tab-bar button.marker { --tab-bar-marker-scale: .7; --tab-bar-marker-opacity: 1; } .tab-bar button.marker:before { content: ""; width: 11px; height: 11px; border-radius: 6px; box-shadow: inset 0 0 0 2px currentColor; transform: translateX(-50%) scale(var(--tab-bar-marker-scale)) translateZ(0); opacity: var(--tab-bar-marker-opacity); position: absolute; left: 50%; top: 34.5%; } .tab-bar button.trophy { --tab-bar-trophy-x: 0px; --tab-bar-trophy-scale: .75; } .tab-bar button.trophy:before, .tab-bar button.trophy:after { content: ""; position: absolute; background-color: currentColor; left: 50%; } .tab-bar button.trophy:before { width: 2px; transform: translateX(-50%) scaleX(0.75) translateZ(0); top: 28px; bottom: 15px; } .tab-bar button.trophy:after { height: 2px; width: 10px; border-radius: 1px; transform: translateX(-50%) scaleX(var(--tab-bar-trophy-scale)) scaleY(0.75) translateZ(0); top: 32px; } .tab-bar button.trophy .left, .tab-bar button.trophy .right { position: absolute; top: 12px; height: 14px; width: 7px; overflow: hidden; } .tab-bar button.trophy .left svg, .tab-bar button.trophy .right svg { display: block; position: absolute; top: 0; } .tab-bar button.trophy .left { left: 12px; } .tab-bar button.trophy .left svg { left: 0; transform: translateX(var(--tab-bar-trophy-x)); } .tab-bar button.trophy .right { right: 12px; } .tab-bar button.trophy .right svg { right: 0; transform: translateX(calc(var(--tab-bar-trophy-x) * -1)); } .tab-bar button.user { --tab-bar-user-y: 0px; --tab-bar-user-scale: .7; --tab-bar-user-opacity: 1; } .tab-bar button.user:before { content: ""; width: 10px; height: 10px; border-radius: 5px; box-shadow: inset 0 0 0 2px currentColor; transform: translateX(-50%) scale(var(--tab-bar-user-scale)) translateZ(0); opacity: var(--tab-bar-user-opacity); position: absolute; left: 50%; top: 35%; } .tab-bar button.user .circle { width: 18px; height: 18px; position: absolute; top: 15px; left: 50%; border-radius: 50%; overflow: hidden; transform: translateX(-50%); } .tab-bar button.user .circle svg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, calc(-50% + var(--tab-bar-user-y))) translateZ(0); } .tab-bar button svg { width: 24px; height: 24px; fill: none; display: block; stroke-width: 1.5; stroke-linecap: round; stroke: currentColor; will-change: transform; } .phone { position: absolute; top: 0; bottom: 25%; left: 50%; transform: translateX(-50%); max-width: 390px; width: 100%; display: flex; background-color: #111113; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.1); border-radius: 0 0 41px 41px; } .phone:before { content: ""; height: 4px; bottom: 8px; width: 88px; left: 50%; transform: translateX(-50%) scaleY(0.75); position: absolute; background-color: #2D2D34; border-radius: 2px; z-index: 1; } html { box-sizing: border-box; -webkit-font-smoothing: antialiased; } * { box-sizing: inherit; } *:before, *:after { box-sizing: inherit; } body { min-height: 100vh; display: flex; font-family: "Inter", Arial; justify-content: center; align-items: center; background-color: #28282E; } body .twitter { position: fixed; display: block; right: 12px; bottom: 12px; } body .twitter svg { width: 32px; height: 32px; fill: #fff; } </style> </head> <body> <div class="phone"> <nav class="tab-bar"> <button class="home active"> <svg viewBox="0 0 24 24"> <path d="M3 18V10.5339C3 9.57062 3.46259 8.66591 4.24353 8.1019L10.2435 3.76856C11.2921 3.01128 12.7079 3.01128 13.7565 3.76856L19.7565 8.1019C20.5374 8.66591 21 9.57062 21 10.5339V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18Z" /> </svg> </button> <button class="chart"> <svg viewBox="0 0 24 24"> <path d="M2.99625 7.99624C2.99625 5.23482 5.23482 2.99625 7.99625 2.99625H16.0037C18.7652 2.99625 21.0037 5.23482 21.0037 7.99625V16.0037C21.0037 18.7652 18.7652 21.0037 16.0037 21.0037H7.99624C5.23482 21.0037 2.99625 18.7652 2.99625 16.0037V7.99624Z" /> <g> <path d="M7.49813 13.2605V16.0016" /> <path d="M10.4994 7.99832V16.0017" /> <path d="M13.5006 11.5068V16.0016" /> <path d="M16.5019 6.75208V16.0017" /> </g> </svg> </button> <button class="marker"> <svg viewBox="0 0 24 24"> <path d="M12 21C12 21 9.39536 18.8605 7.3637 16C6.06474 14.1711 5 12.0475 5 10C5 6.134 8.134 3 12 3C15.866 3 19 6.134 19 10C19 12.0475 17.9353 14.1711 16.6363 16C14.6046 18.8605 12 21 12 21Z" /> </svg> </button> <button class="trophy"> <div class="left"> <svg viewBox="0 0 24 24"> <path d="M9 6.5H4C3.448 6.5 3 6.948 3 7.5V9.5C3 11.157 4.343 12.5 6 12.5H9" /> </svg> </div> <div class="right"> <svg viewBox="0 0 24 24"> <path d="M15 6.5H20C20.552 6.5 21 6.948 21 7.5V9.5C21 11.157 19.657 12.5 18 12.5H15" /> </svg> </div> <svg viewBox="0 0 24 24"> <path d="M16 3.5H8C7.44772 3.5 7 3.94772 7 4.5V12.5C7 14.7091 8.79086 16.5 11 16.5H13C15.2091 16.5 17 14.7091 17 12.5V4.5C17 3.94772 16.5523 3.5 16 3.5Z" /> </svg> </button> <button class="user"> <div class="circle"> <svg viewBox="0 0 24 24"> <path d="M17.307 19.257C16.923 17.417 14.705 16 12 16C9.29499 16 7.07699 17.417 6.69299 19.257" /> </svg> </div> <svg viewBox="0 0 24 24"> <path d="M18.364 5.63604C21.8787 9.15076 21.8787 14.8492 18.364 18.3639C14.8493 21.8787 9.1508 21.8787 5.6361 18.3639C2.12138 14.8492 2.12138 9.15074 5.6361 5.63604C9.15082 2.12132 14.8493 2.12132 18.364 5.63604Z" /> </svg> </button> </nav> </div> <!-- twitter --> <a class="twitter" target="_top" href="https://twitter.com/aaroniker_me"><svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72"><path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"></path></svg></a> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.8.0.js"></script> <script type=".........完整代码请登录后点击上方下载按钮下载查看
网友评论0