纯css布局实现一个机器人动物行走动画效果代码

代码语言:html

所属分类:动画

代码描述:纯css布局实现一个机器人动物行走动画效果代码

代码标签: 实现 一个 机器人 动物 行走 动画 效果

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


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

<head>

  <meta charset="UTF-8">
  

  
  
<style>
* {
  -khtml-box-sizing: border-box;
  -ms-box-sizing: border-box;
  box-sizing: border-box;
  *behavior: url(js/libs/boxsizing.htc);
}
html,
body {
  width: 100%;
  height: 100%;
}
body {
  margin: 0;
  line-height: 1;
  color: #000;
  background: #0092ff;
}
section {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 500px;
  overflow: hidden;
}
.bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 70%;
  z-index: 1;
}
.bg .star {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 6px;
  background: #fff;
  opacity: 0.5;
  filter: alpha(opacity=50);
}
.bg .star-small {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 3px;
  background: #fff;
  opacity: 0.5;
  filter: alpha(opacity=50);
}
.bg .star-1 {
  left: 5%;
  top: 40%;
}
.bg .star-2 {
  left: 20%;
  top: 5%;
}
.bg .star-3 {
  left: 40%;
  top: 20%;
}
.bg .star-4 {
  left: 60%;
  top: 5%;
}
.bg .star-5 {
  left: 80%;
  top: 60%;
}
.bg .star-6 {
  left: 95%;
  top: 10%;
}
.bg .star-small-1 {
  left: 10%;
  top: 15%;
}
.bg .star-small-2 {
  left: 14%;
  top: 25%;
}
.bg .star-small-3 {
  left: 8%;
  top: 60%;
}
.bg .star-small-4 {
  left: 25%;
  top: 40%;
}
.bg .star-small-5 {
  left: 18%;
  top: 75%;
}
.bg .star-small-6 {
  left: 50%;
  top: 40%;
}
.bg .star-small-7 {
  left: 60%;
  top: 20%;
}
.bg .star-small-8 {
  left: 70%;
  top: 40%;
}
.bg .star-small-9 {
  left: 90%;
  top: 20%;
}
.bg .star-small-10 {
  left: 85%;
  top: 40%;
}
.moon {
  position: absolute;
  left: 50%;
  top: 25%;
  margin: -60px 0 0 -260px;
  width: 180px;
  height: 180px;
  border-radius: 90px;
  background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.99) 1%, rgba(255, 255, 255, 0) 70%);
  transform: rotate(90deg);
  z-index: 5;
}
.mountain-first {
  position: absolute;
  left: 0;
  top: 50%;
  margin-top: -260px;
  width: 550px;
  height: 400px;
  z-index: 1;
}
.mountain-first:before {
  content: '';
  position: absolute;
  left: -100px;
  bottom: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 300px 300px 200px;
  border-color: transparent transparent #4cb3ff transparent;
  z-index: 2;
}
.mountain-first:after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 60%;
  background: linear-gradient(to bottom, rgba(125, 185, 232, 0) 0%, #0092ff 65%);
  opacity: 0.8;
  filter: alpha(opacity=80);
  z-index: 4;
}
.mountain-first .mountain-shadow {
  position: absolute;
  left: -100px;
  bottom: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 450px 300px 200px;
  border-color: transparent transparent #7bc7ff transparent;
}
.mountain-second {
  position: absolute;
  right: -10px;
  top: 50%;
  margin-top: -240px;
  width: 500px;
  height: 400px;
  z-index: 1;
}
.mountain-second:before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 350px 350px 300px;
  border-color: transparent transparent #4cb3ff transparent;
  z-index: 2;
}
.mountain-second:after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(125, 185, 232, 0) 0%, #0092ff 65%);
  opacity: 0.8;
  filter: alpha(opacity=80);
  z-index: 4;
}
.mountain-second .mountain-shadow {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 650px 350px 300px;
  border-color: transparent transparent #7bc7ff transparent;
}
.mountain-second .mountain-top {
  position: absolute;
  left: 50%;
  top: 110px;
  margin: 0 0 0 30px;
  width: 50px;
  height: 50px;
  z-index: 8;
}
.mountain-second .mountain-top:after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  border-style: solid;
  border-width: 0 50px 20px 50px;
  border-color: transparent transparent #50b4ff transparent;
  transform: rotate(-125deg);
}
.mountain-second .mountain-top:before {
  content: '';
  position: absolute;
  left: -5px;
  top: 0;
  border-style: solid;
  border-width: 0 50px 20px 50px;
  border-color: transparent transparent #50b4ff transparent;
  transform: rotate(30deg);
}
.first-bg {
  position: absolute;
  left: -10%;
  top: 50%;
  margin-top: 120px;
  width: 120%;
  height: 10px;
  border-bottom: 580px solid #104166;
  border-left: 8px solid transparent;
  border-right: 14px solid transparent;
  height: 0;
  transform: rotate(2deg);
  z-index: 100;
}
.first-bg-anim {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
}
.first-bg-anim .first {
  position: absolute;
  left: -10%;
  bottom: -5px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 160px 60px 80px;
  border-color: transparent transparent #104166 transparent;
  -webkit-animation: first-rock 30s infinite;
          animation: first-rock 30s infinite;
  -webkit-animation-fill-mode: forwards;
          animation-fill-mode: forwards;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
}
.first-bg-anim .first:before {
  content: '';
  position: absolute;
  left: 0px;
  top: 30px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 60px 20px 40px;
  border-color: transparent transparent #0c4a78 transparent;
  transform: rotate(-160deg);
}
.first-bg-anim .second {
  position: absolute;
  left: -10%;
  bottom: -5px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 80px 80px 160px;
  border-color: transparent transparent #104166 transparent;
  -webkit-animation: first-rock 30s infinite;
          animation: first-rock 30s infinite;
  -webkit-animation-delay: 8s;
          animation-delay: 8s;
  -webkit-animation-fill-mode: forwards;
          animation-fill-mode: forwards;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
}
.first-bg-anim .second:before {
  content: '';
  position: absolute;
  left: -30px;
  top: 35px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 20px 40px 60px;
  border-color: transparent transparent #0c4a78 transparent;
  transform: rotate(-135deg);
}
.first-bg-anim .third {
  position: absolute;
  left: -10%;
  bottom: -5px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 160px 60px 80px;
  border-color: transparent transparent #104166 transparent;
  -webkit-animation: first-rock 30s infinite;
          animation: first-rock 30s infinite;
  -webkit-animation-delay: 16s;
          animation-delay: 16s;
  -webkit-animation-fill-mode: forwards;
          animation-fill-mode: forwards;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
}
.first-bg-anim .third:before {
  content: '';
  position: absolute;
  left: 0px;
  top: 30px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 60px 20px 40px;
  border-color: transparent transparent #0c4a78 transparent;
  transform: rotate(-160deg);
}
.first-bg-anim .last {
  position: absolute;
  left: -10%;
  bottom: -5px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 80px 80px 160px;
  border-color: transparent transparent #104166 transparent;
  -webkit-animation: first-rock 30s infinite;
          animation: first-rock 30s infinite;
  -webkit-animation-delay: 24s;
          animation-delay: 24s;
  -webkit-animation-fill-mode: forwards;
          animation-fill-mode: forwards;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
}
.first-bg-anim .last:before {
  content: '';
  position: absolute;
  left: -30px;
  top: 35px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 20px 40px 60px;
  border-color: transparent transparent #0c4a78 transparent;
  transform: rotate(-135deg);
}
.second-bg-anim {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
}
.second-bg-anim .first-rock-content {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  -webkit-animation: rock 20s infinite;
          animation: rock 20s infinite;
  -webkit-animation-fill-mode: forwards;
          animation-fill-mode: forwards;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
}
.second-bg-anim .second-rock-content {
  position: absolute;
  left: -100%;
  top: 0;
  width: 100%;
  height: 100%;
  -webkit-animation: rock 20s infinite;
          animation: rock 20s infinite;
  -webkit-animation-fill-mode: forwards;
          animation-fill-mode: forwards;
  -webkit-animation-timing-function: linear;
          animation-timing-function: linear;
}
.second-bg-anim .rock {
  position: absolute;
  overflow: hidden;
}
.second-bg-anim .rock:before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  border-radius: 50px;
  background: #0c4a78;
}
.second-bg-anim .rock-middle {
  width: 60px;
  height: 10px;
}
.second-bg-anim .rock-middle:before {
  margin: 0 0 0 -50px;
  width: 100px;
  height: 100px;
}
.second-bg-anim .rock-big {
  width: 76px;
  height: 22px;
}
.second-bg-anim .rock-big:before {
  margin: 0 0 0 -50px;
  width: 100px;
  height: 100px;
}
.second-bg-anim .rock-content {
  position: absolute;
  top: 0;
  width: 25%;
  height: 100%;
}
.second-bg-anim .rock-content-1 {
  display: block;
  left: 0;
}
.second-bg-anim .rock-content-2 {
  display: block;
  left: 20%;
  top: -20px;
}
.second-bg-anim .rock-content-3 {
  display: none;
  left: 40%;
  top: 30px;
}
.second-bg-anim .rock-content-4 {
  left: 60%;
  top: -20px;
}
.second-bg-anim .rock-content-5 {
  left: 80%;
}
.second-bg-anim .rock-content-6 {
  display: none;
  left: 90%;
}
.second-bg-anim .rock-1 {
  left: 70%;
  top: 240px;
}
.second-bg-anim .rock-2 {
  left: 40%;
  top: 150px;
}
.second-bg-anim .rock-3 {
  display: none;
  left: 90%;
  top: 70px;
}
.second-bg-anim .rock-7 {
  left: 32%;
  top: 50px;
}
.second-bg-anim .rock-8 {
  left: 64%;
  top: 110px;
  display: none;
}
.second-bg-anim .rock-9 {
  left: 80%;
  top: 130px;
  display: none;
}
.second-bg-anim .rock-10 {
  left: 74%;
  top: 200px;
  display: none;
}
.second-bg-anim .ro.........完整代码请登录后点击上方下载按钮下载查看

网友评论0