3d弹性按钮点击效果

代码语言:html

所属分类:三维

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

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

<link rel='stylesheet' href='https://codepen.io/jouanmarcel/pen/qBBawwv.css'>
<style>
body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  margin: 0;
  background-image: radial-gradient(circle, #e7e7e7, #d7d7d7);
  font-size: 16px;
}

.ticklishbutton {
  display: inline-block;
  transition: all 0.1s ease-out;
  user-select: none;
  cursor: pointer;
  font-family: sans-serif;
  transform-style: preserve-3d;
}
.ticklishbutton:hover {
  transform: translateZ(30px);
}
.ticklishbutton:hover .surface {
  background-size: 100% 200%;
}

.surface {
  border-radius: 40px;
  background-image: radial-gradient(ellipse at 80% 100%, #C42505, #E8B106);
  background-size: 100% 100%;
  transition: all 0.2s ease;
  color: #fff;
  padding: 20px 45px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2), inset 0 0 5px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  will-change: background-size;
}

.text {
  transform: translateZ(60px);
  text-shadow: 0 5px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
</style>

</head>
<body translate="no">
<div class="ticklishbutton" @click.capture="tap">
<div class="surface">
<div class="text">{{text}}</div>
</div>
</div>
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/vue.2.2.min.js"></script>

<script>
Vue.co.........完整代码请登录后点击上方下载按钮下载查看

网友评论0