css实现宇航员飞天动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现宇航员飞天动画效果代码

代码标签: css 宇航员 飞天 动画

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

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

<head>
    <meta charset="UTF-8">
    <style>
        *,
    *:after,
    *:before {
      box-sizing: border-box;
    }
    
    body {
      display: flex;
      height: 100vh;
      background-color: #08121c;
      background-image: radial-gradient(white, rgba(255, 255, 255, 0.2) 2px, transparent 10px), radial-gradient(white, rgba(255, 255, 255, 0.15) 1px, transparent 10px), radial-gradient(white, rgba(255, 255, 255, 0.1) 2px, transparent 5px), radial-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1) 2px, transparent 1px);
      background-size: 550px 550px, 350px 350px, 250px 250px, 150px 150px;
      background-position: 0 0, 40px 60px, 130px 270px, 70px 100px;
      overflow: hidden;
    }
    
    .astronaut {
      position: relative;
      margin: auto;
      transform: translatey(-100px);
    }
    .astronaut:after {
      content: "";
      position: absolute;
      top: 130px;
      z-index: -1;
      width: 15px;
      height: 210px;
      border-radius: 0 0 20px 20px;
      box-shadow: 30px 0 0 0 #A682FF, 45px 0 0 0 #715AFF, 60px 0 0 0 #5887FF, 75px 0 0 0 #55C1FF, 90px 0 0 0 #a0f8fe;
    }
    .astronaut:before {
      content: "";
      position: absolute;
      top: 285px;
      left: -100px;
      z-index: 1;
      width: 50px;
      height: 50px;
      border-radius: 50%;
      -webkit-animation: bubbles 0.5s infinite alternate;
              animation: bubbles 0.5s infinite alternate;
    }
    
    .body {
      -webkit-animation: shake 1.5s infinite alternate;
              animation: shake 1.5s infinite alternate;
    }
    
    .backpack {
      background: #ddd;
      width: 135px;
      height: 100px;
      border: 2px solid;
      border-radius: 40px;
    }
    
    .hands {
      position: absolute;
      top: 100px;
      left: 50%;
      background: #ddd;
      width: 160px;
      height: 90px;
      border: 2px solid;
      border-radius: 50px;
      transform: translate(-50%, -50%);
    }
    
    .chest {
      position: absolute;
      top: 85px;
      left: 50%;
      background: #fff;
      width: 160px;
      height: 75px;
      border: 2px solid;
      border-radius: 30px 30px 0 0;
      transform: translate(-50%, -50%);
    }
    
    .leg {
      position: absolute;
      top: 90px;
      left: 16px;
      background: #fff;
      width: 53px;
      height: 100px;
      border: 2px solid;
      border-top: 0;
      border-radius: 0 0 50px 50px;
    }
    .leg.right-leg {
      right: 16px;
      left: auto;
    }
    
    .head {
      position: absolute;
      top: 41px;
      left: 50%;
      background: #fff;
      width: 100px;
      height: 100px;
      border: 2px solid;
      border-radius: 50%;
      transform: translate(-50%, -50%);
    }
    .head:after {
      content: "";
      position: absolute;
      top: -15px;
      left: 50%;
      background: #333;
      width: 5px;
      height: 15px;
      transform: translatex(-50%);
    }
    .head:before {
      content: "";
      position: absolute;
      z-index: 1;
      top: -30px;
      left: 50%;
      background: #62e6b8;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      transform: translatex(-50%);
      box-shadow: 0 0 0 5px rgba(98, 230, 184, 0.2), 0 0 0 10px rgba(98, 230, 184, 0.1);
    }
    
    .head-front {
      position: absolute;
      top: 50px;
      left: 50%;
      background: #fff;
      width: 100px;
      height: 50px;
      border: 2px solid;
      border-radius: 50%/20% 20% 40% 40%;
      transform: translate(-50%, -50%);
    }
    .head-front:after {
      content: "";
      position: absolute;
      top: -1px;
      right: 0;
      bottom: 0;
      left: 0;
      background: linear-gradient(to right, #978afe, #8ac1ae);
      border-radius: 50%/20% 20% 40% 40%;
    }
    
    .crotch {
      position: absolute;
      bottom: -55px;
      left: 50%;
      background: #fff;
      width: 35px;
      height: 15px;
      border-bottom: 2px solid;
      transform: translate(-50%, -50%);
    }
    
    .badge {
      position: absolute;
      top: 105px;
      left: 68%;
      width: 20px;
      height: 20px;
      background: #6FB5E9;
      font: verdanda 13px/14px;
      color: #fff;
      text-align: center;
      border-radius: 50%;
      border: 2px solid red;
      transform: translate(-50%, -50%);
    }
    
    .star {
      position: absolute;
      z-index: 50;
      top: 50px;
      left: 0;
      background-color: #fff;
      width: 1px;
      height: 1px;
      box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.02), 0 0 0 10px rgba(255, 255, 255, 0.05);
      border-radius: 50%;
      -webkit-animation: shooting 5s linear infinite;
              animation: shooting 5s linear infinite;
    }
    .star:before {
      content: "";
      position: absolute;
      top: 0;
      right: 1px;
      width: 100px;
      height: 1px;
      background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.4) 100%);
    }
    
    .star-2 {
      top: 100px;
      left: -100px;
      -webkit-animation: shooting 8s 1s linear infinite;
              animation: shooting 8s 1s linear infinite;
    }
    
    .star-3 {
      top: 250px;
      left: -250px;
      -webkit-animation: shooting 3s 2s linear infinite;
              animation: shooting 3s 2s linear infinite;
    }
    
    .star-4 {
      top: 50px;
      left: -50px;
      -webkit-animation: shooting 3s 2s linear infinite;
              animation: shooting 3s 2s linear infinite;
    }
    
    .star-5 {
      top: 150px;
      left: -150px;
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0