纯css模拟日食全过程带星星动画效果

代码语言:html

所属分类:动画

代码描述:纯css模拟日食全过程带星星动画效果

代码标签: 日食 全过程 星星 动画 效果

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


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

<style>
body {
  position: absolute;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  -moz-animation: bgcolor 9s ease-in-out infinite;
  -webkit-animation: bgcolor 9s ease-in-out infinite;
  animation: bgcolor 9s ease-in-out infinite;
}

#sun {
  position: absolute;
  top: 50%;
  left: 50%;
  -moz-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  width: 250px;
  height: 250px;
  -moz-border-radius: 250px;
  -webkit-border-radius: 250px;
  border-radius: 250px;
  -moz-border-radius: 100%;
  -webkit-border-radius: 100%;
  border-radius: 100%;
  background: #ffad00;
  z-index: 1;
}

#sun::before {
  content: "";
  display: block;
  position: absolute;
  top: 3px;
  left: 3px;
  width: 244px;
  height: 244px;
  -moz-border-radius: 244px;
  -webkit-border-radius: 244px;
  border-radius: 244px;
  -moz-animation: bgcolor 9s ease-in-out infinite, moon 9s ease-in-out infinite;
  -webkit-animation: bgcolor 9s ease-in-out infinite, moon 9s ease-in-out infinite;
  animation: bgcolor 9s ease-in-out infinite, moon 9s ease-in-out infinite;
}

.star {
  background: #fff;
  height: 2px;
  width: 2px;
  position: absolute;
  -moz-border-radius: 2px;
  -webkit-border-radius: 2px;
  border-radius: 2px;
  -moz-animation: twinkle 5s infinite;
  -webkit-animation: twinkle 5s infinite;
  animation: twinkle 5s infinite;
}
.star:nth-of-type(1) {
  animation-delay: -15s;
  top: 29vh;
  left: 42vw;
}
.star:nth-of-type(2) {
  animation-delay: -4s;
  top: 84vh;
  left: 82vw;
}
.star:nth-of-type(3) {
  animation-delay: -7s;
  top: 39vh;
  left: 47vw;
}
.star:nth-of-type(4) {
  animation-delay: -3s;
  top: 88vh;
  left: 29vw;
}
.star:nth-of-type(5) {
  animation-delay: -6s;
  top: 65vh;
  left: 73vw;
}
.star:nth-of-type(6) {
  animation-delay: -10s;
  top: 9vh;
  left: 28vw;
}
.star:nth-of-type(7) {
  animation-delay: -4s;
  top: 54vh;
  left: 28vw;
}
.star:nth-of-type(8) {
  animation-delay: -17s;
  top: 19vh;
  left: 10vw;
}
.star:nth-of-type(9) {
  animation-delay: -5s;
  top: 41vh;
  left: 41vw;
}
.star:nth-of-type(10) {
  animation-delay: -4s;
  top: 49vh;
  left: 52vw;
}
.star:nth-of-type(11) {
  animation-delay: -17s;
  top: 89vh;
  left: 53vw;
}
.star:nth-of-type(12) {
  animation-delay: -10s;
  top: 90vh;
  left: 61vw;
}
.star:nth-of-type(13) {
  animation-delay: -1s;
  top: 80vh;
  left: 64vw;
}
.star:nth-of-type(14) {
  animation-delay: -12s;
  top: 15vh;
  left: 10vw;
}
.star:nth-of-type(15) {
  animation-delay: -18s;
  top: 23vh;
  left: 67vw;
}
.star:nth-of-type(16) {
  animation-delay: -8s;
  top: 23vh;
  left: 83vw;
}
.star:nth-of-type(17) {
  animation-delay: -14s;
  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0