div+css实现隧道星际穿越效果

代码语言:html

所属分类:粒子

代码描述:div+css实现隧道星际穿越效果

代码标签: 星际 穿越 效果

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


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

<style>
* {
  padding: 0px;
  margin: 0px;
  box-sizing: border-box;
}

body {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-align: center;
          align-items: center;
  height: 100vh;
  width: 100vw;
  background: #390946;
  background: radial-gradient(circle, #390946 0%, #38125b 8%, #14001d 36%, black 100%);
  overflow: hidden;
}

.container {
  position: fixed;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  /*
  Can be added for additional effects:
  animation: rotation 15s linear infinite;*/
}

.wrapper {
  position: fixed;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  -webkit-perspective: 25px;
          perspective: 25px;
}

.hole {
  position: relative;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  -webkit-transform-style: preserve-3d;
          transform-style: preserve-3d;
  -webkit-transform: translateZ(-150px);
          transform: translateZ(-150px);
  background: transparent;
}

.space-bottom {
  position: absolute;
  width: 500px;
  height: 500px;
  border-top-left-radius: 50%;
  border-top-right-radius: 50%;
  background: transparent;
  z-index: 2;
  -webkit-transform: rotateX(-80deg) translateZ(250px);
          transform: rotateX(-80deg) translateZ(250px);
}

.space-top {
  position: absolute;
  width: 500px;
  height: 500px;
  background: transparent;
  border-bottom-left-radius: 50%;
  border-bottom-right-radius: 50%;
  -webkit-transform: rotateX(80deg) translateZ(250px);
          transform: rotateX(80deg) translateZ(250px);
}

.space-left {
  position: absolute;
  width: 500px;
  height: 500px;
  border: solid 0px;
  border-radius: 50%;
  -webkit-transform: rotateY(-80deg) translateZ(250px);
          transform: rotateY(-80deg) translateZ(250px);
}

.space-right {
  position: absolute;
  width: 500px;
  height: 500px;
  border: solid 0px;
  border-radius: 50%;
  -webkit-transform: rotateY(80deg) translateZ(250px);
          transform: rotateY(80deg) translateZ(250px);
}

.star-top {
  position: absolute;
  left: 0px;
  width: 1px;
  height: 20px;
  opacity: 0;
  border-radius: 50%;
  background: #5729ff;
  box-shadow: 0 0 2px 1px purple;
  -webkit-animation: stars 1.25s linear infinite;
          animation: stars 1.25s linear infinite;
}
.star-top:nth-child(1) {
  top: calc(50% - -181px);
  left: calc(80% - 180px);
  -webkit-animation-delay: 4670ms;
          animation-delay: 4670ms;
}
.star-top:nth-child(2) {
  top: calc(50% - 36px);
  left: calc(80% - 57px);
  -webkit-animation-delay: 3615ms;
          animation-delay: 3615ms;
}
.star-top:nth-child(3) {
  top: calc(50% - 140px);
  left: calc(80% - 50px);
  -webkit-animation-delay: 844ms;
          animation-delay: 844ms;
}
.star-top:nth-child(4) {
  top: calc(50% - -190px);
  left: calc(80% - 180px);
  -webkit-animation-delay: 4079ms;
          animation-delay: 4079ms;
}
.star-top:nth-child(5) {
  top: calc(50% - 187px);
  left: calc(80% - 19px);
  -webkit-animation-delay: 698ms;
          animation-delay: 698ms;
}
.star-top:nth-child(6) {
  top: calc(50% - -148px);
  left: calc(80% - 7px);
  -webkit-animation-delay: 737ms;
          animation-delay: 737ms;
}
.star-top:nth-child(7) {
  top: calc(50% - -177px);
  left: calc(80% - 248px);
  -webkit-animation-delay: 3898ms;
          animation-delay: 3898ms;
}
.star-top:nth-child(8) {
  top: calc(50% - 84px);
  left: calc(80% - 89px);
  -webkit-animation-delay: 4665ms;
          animation-delay: 4665ms;
}
.star-top:nth-child(9) {
  top: calc(50% - 198px);
  left: calc(80% - 4px);
  -webkit-animation-delay: 2213ms;
          animation-delay: 2213ms;
}
.star-top:nth-child(10) {
  top: calc(50% - -42px);
  left: calc(80% - 124px);
  -webkit-animation-delay: 3357ms;
          animation-delay: 3357ms;
}
.star-top:nth-child(11) {
  top: calc(50% - 154px);
  left: calc(80% - 83px);
  -webkit-animation-delay: 374ms;
          animation-delay: 374ms;
}
.star-top:nth-child(12) {
  top: calc(50% - -114px);
  left: calc(80% - 6px);
  -webkit-animation-delay: 4033ms;
          animation-delay: 4033ms;
}
.star-top:nth-child(13) {
  top: calc(50% - 41px);
  left: calc(80% - 151px);
  -webkit-animation-delay: 2597ms;
          animation-delay: 2597ms;
}
.star-top:nth-child(14) {
  top: calc(50% - -11px);
  left: calc(80% - 192px);
  -webkit-animation-delay: 3807ms;
          animation-delay: 3807ms;
}
.star-top:nth-child(15) {
  top: calc(50% - -150px);
  left: calc(80% - 52px);
  -webkit-animation-delay: 635ms;
          animation-delay: 635ms;
}
.star-top:nth-child(16) {
  top: calc(50% - 78px);
  left: calc(80% - 188px);
  -webkit-animation-delay: 3207ms;
          animation-delay: 3207ms;
}
.star-top:nth-child(17) {
  top: calc(50% - 185px);
  left: calc(80% - 137px);
  -webkit-animation-delay: 2418ms;
          animation-delay: 2418ms;
}
.star-top:nth-child(18) {
  top: calc(50% - .........完整代码请登录后点击上方下载按钮下载查看

网友评论0