css实现三维多边形球动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现三维多边形球动画效果代码

代码标签: 多边形 动画 效果

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


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

<head>

  <meta charset="UTF-8">

  
  
  
<style>
*, *::before, *::after {
  padding: 0;
  margin: 0 auto;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1125px;
  background-image: radial-gradient(circle, #000, #222);
}

.ball {
  position: relative;
  transform-style: preserve-3d;
  -webkit-animation: ball 60s infinite linear;
          animation: ball 60s infinite linear;
  --rx: 0deg;
  --ry: 0deg;
}
@-webkit-keyframes ball {
  from {
    transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  to {
    transform: rotateX(360deg) rotateY(720deg) rotateZ(360deg);
  }
}
@keyframes ball {
  from {
    transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  to {
    transform: rotateX(360deg) rotateY(720deg) rotateZ(360deg);
  }
}
.ball > :nth-child(1) {
  -webkit-animation-delay: -0.75s;
          animation-delay: -0.75s;
  -webkit-animation-duration: 3.8s;
          animation-duration: 3.8s;
}
.ball > :nth-child(1)::before {
  background-color: #9661ff;
}
.ball > :nth-child(2) {
  -webkit-animation-delay: -3.9125s;
          animation-delay: -3.9125s;
  -webkit-animation-duration: 5.45s;
          animation-duration: 5.45s;
}
.ball > :nth-child(2)::before {
  background-color: #a375ff;
}
.ball > :nth-child(3) {
  -webkit-animation-delay: -1.7875s;
          animation-delay: -1.7875s;
  -webkit-animation-duration: 5.3s;
          animation-duration: 5.3s;
}
.ball > :nth-child(3)::before {
  background-color: #8f57ff;
}
.ball > :nth-child(4) {
  -webkit-animation-delay: -1.7125s;
          animation-delay: -1.7125s;
  -webkit-animation-duration: 4.15s;
          animation-duration: 4.15s;
}
.ball > :nth-child(4)::before {
  background-color: #c5a8ff;
}
.ball > :nth-child(5) {
  -webkit-animation-delay: -3.875s;
          animation-delay: -3.875s;
  -webkit-animation-duration: 3.95s;
          animation-duration: 3.95s;
}
.ball > :nth-child(5)::before {
  background-color: #b48fff;
}
.ball > :nth-child(6) {
  -webkit-animation-delay: -0.1625s;
          animation-delay: -0.1625s;
  -webkit-animation-duration: 3.75s;
          animation-duration: 3.75s;
}
.ball > :nth-child(6)::before {
  background-color: #d6c2ff;
}
.ball > :nth-child(7) {
  -webkit-animation-delay: -4.775s;
          animation-delay: -4.775s;
  -webkit-animation-duration: 4.5s;
          animation-duration: 4.5s;
}
.ball > :nth-child(7)::before {
  background-color: #d3bdff;
}
.ball > :nth-child(8) {
  -webkit-animation-delay: -3.9625s;
          animation-delay: -3.9625s;
  -webkit-animation-duration: 5.4s;
          animation-duration: 5.4s;
}
.ball > :nth-child(8)::before {
  background-color: #d6c2ff;
}
.ball > :nth-child(9) {
  -webkit-animation-delay: -1.3375s;
          animation-delay: -1.3375s;
  -webkit-animation-duration: 4.35s;
          animation-duration: 4.35s;
}
.ball > :nth-child(9)::before {
  background-color: #7e3dff;
}
.ball > :nth-child(10) {
  -webkit-animation-delay: -2.8625s;
          animation-delay: -2.8625s;
  -webkit-animation-duration: 4.5s;
          animation-duration: 4.5s;
}
.ball > :nth-child(10)::before {
  background-color: #8f57ff;
}
.ball > :nth-child(11) {
  -webkit-animation-delay: -1.8625s;
          animation-delay: -1.8625s;
  -webkit-animation-duration: 5s;
          animation-duration: 5s;
}
.ball > :nth-child(11)::before {
  background-color: #ad85ff;
}
.ball > :nth-child(12) {
  -webkit-animation-delay: -4.1375s;
          animation-delay: -4.1375s;
  -webkit-animation-duration: 4.25s;
          animation-duration: 4.25s;
}
.ball > :nth-child(12)::before {
  background-color: #b18aff;
}
.ball > :nth-child(13) {
  -webkit-animation-delay: -0.3375s;
          animation-delay: -0.3375s;
  -webkit-animation-duration: 3.85s;
          animation-duration: 3.85s;
}
.ball > :nth-child(13)::before {
  background-color: #bb99ff;
}
.ball > :nth-child(14) {
  -webkit-animation-delay: -0.9s;
          animation-delay: -0.9s;
  -webkit-animation-duration: 4.9s;
          animation-duration: 4.9s;
}
.ball > :nth-child(14)::before {
  background-color: #9661ff;
}
.ball > :nth-child(15) {
  -webkit-animation-delay: -3.1375s;
          animation-delay: -3.1375s;
  -webkit-animation-duration: 4.5s;
          animation-duration: 4.5s;
}
.ball > :nth-child(15)::before {
  background-color: #cfb8ff;
}
.ball > :nth-child(16) {
  -webkit-animation-delay: -4.8375s;
          animation-delay: -4.8375s;
  -webkit-animation-duration: 5.4s;
          animation-duration: 5.4s;
}
.ball > :nth-child(16)::before {
  background-color: #bb99ff;
}
.ball > :nth-child(17) {
  -webkit-animation-delay: -1.75s;
          animation-delay: -1.75s;
  -webkit-animation-duration: 5.15s;
          animation-duration: 5.15s;
}
.ball > :nth-child(17)::before {
  background-color: #b894ff;
}
.ball > :nth-child(18) {
  -webkit-animation-delay: -2.275s;
          animation-delay: -2.275s;
  -webkit-animation-duration: 6.1s;
          animation-duration: 6.1s;
}
.ball > :nth-child(18)::before {
  background-color: #6d24ff;
}
.ball > :nth-child(19) {
  -webkit-animation-delay: -2.725s;
          animation-delay: -2.725s;
  -webkit-animation-duration: 4.1s;
          animation-duration: 4.1s;
}
.ball > :nth-child(19)::before {
  background-color: #884dff;
}
.ball > :nth-child(20) {
  -webkit-animation-delay: -3.2125s;
          animation-delay: -3.2125s;
  -webkit-animation-duration: 6.1s;
          animation-duration: 6.1s;
}
.ball > :nth-child(20)::before {
  background-color: #7733ff;
}
.ball > :nth-child(21) {
  -webkit-animation-delay: -2.15s;
          animation-delay: -2.15s;
  -webkit-animation-duration: 5.35s;
          animation-duration: 5.35s;
}
.ball > :nth-child(21)::before {
  background-color: #d6c2ff;
}
.ball > :nth-child(22) {
  -webkit-animation-delay: -1.4625s;
          animation-delay: -1.4625s;
  -webkit-animation-duration: 4.25s;
          animation-duration: 4.25s;
}
.ball > :nth-child(22)::before {
  background-color: #8b52ff;
}
.ball > :nth-child(23) {
  -webkit-animation-delay: -1.6875s;
          animation-delay: -1.6875s;
  -webkit-animation-duration: 3.9s;
          animation-duration: 3.9s;
}
.ball > :nth-child(23)::before {
  background-color: #7029ff;
}
.ball > :nth-child(24) {
  -webkit-animation-delay: -1.0625s;
          animation-delay: -1.0625s;
  -webkit-animation-duration: 3.9s;
          animation-duration: 3.9s;
}
.ball > :nth-child(24)::before {
  background-color: #ad85ff;
}
.ball > :nth-child(25) {
  -webkit-animation-delay: -4.475s;
          animation-delay: -4.475s;
  -webkit-animation-duration: 4.45s;
          animation-duration: 4.45s;
}
.ball > :nth-child(25)::before {
  background-color: #8f57ff;
}
.ball > :nth-child(26) {
  -webkit-animation-delay: -2.2375s;
          animation-delay: -2.2375s;
  -webkit-animation-duration: 4.8s;
          animation-duration: 4.8s;
}
.ball > :nth-child(26)::before {
  background-color: #8142ff;
}
.ball > :nth-child(27) {
  -webkit-animation-delay: -3.7125s;
          animation-delay: -3.7125s;
  -webkit-animation-duration: 6.2s;
          animation-duration: 6.2s;
}
.ball > :nth-child(27)::before {
  background-color: #c5a8ff;
}
.ball > :nth-child(28) {
  -webkit-animation-delay: -3.45s;
          animation-delay: -3.45s;
  -webkit-animation-duration: 4.15s;
          animation-duration: 4.15s;
}
.ball > :nth-child(28)::before {
  background-color: #6d24ff;
}
.ball > :nth-child(29) {
  -webkit-animation-delay: -0.275s;
          animation-delay: -0.275s;
  -webkit-animation-duration: 6.15s;
          animation-duration: 6.15s;
}
.ball > :nth-child(29)::before {
  background-color: #6d24ff;
}
.ball > :nth-child(30) {
  -webkit-animation-delay: -3.9875s;
          animation-delay: -3.9875s;
  -webkit-animation-duration: 3.75s;
          animation-duration: 3.75s;
}
.ball > :nth-child(30)::before {
  background-color: #aa80ff;
}
.ball > :nth-child(31) {
  -webkit-animation-delay: -4.825s;
          animation-delay: -4.825s;
  -webkit-animation-duration: 5.75s;
          animation-duration: 5.75s;
}
.ball > :nth-child(31)::before {
  background-color: #9966ff;
}
.ball > :nth-child(32) {
  -webkit-animation-delay: -1.625s;
          animation-delay: -1.625s;
  -webkit-animation-duration: 4.45s;
          animation-duration: 4.45s;
}
.ball > :nth-child(32)::before {
  background-color: #b18aff;
}
.ball > :nth-child(33) {
  -webkit-animation-delay: -1.0125s;
          animation-delay: -1.0125s;
  -webkit-animation-duration: 4.7s;
          animation-duration: 4.7s;
}
.ball > :nth-child(33)::before {
  background-color: #9c6bff;
}
.ball > :nth-child(34) {
  -webkit-animation-delay: -0.1375s;
          animation-delay: -0.1375s;
  -webkit-animation-duration: 4.5s;
          animation-duration: 4.5s;
}
.ball > :nth-child(34)::before {
  background-color: #c2a3ff;
}
.ball > :nth-child(35) {
  -webkit-animation-delay: -3.0125s;
          animation-delay: -3.0125s;
  -webkit-animation-duration: 4.5s;
          animation-duration: 4.5s;
}
.ball > :nth-child(35)::before {
  background-color: #b18aff;
}
.ball > :nth-child(36) {
  -webkit-animation-delay: -0.65s;
          animation-delay: -0.65s;
  -webkit-animation-duration: 5.05s;
          animation-duration: 5.05s;
}
.ball > :nth-child(36)::before {
  background-color: #d3bdff;
}
.ball > :nth-child(37) {
  -webkit-animation-delay: -4s;
          animation-delay: -4s;
  -webkit-animation-duration: 4.6s;
          animation-duration: 4.6s;
}
.ball > :nth-child(37)::before {
  background-color: #a77aff;
}
.ball > :nth-child(38) {
  -webkit-animation-delay: -4.6625s;
          animation-delay: -4.6625s;
  -webkit-animation-duration: 4s;
          animation-duration: 4s;
}
.ball > :nth-child(38)::before {
  background-color: #bb99ff;
}
.ball > :nth-child(39) {
  -webkit-animation-delay: -4.925s;
          animation-delay: -4.925s;
  -webkit-animation-duration: 5.3s;
          animation-duration: 5.3s;
}
.ball > :nth-child(39)::before {
  background-color: #7029ff;
}
.ball > :nth-child(40) {
  -webkit-animation-delay: -3.05s;
          animation-delay: -3.05s;
  -webkit-animation-duration: 4.4s;
          animation-duration: 4.4s;
}
.ball > :nth-child(40)::before {
  background-color: #7a38ff;
}
.ball > :nth-child(41) {
  -webkit-animation-delay: -1.1625s;
          animation-delay: -1.1625s;
  -webkit-animation-duration: 4.4s;
          animation-duration: 4.4s;
}
.ball > :nth-child(41)::before {
  background-color: #7a38ff;
}
.ball > :nth-child(42) {
  -webkit-animation-delay: -0.65s;
          animation-delay: -0.65s;
  -webkit-animation-duration: 4.4s;
          animation-duration: 4.4s;
}
.ball > :nth-child(42)::before {
  background-color: #a375ff;
}
.ball > :nth-child(43) {
  -webkit-animation-delay: -4.25s;
          animation-delay: -4.25s;
  -webkit-animation-duration: 5.5s;
          animation-duration: 5.5s;
}
.ball > :nth-child(43)::before {
  background-color: #9c6bff;
}
.ball > :nth-child(44) {
  -webkit-animation-delay: -0.325s;
          animatio.........完整代码请登录后点击上方下载按钮下载查看

网友评论0