gsap实现鼠标悬浮卡通人脸张口动画效果代码

代码语言:html

所属分类:动画

代码描述:gsap实现鼠标悬浮卡通人脸张口动画效果代码

代码标签: gsap 鼠标 悬浮 卡通 人脸 张口 动画

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


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

<head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1">

  
  
<style>
html, body {
  min-height: 100vh;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: black;
}

.head {
  position: relative;
  height: 60vh;
  width: 40vw;
  max-width: 300px;
  margin: 2%;
  background: linear-gradient(123deg, #418366 0%, #5c9870 34%, #185338 100%);
  border-radius: 999rem;
  box-shadow: inset 0 4px 14px 1px rgba(255, 255, 255, 0.5), inset 0 -10px 14px 1px rgba(0, 0, 0, 0.5);
}

.eyes {
  position: absolute;
  height: 20%;
  width: 50%;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.eye-left,
.eye-right {
  position: absolute;
  height: 10vw;
  max-height: 75px;
  width: 10vw;
  max-width: 75px;
  margin: -5%;
  background: white;
  border-radius: 999rem;
  box-shadow: 0 4px 4px 1px rgba(255, 255, 255, 0.5), 0 -1px 4px 1px rgba(0, 0, 0, 0.5);
}
.eye-left:before,
.eye-right:before {
  content: "";
  position: absolute;
  height: 100%;
  width: 100%;
  border-radius: 999rem;
  box-shadow: inset 0 4px 14px rgba(255, 255, 255, 0.5), inset -8px -8px 14px rgba(0, 0, 0, 0.5), inset 0 4px 4px 1px rgba(255, 255, 255, 0.5), inset 0 -1px 4px 1px rgba(0, 0, 0, 0.5);
}

.eye-left {
  top: 0;
  left: 0;
}

.eye-right {
  top: 0;
  right: 0;
}

.pupil {
  position: absolute;
  height: 20%;
  width: 20%;
  top: 50%;
  left: 50%;
  background: black;
  border-radius: 999rem;
  transform: translate(-50%, -50%);
}

.mouth {
  position: absolute;
  height: 30%;
  width: 70%;
  bottom: 5%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.mouth-inner {
  height: 100%;
  width: 100%;
  background: radial-gradient(circle, #371b2a 0%, #080205 100%);
}

.lips {
  position: absolute;
  height: 100%;
  width: 100%;
  border-radius: 999rem;
  box-shadow: 0 4px 4px 1px rgba(255, 255, 255, 0.5), 0 -1px 4px 1px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.lips:before {
  content: "";
  position: absolute;
  height: 100%;
  width: 100%;
  border-radius: 999rem;
  box-shadow: inset 1px 1px 10px black;
  z-index: 2;
}

.lip-upper,
.lip-lower {
  position: absolute;
  height: 50%;
  width: 100%;
  background: .........完整代码请登录后点击上方下载按钮下载查看

网友评论0