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% - -199px);
  left: calc(80% - 165px);
  -webkit-animation-delay: 2875ms;
          animation-delay: 2875ms;
}
.star-top:nth-child(19) {
  top: calc(50% - -56px);
  left: calc(80% - 23px);
  -webkit-animation-delay: 3194ms;
          animation-delay: 3194ms;
}
.star-top:nth-child(20) {
  top: calc(50% - -170px);
  left: calc(80% - 134px);
  -webkit-animation-delay: 1279ms;
          animation-delay: 1279ms;
}
.star-top:nth-child(21) {
  top: calc(50% - 96px);
  left: calc(80% - 259px);
  -webkit-animation-delay: 2372ms;
          animation-delay: 2372ms;
}
.star-top:nth-child(22) {
  top: calc(50% - -118px);
  left: calc(80% - 86px);
  -webkit-animation-delay: 4242ms;
          animation-delay: 4242ms;
}
.star-top:nth-child(23) {
  top: calc(50% - 125px);
  left: calc(80% - 167px);
  -webkit-animation-delay: 1165ms;
          animation-delay: 1165ms;
}
.star-top:nth-child(24) {
  top: calc(50% - 68px);
  left: calc(80% - 294px);
  -webkit-animation-delay: 4352ms;
          animation-delay: 4352ms;
}
.star-top:nth-child(25) {
  top: calc(50% - 51px);
  left: calc(80% - 47px);
  -webkit-animation-delay: 4646ms;
          animation-delay: 4646ms;
}
.star-top:nth-child(26) {
  top: calc(50% - 166px);
  left: calc(80% - 5px);
  -webkit-animation-delay: 4165ms;
          animation-delay: 4165ms;
}
.star-top:nth-child(27) {
  top: calc(50% - -175px);
  left: calc(80% - 152px);
  -webkit-animation-delay: 1491ms;
          animation-delay: 1491ms;
}
.star-top:nth-child(28) {
  top: calc(50% - -147px);
  left: calc(80% - 97px);
  -webkit-animation-delay: 2743ms;
          animation-delay: 2743ms;
}
.star-top:nth-child(29) {
  top: calc(50% - 66px);
  left: calc(80% - 251px);
  -webkit-animation-delay: 4021ms;
          animation-delay: 4021ms;
}
.star-top:nth-child(30) {
  top: calc(50% - -15px);
  left: calc(80% - 27px);
  -webkit-animation-delay: 478ms;
          animation-delay: 478ms;
}

.star-bottom {
  position: absolute;
  left: 0px;
  width: 1px;
  height: 20px;
  opacity: 0;
  border-radius: 50%;
  background: #5729ff;
  box-shadow: 0 0 2px 1px purple;
  animation: stars 1.25s linear infinite reverse;
}
.star-bottom:nth-child(1) {
  top: calc(20% - 51px);
  left: calc(80% - 186px);
  -webkit-animation-delay: 489ms;
          animation-delay: 489ms;
}
.star-bottom:nth-child(2) {
  top: calc(20% - 174px);
  left: calc(80% - 35px);
  -webkit-animation-delay: 215ms;
          animation-delay: 215ms;
}
.star-bottom:nth-child(3) {
  top: calc(20% - 151px);
  left: calc(80% - 223px);
  -webkit-animation-delay: 1583ms;
          animation-delay: 1583ms;
}
.star-bottom:nth-child(4) {
  top: calc(20% - 175px);
  left: calc(80% - 122px);
  -webkit-animation-delay: 2745ms;
          animation-delay: 2745ms;
}
.star-bottom:nth-child(5) {
  top: calc(20% - 180px);
  left: calc(80% - 299px);
  -webkit-animation-delay: 2858ms;
          animation-delay: 2858ms;
}
.star-bottom:nth-child(6) {
  top: calc(20% - 126px);
  left: calc(80% - 280px);
  -webkit-animation-delay: 4766ms;
          animation-delay: 4766ms;
}
.star-bottom:nth-child(7) {
  top: calc(20% - 158px);
  left: calc(80% - 281px);
  -webkit-animation-delay: 3597ms;
          animation-delay: 3597ms;
}
.star-bottom:nth-child(8) {
  top: calc(20% - -95px);
  left: calc(80% - 54px);
  -webkit-animation-delay: 3617ms;
          animation-delay: 3617ms;
}
.star-bottom:nth-child(9) {
  top: calc(20% - 103px);
  left: calc(80% - 258px);
  -webkit-animation-de.........完整代码请登录后点击上方下载按钮下载查看

网友评论0