纯css实现日全食的原理解释动画效果

代码语言:html

所属分类:动画

代码描述:纯css实现日全食的原理解释动画效果

代码标签: 日全食 原理 解释 动画 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
body {
  background: #21223a;
}

.container {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.sun {
  width: 150px;
  height: 150px;
  background: #fffaa9;
  border-radius: 100%;
  box-shadow: 0 0 60px #ffcfa9, 0 0 100px #b9a018;
  position: relative;
  left: 250px;
}
.sun .left-eye, .sun .left-eye::after {
  position: relative;
  border-top-right-radius: 90px;
  border-top-left-radius: 90px;
  background: #ffcfa9;
  width: 25px;
  height: 12.5px;
  transform: scale(1.5);
  top: 60px;
  left: 30px;
  animation: sun-lefteye 2.3s ease-in-out infinite;
}
.sun .left-eye::after {
  content: "";
  position: absolute;
  background: #fffaa9;
  left: 0px;
  top: 3px;
  transform: scale(0.9);
  animation: sun-eye-smol 2.3s ease-in-out infinite;
}
.sun .right-eye, .sun .right-eye::after {
  position: absolute;
  border-top-right-radius: 90px;
  border-top-left-radius: 90px;
  background: #ffcfa9;
  width: 25px;
  height: 12.5px;
  transform: scale(1.5);
  top: 60px;
  left: 90px;
  animation: sun-righteye 2.3s ease-in-out infinite;
}
.sun .right-eye::after {
  content: "";
  position: absolute;
  background: #fffaa9;
  left: 0px;
  top: 3px;
  transform: scale(0.9);
  animation: sun-eye-smol 2.3s ease-in-out infinite;
}

.left-eyelash, .left-eyelash::after, .right-eyelash::after,
.right-eyelash {
  position: relative;
  width: 2.5px;
  height: 8px;
  background: #ffcfa9;
  border-radius: 200px;
}

.left-eyelash, .left-eyelash::after, .right-eyelash::after {
  top: 2px;
  transform: rotate(-45deg);
}
.left-eyelash::after, .right-eyelash::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 3px;
  transform: rotate(5deg);
}

.right-eyelash {
  top: -1px;
  left: 21px;
  transform: rotate(45deg);
}
.right-eyelash::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 3px;
}

.rays {
  position: absolute;
  transform-origin: center;
  margin: auto;
  width: 150px;
  z-index: -1;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  animation: spin 120s linear infinite;
}

.beam {
  background: linear-gradient(0deg, rgba(255, 255, 255, 0), #ffcfa9 40%, #ffcfa9);
  margin-left: 10px;
  border-radius: 50% 50% 0 0;
  position: absolute;
  opacity: 0.03;
  height: 110px;
}
.beam:nth-child(1) {
  width: 40px;
  transform: rotate(180deg);
  top: -90px;
  left: 42px;
}
.beam:nth-child(2) {
  width: 30px;
  transform: rotate(210deg);
  right: -5px;
  top: -80px;
}
.beam:nth-child(3) {
  width: 50px;
  transform: rotate(255deg);
  top: -20px;
  right: -65px;
}
.beam:nth-child(4) {
  width: 24px;
  transform: rotate(300deg);
  top: 60px;
  left: 150px;
}
.beam:nth-child(5) {
  width: 40px;
  top: 135px;
  left: 40px;
}
.beam:nth-child(6) {
  width: 30px;
  transform: rotate(-35deg);
  top: 115px;
  right: -12px;
}
.beam:nth-child(7) {
  width: 45px;
  transform: rotate(45deg);
  top: 100px;
  left: -45px;
}
.beam:nth-child(8) {
  width: 20px;
  transform: rotate(75deg);
  top: 40px;
  left: -70px;
}
.beam:nth-child(9) {
  width: 50px;
  transform: rotate(-250deg);
  top: -30px;
  left: -70px;
}
.beam:nth-child(10) {
  width: 20px;
  transform: rotate(145deg);
  top: -80px;
  left: -15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
@keyframes sun-lefteye {
  50% {
    left: 40px;
  }
}
@keyframes sun-eye-smol {
  50% {
    left: 0px;
  }
}
@keyframes sun-righteye {
  50% {
    left: 100px;
  }
}
.moon {
  width: 80px;
  height: 80px;
  background: #e3e7ea;
  border-radius: 100%.........完整代码请登录后点击上方下载按钮下载查看

网友评论0