From 19d1b4dbc9b6ee74095361a62502509661a7079d Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 02 三月 2023 09:04:29 +0800
Subject: [PATCH] 1.看板加入星空背景

---
 src/views/kb/zhkb.vue |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 58 insertions(+), 1 deletions(-)

diff --git a/src/views/kb/zhkb.vue b/src/views/kb/zhkb.vue
index 71306e9..9279921 100644
--- a/src/views/kb/zhkb.vue
+++ b/src/views/kb/zhkb.vue
@@ -1,6 +1,11 @@
 <template>
   <div>
     <div class="kb_dashboard">
+      <!--    鏄熺┖鑳屾櫙-->
+      <div ref="starsRef" class="stars">
+        <div v-for="(item, index) in starsCount" :key="index" class="star" />
+      </div>
+
       <div class="kb_header">
         <div class="flex_c_c kb_header_text">
           <div id="topBarLeft" style="width:600px;height:100%" />
@@ -287,7 +292,10 @@
       tableDataLeftBottom: [],
       tableDataLeftBottomTemp: [],
       lineContent3: [],
-      ShopArr: [] // 杞﹂棿缂栫爜鏁扮粍
+      ShopArr: [], // 杞﹂棿缂栫爜鏁扮粍
+
+      starsCount: 800, // 鏄熸槦鏁伴噺
+      distance: 900 // 闂磋窛
 
     }
   },
@@ -303,8 +311,22 @@
     this.getTopBar()
 
     this.getShopSearch()
+    this.setStarsRef()
   },
   methods: {
+    setStarsRef() {
+      const starNodes = Array.from(this.$refs.starsRef.children)
+      starNodes.forEach(item => {
+        const speed = 0.2 + Math.random() * 1
+        const thisDistance = this.distance + Math.random() * 300
+        item.style.transformOrigin = `0 0 ${thisDistance}px`
+        item.style.transform = `
+        translate3d(0,0,-${thisDistance}px)
+        rotateY(${Math.random() * 360}deg)
+        rotateX(${Math.random() * -50}deg)
+        scale(${speed},${speed})`
+      })
+    },
     // 鑾峰彇杞﹂棿缂栫爜
     async getShopSearch() {
       const res1 = await ShopSearch()
@@ -597,3 +619,38 @@
 }
 
 </style>
+
+<!--鏄熺┖-->
+<style lang="css" scoped>
+@keyframes rotate {
+  0% {
+    transform: perspective(400px) rotateZ(20deg) rotateX(-40deg) rotateY(0);
+  }
+  100% {
+    transform: perspective(400px) rotateZ(20deg) rotateX(-40deg) rotateY(-360deg);
+  }
+}
+
+.stars {
+  transform: perspective(500px);
+  transform-style: preserve-3d;
+  position: absolute;
+  perspective-origin: 50% 100%;
+  left: 45%;
+  animation: rotate 90s infinite linear;
+  bottom: 0;
+  z-index: 102;
+}
+
+.star {
+  width: 2px;
+  height: 2px;
+  /*background: #f7f7b6;*/
+  background: #8edffc;
+  position: absolute;
+  left: 0;
+  top: 0;
+  backface-visibility: hidden;
+  z-index: 102;
+}
+</style>

--
Gitblit v1.9.3