css布局实现一个蚂蚱交互动画效果代码

代码语言:html

所属分类:动画

代码描述:css布局实现一个蚂蚱交互动画效果代码

代码标签: 一个 蚂蚱 交互 动画 效果

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


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

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
body {
  align-content: center;
  background: #9b7653;
  cursor: crosshair;
  display: grid;
  grid-template-columns: 1fr auto auto 1fr;
  grid-template-rows: 1fr auto auto 1fr;
  justify-content: center;
  margin: 0;
  overflow: hidden;
  padding: 0;
  width: 100vw;
  height: 100vh;
}

#mantis {
  grid-area: 2/2/4/4;
  position: relative;
}
#mantis .head {
  background: #74c365;
  border-radius: 50%;
  position: relative;
  top: 4vmin;
  left: 8vmin;
  transform: rotate(25deg);
  transition: transform 100ms, top 100ms, left 100ms;
  width: 8vmin;
  height: 3vmin;
  z-index: 2;
}
#mantis .head::before, #mantis .head::after {
  background: inherit;
  border-radius: 50%;
  content: "";
  display: block;
  position: absolute;
}
#mantis .head::before {
  background: linear-gradient(#85ca77, #85ca77 10%, #74c365 10%);
  bottom: 0.1vmin;
  left: -0.3vmin;
  transform: rotate(18deg);
  width: 66%;
  height: 200%;
}
#mantis .head::after {
  bottom: 1.75vmin;
  left: 0.5vmin;
  transform: rotate(35deg);
  width: 100%;
  height: 100%;
}
#mantis .head .eye {
  background: #85ca77;
  border-radius: 50% 50% 50% 33%;
  position: absolute;
  bottom: 0;
  left: -0.25vmin;
  transform: rotate(20deg);
  width: 5vmin;
  height: 4vmin;
  z-index: 1;
}
#mantis .head .eye::after {
  -webkit-anima.........完整代码请登录后点击上方下载按钮下载查看

网友评论0