css+js实现玻璃按钮鼠标悬浮点亮倒影交互效果代码

代码语言:html

所属分类:悬停

代码描述:css+js实现玻璃按钮鼠标悬浮点亮倒影交互效果代码,玻璃立体材质,有阴影。

代码标签: css js 玻璃 按钮 鼠标 悬浮 点亮 倒影 交互

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

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

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

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

body {
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  background: linear-gradient(to bottom, #eee, #ddd);
  display: flex;
  justify-content: center;
  font-family: sans-serif;
  cursor: none;
}

#custom-cursor {
  position: fixed;
  height: 1em;
  width: 1em;
  z-index: 999;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.main-container {
  align-self: center;
  width: 200px;
  height: 200px;
}

.ring {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 100%;
  background: linear-gradient(to top, #dedede, #fefefe);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ring:before {
  content: "";
  position: absolute;
  height: calc(100% + 5px);
  width: calc(100% + 5px);
  background: linear-gradient(to bottom, #fff, #ddd);
  border-radius: 100%;
  z-index: -1;
}

.glow-center {
  position: relative;
  width: 80%;
  height: 80%;
}
.glow-center:before {
  content: "";
  position: absolute;
  height: 100%;
  width: 100%;
  border-radius: 100%;
  background: radial-gradient(#440000, #110000);
  z-index: 1;
  transition: 0.25s;
}
.glow-center:hover:before {
  background: radial-gradient(#dd2060, #110000);
}
.glow-center:after {
  content: "";
  position: absolute;
  height: calc(100% + 5px);
  width: calc(100% + 5px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(to top, #fefefe, #aaa);
  border-radius: 100%;
  z-index: 0;
}

.reflection {
  position: absolute;
  height: 80%;
  width: 80%;
  border-radius: 100%;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reflection img {
  position: absolute;
  width: 28px;
  height: 28px;
  filter: blur(3px);
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0