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;
                stroke-width: 32px;
              " />
      </svg>
    </div>
  </a><a class="link" href="#">
    <div class="icon">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
        <title>ionicons-v5-f</title>
        <path d="M352.92,80C288,80,256,144,256,144s-32-64-96.92-64C106.32,80,64.54,124.14,64,176.81c-1.1,109.33,86.73,187.08,183,252.42a16,16,0,0,0,18,0c96.26-65.34,184.09-143.09,183-252.42C447.46,124.14,405.68,80,352.92,80Z" style="
                fill: none;
                stroke: inherit;
                stroke-linecap: round;
                stroke-linejoin: round;
                stroke-width: 32px;
              " />
      </svg>
    </div>
  </a><a class="link" href="#">
    <div class="icon">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
        <title>ionicons-v5-a</title>
        <path d="M448,256c0-106-86-192-192-192S64,150,64,256s86,192,192,192S448,362,448,256Z" style="
                fill: none;
                stroke: inherit;
                stroke-miterlimit: 10;
                stroke-width: 32px;
              " />
        <line x1="256" y1="176" x2="256" y2="336" style="
                fill: none;
                stroke: inherit;
         .........完整代码请登录后点击上方下载按钮下载查看

网友评论0