js实现蜂窝六边形发光跟随鼠标移动效果代码

代码语言:html

所属分类:悬停

代码描述:js实现蜂窝六边形发光跟随鼠标移动效果代码

代码标签: js 蜂窝 六边形 发光 跟随 鼠标 移动

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

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

<head>
  <meta charset="UTF-8">
  


  
  
<style>
@import url("https://fonts.googleapis.com/css?family=Montserrat:400,700");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #131217;
  width: 100%;
  height: 100vh;
  position: relative;
  display: grid;
  place-content: center;
  font-family: Montserrat;
  overflow: hidden;
}

h1 {
  font-size: 8rem;
  font-weight: 700;
  color: white;
  position: relative;
  z-index: 2;
  text-align: center;
}

#pattern {
  position: absolute;
  top: -44px;
  left: -50px;
  right: 0;
  bottom: 0;
}

#gradient {
  background: radial-gradient(#ff8811, transparent 50%);
  width: 400px;
  height: 400px;
  position: absolute;
  top: -200px;
  left: -200px;
  transform: translate(200px, 200px);
}

/* -- youtube link styling -- */

.links {
  border-top: 1px solid #ffffff50;
  border-right: 1px solid #ffffff50;
  border-top-right-radius: 0.5rem;
  position: fixed;
  bottom: 0;
  left: 0;
  padding: 0.5rem;
  font-family: Montserrat;
  font-size: 1.2rem;
  font-weight: 400;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;

  & > a {
    color: #ffffff;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.5;
    &:hover {
      opacity: 1;
    }

    & > svg {
      margin-left: 0.5rem;
      flex-shrink: 0;
    }
    &:nth-child(1) > svg {
      stroke: #dd2d4a;
    }
    &:nth-child(2) > svg {
      stroke: #2b59c3;
    }
  }
}
</style>


  
  
</head>

<body translate="no">
  <h1>Hexagons</h1>
<div id="gradient"></div>
<div id="pattern"></div>

<!-- Youtube channel -->

<div class="links">
  <a href="https://youtu.be/4cI3NSPHRoY" target="_blank" class="youtube">Watch on
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24".........完整代码请登录后点击上方下载按钮下载查看

网友评论0