svg+js实现跟随鼠标灯光照亮立体墙壁文字效果代码

代码语言:html

所属分类:其他

代码描述:svg+js实现跟随鼠标灯光照亮立体墙壁文字效果代码

代码标签: svg js 跟随 鼠标 灯光 照亮 立体 墙壁 文字

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">

<link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Dorsa&amp;familiy=Raleway&amp;display=swap'>
<style>
    body {
  background: black;
  cursor: none;
}

.container {
  display: flex;
  position: relative;
  width: 100%;
  height: 100vh;
  align-items: center;
  flex-direction: column;
  filter: url("#noise") url("#light");
  justify-content: center;
  transform: translate3d(0, 0, 0);
  z-index: 1;
  color: #fff;
  text-align: center;
}

.title {
  margin: 0 0 0.075em;
  font-family: "Dorsa", sans-serif;
  font-size: 18em;
  font-weight: 400;
  line-height: 0.8;
  text-transform: uppercase;
}

.subtitle {
  font-family: "Raleway", sans-serif;
  font-size: 0.8em;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

.cursor__point {
  margin: -3px 0 0 -3px;
  position: fixed;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  background-color: white;
  border-radius: 50%;
  z-index: 2;
}
.cursor__light {
  margin: -24px 0 0 -24px;
  position: fixed;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  background-color: white;
  border-radius: 50%;
  opacity: 0.1;
  z-index: 2;
}
</style>
</head>
<body>
<!-- partial:index.partial.html -->
<div class="container">
  <h1 class="title">
    This is <br/> 
    just SVG
  </h1>
  <div class="subtitle">
    How cool is that?
  </div>
</div>

<div class="cursor">
  <div class="cursor__point"></div>
  <div class="cursor__light"></div>
</div>

<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none">
  <filter id="light">
    <feSpecularLighting result="specOut" surfaceScale="1" specularCons.........完整代码请登录后点击上方下载按钮下载查看

网友评论0