gsap+svg实现探照灯菜单栏点击动画效果代码

代码语言:html

所属分类:菜单导航

代码描述:gsap+svg实现探照灯菜单栏点击动画效果代码

代码标签: gsap svg 探照灯 菜单栏 点击 动画

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


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

<head>

 
<meta charset="UTF-8">

 
 
<style>
html
,
body
{
 
height: 100%;
}

body
{
 
display: flex;
 
justify-content: center;
 
align-items: center;
 
background-color: #dddddd;
}

.menu {
 
background-color: #000000;
 
display: inline-flex;
 
border-radius: 0.5rem;
 
position: relative;
}

.menu .link {
 
display: inline-flex;
 
padding: 2rem;
 
font-size: 2rem;
 
color: gray;
 
position: relative;
 
z-index: 2;
}

.menu .link .icon {
 
stroke: gray;
 
height: 42px;
 
width: 42px;
}

.menu .link.active .icon {
 
stroke: white;
}

.menu .slider {
 
position: absolute;
 
height: 0.25rem;
 
border-radius: 0.25rem;
 
background-color: #ffffff;
 
z-index: 1;
 
top: 0;
 
left: 0;
 
margin: auto;
 
transform-style: preserve-3d;
}

.menu .slider .focus {
 
transform-style: preserve-3d;
 
transform-origin: top;
 
transform: perspective(200px) translateY(1px) rotateX(65deg);
 
background-image: linear-gradient(-180deg, rgba(255, 255, 255, 0.5), rgba(0, 0, 0, 0) 90%);
}

.inspired {
 
position: fixed;
 
bottom: 0;
 
left: 0;
 
right: 0;
 
margin: auto;
}
.inspired a {
 
display: flex;
 
justify-content: center;
 
align-items: center;
 
padding: 8px;
 
text-decoration: none;
 
background-color: #ff00f0;
 
color: #ffffff;
}

.other_pens {
 
position: fixed;
 
top: 0;
 
left: 0;
 
font-size: 1rem;
 
display: inline-flex;
 
margin: 0.5rem;
 
border-radius: 5px;
 
padding: 0.75rem 1rem;
 
background-color: #212121;
 
justify-content: center;
 
align-items: center;
 
text-decoration: none;
 
color: #ffffff;
 
font-weight: 500;
}
.other_pens .icon {
 
height: 1rem;
 
margin-left: 0.5rem;
}
</style>




</head>

<body >
 
<div class="menu">
 
<div class="slider">
   
<div class="focus"></div>
 
</div>
 
<a class="link" href="#">
   
<div class="icon">
     
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
       
<title>ionicons-v5-i</title>
       
<path d="M80,212V448a16,16,0,0,0,16,16h96V328a24,24,0,0,1,24-24h80a24,24,0,0,1,24,24V464h96a16,16,0,0,0,16-16V212" style="
               
fill: none;
               
stroke: inherit;
               
stroke-linecap: round;
               
stroke-linejoin: round;
               
stroke-width: 32px;
             
" />
       
<path d="M480,256,266.89,52c-5-5.28-16.69-5.34-21.78,0L32,256" style="
               
fill: none;
               
stroke: inherit;
               
stroke-linecap: round;
               
stroke-linejoin: round;
               
stroke-width: 32px;
             
" />
        <polyline points="400 179 400 64 352 64 352 133" style="
                fill: none;
                stroke: inherit;
                stroke-linecap: round;
                stroke-linejoin: round;
   .........完整代码请登录后点击上方下载按钮下载查看

网友评论0