TweenMax实现三维卡通人脸表情跟随盯着鼠标交互效果代码

代码语言:html

所属分类:其他

代码描述:TweenMax实现三维卡通人脸表情跟随盯着鼠标交互效果代码

代码标签: TweenMax 三维 卡通 人脸 表情 跟随 盯着 鼠标 交互

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<style>
    * {
  box-sizing: border-box;
}
*::before, *::after {
  box-sizing: border-box;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 100vh;
  background: #fbf6e6;
}

#container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 6.25rem;
  height: 6.25rem;
}

button {
  position: relative;
  display: inline-block;
  cursor: pointer;
  outline: none;
  border: 0;
  vertical-align: middle;
}
button.face-button {
  width: 6.25rem;
  height: 6.25rem;
  border-radius: 50%;
  background: #fdda5f;
  box-shadow: inset 2px -4px 18px #fd9744;
}

.face-container {
  position: relative;
  display: block;
  width: 40px;
  height: 20px;
  margin: auto;
}

.eye {
  position: absolute;
  height: 0.5rem;
  width: 0.5rem;
  background: #2a2927;
  border-radius: 50%;
  -webkit-animation: eyeBlink 3200ms linear infinite;
          animation: eyeBlink 3200ms linear infinite;
}
.eye.left {
  left: 0;
}
.eye.right {
  left: 2rem;
}

.mouth {
  position: absolute;
  top: 1.125rem;
  left: 0.8rem;
  width: 1rem;
  height: 0.125rem;
  background: #2a2927;
  border-radius: 0;
}

.eye, .mouth {
  box-shadow: inset 1px 2px 4px #121110;
}

.face-button:hover .mouth,
.face-button:active .mouth {
  left: 1rem;
  width: 0.5rem;
  height: 0.4rem;
  border-radius: 1rem 1rem 0.125rem 0.125rem;
}

.face-button:hover .eye,
.face-button:active .eye {
  height: 0.375rem;
  width: 0.375rem;
  box-shadow: 0 0 0 0.25rem #fff;
}

@-webkit-keyframes eyeBlink {
  0%, 30%, 36%, 100% {
    transform: scale(1);
  }
  32%, 34% {
    transform: scale(1, 0);
  }
}

@keyframes eyeBlink {
  0%, 30%, 36%, 100% {
    transform: scale(1);
  }
  32%, 34% {
    transform: scale(1, 0);
  }
}
</style>

</head>
<body>

<div id=&quo.........完整代码请登录后点击上方下载按钮下载查看

网友评论0