单个div+css实现太空宇航员旋转位移动画效果代码

代码语言:html

所属分类:动画

代码描述:单个div+css实现太空宇航员旋转位移动画效果代码

代码标签: 单个 div css 太空 宇航员 旋转 位移 动画

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

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

<head>
  <meta charset="UTF-8">

  
  
  
<style>
@keyframes float {
  0% {
    transform: translate(-110vw, -40%) rotate(0);
  }
  100% {
    transform: translate(55vw, -60%) rotate(500deg);
  }
}

@media (prefers-reduced-motion) {
  .space::before {
    animation: none !important;
  }
}

.space {
  font-size: 1vmin;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    /* planet */
    radial-gradient(50% 25% at 7% 3%, #e70 8%, #0000 0),
    radial-gradient(circle at 17% 10%, #e70 2%, #0000 0),
    radial-gradient(circle at 20% 2%, #e70 3.5%, #0000 0),
    radial-gradient(circle at 10% 0, darkorange 15%, #0000 0),
    /* stars */
    radial-gradient(circle at 20% 20%, #fff8 0.25%, #0000 0),
    radial-gradient(circle at 40% 34%, #fff8 0.5%, #0000 0) 20% 50% / 60% 60%,
    radial-gradient(circle at 40% 34%, #fff8 0.5%, #0000 0) 50% 20% / 60% 60%,
    radial-gradient(circle at 30% 38%, #fff8 0.25%, #0000 0),
    radial-gradient(circle at 40% 34%, #fff8 0.65%, #0000 0) 10% -10% / 50% 50%,
    /* base */
    linear-gradient(#0000, #0002),
    #123;
  
  &::before {
    animation: float 30s linear infinite;
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60em;
    height: 60em;
    clip-path: polygon(0 0, 100% 0, 100% 90%, 50% 100%, 0 90%);
    background:
      /* head */
      radial-gradient(circle at 54% 11%, #cffc 2%, #0000 0),
      radial-gradient(circle at 59% 14%, #cffc 3%, #0000 0),
      radial-gradient(50% 45% at 50% 50%, #123 99%, #0000) 50% 6.6% / 31% 25%,
      radial-gradient(50% 50% at 50% 50%, #aaa 99%, #0000) 50% 5% / 32% 25%,
      radial-gradient(farthest-side at 50% 0, #889 99%, #0000) 50% 20% / 32% 16%,
      radial-gradient(closest-side circle at 50% 16%, #eee 99%, #eee0),
      radial-gradient(40% 50% at 35% 17%, #eee 10%, #0000 0),
      radial-gradient(40% 50% at 65% 17%, #eee 10%, #0000 0),
      /* body */
      linear-gradient(#aaa 0 0) 40% 64.5% / 5% 8%,
      linear-gradient(#aaa 0 0) 60% 64.5% / 5% 8%,
      linear-gradient(#ccc 0 0) 50% 64% / 35.5% 6%,
      linear-gradient(orange 0 0) 46% 46% / 3% 7%,
      radial-gradient(circle at 54% 45%, red 1%, #0000 0),
      radial-gradient(circle at 54% 48%, green 1%, #0000.........完整代码请登录后点击上方下载按钮下载查看

网友评论0