gsap+svg实现水波纹导航图标菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:gsap+svg实现水波纹导航图标菜单效果代码

代码标签: gsap svg 水波纹 导航 图标 菜单

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
 
<meta charset="UTF-8">
 
 
 
 
<style>
@import url("https://fonts.googleapis.com/css2?family=PT+Sans+Narrow&display=swap");
html
,
body
{
 
height: 100%;
}

body
{
 
background-color: #080a0f;
 
display: flex;
 
justify-content: center;
 
align-items: center;
 
flex-direction: column;
}

nav
{
 
background-color: #1a2030;
 
border: 1px solid #252e45;
 
border-radius: 100px;
 
display: flex;
 
flex-wrap: wrap;
}
nav a
{
 
border-radius: 100px;
 
display: flex;
 
align-items: center;
 
justify-content: center;
 
font-family: "ff-chambers-sans-web", sans-serif;
 
font-weight: 500;
 
font-size: 2.5rem;
 
text-decoration: none;
 
position: relative;
 
margin: 8px 8px 8px 0;
 
padding: 22px 22px;
 
overflow: hidden;
}
nav
a:first-child {
 
margin-left: 8px;
}
nav
a:hover .label {
 
bottom: 7px;
 
opacity: 1;
}
nav a
.icon {
 
color: #fff;
 
display: flex;
 
align-items: center;
 
justify-content: center;
 
z-index: 1;
 
mix-blend-mode: exclusion;
}
nav a
.label {
 
color: #fff;
 
position: absolute;
 
bottom: -14px;
 
font-family: "PT Sans Narrow", serif;
 
font-weight: 400;
 
font-style: normal;
 
font-size: 1rem;
 
mix-blend-mode: exclusion;
 
opacity: 0;
 
z-index: 1;
 
transition: bottom 200ms ease, opacity 200ms ease;
 
text-transform: lowercase;
}
nav a svg
{
 
position: absolute;
 
bottom: 0;
 
left: 0;
 
transition: box-shadow 25ms 25ms;
}
nav a svg rect
{
 
shape-rendering: crispEdges;
 
z-index: 0;
}
nav a svg
.blue rect {
 
fill: #05eafa;
 
mix-blend-mode: color-dodge;
}
nav a svg
.pink rect {
 
fill: #ff6bd3;
}
nav a
.active .label {
 
bottom: 7px;
 
opacity: 1;
}

@media (max-width: 1023px) {
  nav
{
   
flex-direction: column;
 
}
  nav a
{
   
margin: 8px;
 
}
}
</style>

 
</head>

<body translate="no">
 
<nav>
 
<a href="#">
   
<span class="label">Home</span>
   
<box-icon class="icon" name="home" color="white" size="50px"></box-icon>
   
<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg">
     
<g class="pink">
       
<rect x="0" width="6" height="100%" y="-100%" />
       
<rect x="6" width="6" height="100%" y="-100%" />
       
<rect x="12" width="6" height="100%" y="-100%" />
       
<rect x="18" width="6" height="100%" y="-100%" />
       
<rect x="24" width="6" height="100%" y="-100%" />
       
<rect x="30" width="6" height="100%" y="-100%" />
       
<rect x="36" width="6" height="100%" y="-100%" />
       
<rect x="42" width="6" height="100%" y="-100%" />
       
<rect x="48" width="6" height="100%" y="-100%" />
       
<rect x="54" width="6" height="100%" y="-100%" />
       
<rect x="60" width="6" height="100%" y="-100%" />
       
<rect x="66" width="6" height="100%" y="-100%" />
       
<rect x="72" width="6" height="100%" y="-100%" />
       
<rect x="78" width="6" height="100%" y="-100%" />
       
<rect x="84" width="6" height="100%" y="-100%" />
       
<rect x="90" width="6" height="100%" y="-100%" />
     
</g>
     
<g class="blue">
       
<rect x="0" width="6" height="100%" y="100%" />
       
<rect x="6" width="6" height="100%" y="100%" />
       
<rect x="12" width="6" height="100%" y="100%" />
       
<rect x="18" width="6" height="100%" y="100%" />
       
<rect x="24" width="6" height="100%" y="100%" />
       
<rect x="30" width="6" height="100%" y="100%" />
       
<rect x="36" width="6" height="100%" y="100%" />
       
<rect x="42" width="6" height="100%" y="100%" />
       
<rect x="48" width="6" height="100%" y="100%" />
       
<rect x="54" width="6" height="100%" y="100%" />
       
<rect x="60" width="6" height="100%" y="100%" />
       
<rect x="66" width="6" height="100%" y="100%" />
       
<rect x="72" width="6" height="100%" y="100%" />
       
<rect x="78" width="6" height="100%" y="100%" />
       
<rect x="84" width="6" height="100%" y="100%" />
       
<rect x="90" width="6" height="100%" y="100%" />
     
</g>
   
</svg>
 
</a>
 
<a href="#">
   
<span class="label">Code</span>
   
<box-icon class="icon" name="code-alt" color="white" size="50px"></box-icon>
   
<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg">
     
<g class="pink">
       
<rect x="0" width="6" height="100%" y="-100%" />
       
<rect x="6" width="6" height="100%" y="-100%" />
        <rect x="12" width="6" height="100%&q.........完整代码请登录后点击上方下载按钮下载查看

网友评论0