太阳系星球运行模拟动画

代码语言:html

所属分类:动画

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

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

<title> Animated atom SVG</title>
<style>
  :root {
  --color-background-body: #333;
  --color-particle-fill: #ababab;
  --color-ring-stroke: #fff;
}

.theme-brad {
  --color-background-body: #f6f5de;
  --color-particle-fill: #be6701;
  --color-ring-stroke: #110000;
}

body {
  background-color: var(--color-background-body);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background-color 0.5s ease-in-out;
}

.atom {
  width: 200vw;
  height: 200vh;
}

.nucleus {
  fill: var(--color-particle-fill);
  stroke: var(--color-particle-fill);
  transition: all 0.5s ease-in-out;
  -webkit-animation: nucleus-pulse 2s infinite ease-in-out alternate;
          animation: nucleus-pulse 2s infinite ease-in-out alternate;
}

.electron {
  fill: var(--color-particle-fill);
  stroke: var(--color-particle-fill);
  transition: all 0.5s ease-in-out;
  -webkit-animation: rotate 10s infinite linear, electron-pulse 1s infinite ease-in-out alternate;
          animation: rotate 10s infinite linear, electron-pulse 1s infinite ease-in-out alternate;
}

.ring {
  stroke: var(--color-ring-stroke);
  -webkit-animation: ring-width 1s infinite ease-in-out alternate;
          animation: ring-width 1s infinite ease-in-out alternate;
}

.ring:nth-of-type(1) {
  -webkit-animation-delay: 0.1s;
          animation-delay: 0.1s;
}

.ring:nth-of-type(2) {
  -webkit-animation-delay: 0.2s;
          animation-delay: 0.2s;
}

.ring:nth-of-type(3) {
  -webkit-animation-delay: 0.3s;
          animation-delay: 0.3s;
}

.ring:nth-of-type(4) {
  -webkit-animation-delay: 0.4s;
          animation-delay: 0.4s;
}

.ring:nth-of-type(5) {
  -webkit-animation-delay: 0.5s;
          animation-delay: 0.5s;
}

.ring:nth-of-type(6) {
  -webkit-animation-delay: 0.6s;
          animation-delay: 0.6s;
}

.ring:nth-of-type(7) {
  -webkit-animation-delay: 0.7s;
          animation-delay: 0.7s;
}

.ring:nth-of-type(8) {
  -webkit-animation-delay: 0.8s;
          animation-delay: 0.8s;
}

.ring:nth-of-type(9) {
  -webkit-animation-delay: 0.9s;
          animation-delay: 0.9s;
}

.ring:nth-of-type(10) {
  -webkit-animation-delay: 1s;
          animation-delay: 1s;
}

.ring:nth-of-type(11) {
  -webkit-animation-delay: 1.1s;
          animation-delay: 1.1s;
}

.ring:nth-of-type(12) {
  -webkit-animation-delay: 1.2s;
          animation-delay: 1.2s;
}

.ring:nth-of-type(13) {
  -webkit-animation-delay: 1.3s;
          animation-delay: 1.3s;
}

.ring:nth-of-type(14) {
  -webkit-animation-delay: 1.4s;
          animation-delay: 1.4s;
}

.ring:nth-of-type(15) {
  -webkit-animation-delay: 1.5s;
          animation-delay: 1.5s;
}

.ring:nth-of-type(16) {
  -webkit-animation-delay: 1.6s;
          animation-delay: 1.6s;
}

.ring:nth-of-type(17) {
  -webkit-animation-delay: 1.7s;
          animation-delay: 1.7s;
}

.ring:nth-of-type(18) {
  -webkit-animation-delay: 1.8s;
          animation-delay: 1.8s;
}

.ring:nth-of-type(19) {
  -webkit-animation-delay: 1.9s;
          animation-delay: 1.9s;
}

.ring:nth-of-type(20) {
  -webkit-animation-delay: 2s;
          animation-delay: 2s;
}

@-webkit-keyframes ring-width {
  0% {
    stroke-width: 15;
  }
  100% {
    stroke-width: 2;
  }
}

@keyframes ring-width {
  0% {
    stroke-width: 15;
  }
  100% {
    stroke-width: 2;
  }
}
@-webkit-keyframes nucleus-pulse {
  0% {
    stroke-width: 0;
  }
  100% {
    stroke-width: 12;
  }
}
@keyframes nucleus-pulse {
  0% {
    stroke-width: 0;
  }
  100% {
    stroke-width: 12;
  }
}
@-webkit-keyframes electron-pulse {
  0% {
    stroke-width: 6;
  }
  100% {
    stroke-width: 3;
  }
}
@keyframes electron-pulse {
  0% {
    stroke-width: 6;
  }
  100% {
    stroke-width: 3;
  }
}
@-webkit-keyframes rotate {
  0% {
    -webkit-transform: rotate(0);
            transform: rotate(0);
  }
  100% {
    -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
  }
}
@keyframes rotate {
  0% {
    -webkit-transform: rotate(0);
            transform: rotate(0);
  }
  100% {
    -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
  }
}
.theme-switch-btn {
  position: absolute;
  top: 0;
  left: 0;
  background: #808080;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0