div+css实现荡秋千的小女孩动画效果代码

代码语言:html

所属分类:动画

代码描述:div+css实现荡秋千的小女孩动画效果代码

代码标签: div css 荡秋千 小女孩 动画

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


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

<head>

  <meta charset="UTF-8">
  

  
<style>
.wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  transform: translate(-50%, -50%) scale(1.2);
}
.wrapper .pole {
  position: absolute;
  width: 5px;
  height: 250px;
  left: 50%;
  transform-origin: center top;
  transform: translateX(-50%) rotate(-25deg);
  color: silver;
  background: currentColor;
}
.wrapper .pole.two {
  transform: translateX(-50%) rotateY(-180deg) rotate(-25deg);
}
.wrapper .pole:before {
  content: "";
  position: absolute;
  top: -10px;
  left: -7px;
  width: 20px;
  height: 20px;
  border-radius: 100%;
  background: currentColor;
}
.wrapper .pole:after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 20px;
  height: 5px;
  transform: translateX(-50%) rotate(25deg);
  background: currentColor;
}
.wrapper .swing {
  position: absolute;
  width: 40px;
  height: 100%;
  left: calc(50% - 20px);
  transform-origin: center top;
  -webkit-animation-duration: 0.8s;
          animation-duration: 0.8s;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
  -webkit-animation-timing-function: ease-in-out;
          animation-timing-function: ease-in-out;
  -webkit-animation-direction: alternate;
          animation-direction: alternate;
}
.wrapper .swing .human {
  position: absolute;
  width: 40px;
  height: 80px;
  bottom: 5px;
  z-index: -1;
}
.wrapper .swing .human .top-part {
  position: absolute;
  width: 40px;
  height: 80px;
  bottom: 5px;
  transform-origin: center bottom;
  -webkit-animation-name: body-animation;
          animation-name: body-animation;
  -webkit-animation-duration: 0.8s;
          animation-duration: 0.8s;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
  -webkit-animation-timing-function: ease-in-out;
          animation-timing-function: ease-in-out;
  -webkit-animation-direction: alternate;
          animation-direction: alternate;
}
.wrapper .swing .human .top-part .head {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background: #d59e7b;
  border-radius: 100%;
  z-index: 2;
}
.wrapper .swing .human .top-part .head .hair {
  position: absolute;
  top: -5px;
  left: -10px;
  background: black;
  width: 22px;
  height: 44px;
  border-top-right-radius: 0%;
  border-top-left-radius: 100%;
  border-bottom-right-radius: 75%;
  border-bottom-left-radius: 10%;
  z-index: 2;
}
.wrapper .swing .human .top-part .head .fringe {
  position: absolute;
  top: -5px;
  left: 0;
  width: 0px;
  height: 0px;
  border-top: 10px solid black;
  border-bottom: 10px solid black;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-radius: 100%;
  transform: rotate(45deg);
}
.wrapper .swing .human .top-part .head .eye {
  content: "";
  position: absolute;
  top: 6px;
  right: 2px;
  width: 2px;
  height: 2px;
  background: black;
  border-radius: 100%;
}
.wrapper .swing .human .top-part .head .mouth {
  position: absolute;
  top: 10px;
  right: 0px;
  width: 0px;
  height: 0px;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  border-left: 3px solid transparent;
  border-right: 3px solid white;
  border-radius: 100%;
  transform: rotate(28deg);
}
.wrapper .swing .human .top-part .body {
  position: absolute;
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%);
  background: #ee5130;
  width: 20px;
  height: 40px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}
.wrapper .swing .human .top-part .body .hand {
  position: absolute;
  top: 20%;
  left: 10%;
}
.wrapper .swing .human .top-part .body .hand .hand-one {
  position: absolute;
  transform: rotate(30deg);
  width: 5px;
  height: 15px;
  background: #ee5130;
  box-shadow: 0 -1px 0px 1px rgba(0, 0, 0, .........完整代码请登录后点击上方下载按钮下载查看

网友评论0