张延森 3 years ago
parent
commit
dad685d7bb

BIN
src/assets/GrassImage/flower-1.png View File


BIN
src/assets/GrassImage/flower-2.png View File


BIN
src/assets/GrassImage/flower-3.png View File


BIN
src/assets/GrassImage/left-flower-1.png View File


BIN
src/assets/GrassImage/left-flower-2.png View File


BIN
src/assets/GrassImage/left-grass.png View File


BIN
src/assets/GrassImage/left-leaf-1.png View File


BIN
src/assets/GrassImage/right-grass-leaf.png View File


BIN
src/assets/GrassImage/right-grass.png View File


+ 7
- 0
src/components/BackPage.vue View File

@@ -7,6 +7,8 @@
7 7
       <CloudVue :scale="1.2" top="10vh" />
8 8
       <CloudVue :scale="1" top="30vh" right="0" direction="left" :delay="1" />
9 9
       <CloudVue :scale="0.8" top="40vh" :delay="1.8" />
10
+      <LeftGrass />
11
+      <RightGrass />
10 12
       <slot></slot>
11 13
       <!-- <div class="GrassGIFBox">
12 14
         <GrassGIF />
@@ -18,11 +20,15 @@
18 20
 <script >
19 21
 import backHome from '@/assets/BackImage/backHome.jpg'
20 22
 import CloudVue from '@/components/Cloud.vue'
23
+import LeftGrass from '@/components/LeftGrass.vue'
24
+import RightGrass from '@/components/RightGrass.vue'
21 25
 
22 26
 export default {
23 27
   name: 'BackPage',
24 28
   components: {
25 29
     CloudVue,
30
+    LeftGrass,
31
+    RightGrass,
26 32
   },
27 33
   setup() {
28 34
     return {
@@ -36,6 +42,7 @@ export default {
36 42
 .index-image {
37 43
   height: 100vh;
38 44
   overflow: hidden;
45
+  position: relative;
39 46
 
40 47
   .bg-image {
41 48
     width: 100vw;

+ 18
- 0
src/components/LeftGrass.vue View File

@@ -0,0 +1,18 @@
1
+<template>
2
+  <div class="left-grass-box">
3
+
4
+  </div>
5
+</template>
6
+
7
+<script setup>
8
+import grassImage from '@/assets/GrassImage/left-grass.png'
9
+</script>
10
+
11
+<style lang="less" scoped>
12
+.left-grass-box {
13
+  position: absolute;
14
+  left: 0;
15
+  bottom: 0;
16
+  z-index: 0;
17
+}
18
+</style>

+ 82
- 6
src/components/RightGrass.vue View File

@@ -1,20 +1,96 @@
1 1
 <template>
2
-  <div class="left-grass">
3
-    
2
+  <div class="right-grass-box">
3
+    <img class="right-grass" :src="grassImage" alt="" style="z-index: 2">
4
+    <img class="flower-motion flower-1" :src="flower1Image" alt="" style="z-index: 1">
5
+    <img class="flower-motion flower-2" :src="flower2Image" alt="" style="z-index: 1">
6
+    <img class="flower-motion flower-3" :src="flower3Image" alt="" style="z-index: 1">
7
+    <img class="leaf-motion grass-leaf" :src="leafImage" alt="" style="z-index: 3">
4 8
   </div>
5 9
 </template>
6 10
 
7 11
 <script setup>
12
+import grassImage from '@/assets/GrassImage/right-grass.png'
13
+import flower1Image from '@/assets/GrassImage/flower-1.png'
14
+import flower2Image from '@/assets/GrassImage/flower-2.png'
15
+import flower3Image from '@/assets/GrassImage/flower-3.png'
16
+import leafImage from '@/assets/GrassImage/right-grass-leaf.png'
8 17
 
9 18
 </script>
10 19
 
11 20
 <style lang="less" scoped>
12
-.left-grass {
13
-  width: 25vw;
14
-  height: 28vw;
21
+.right-grass-box {
15 22
   position: absolute;
16 23
   right: 0;
17 24
   bottom: 0;
18
-  overflow: hidden;
25
+  z-index: 0;
26
+
27
+  & > img {
28
+    position: absolute;
29
+    right: 0;
30
+    bottom: 0;
31
+    will-change: transform;
32
+  }
33
+
34
+  .flower-motion {
35
+    transform-origin: center bottom;
36
+    animation-name: windblow;
37
+    animation-duration: 6s;
38
+    animation-timing-function: linear;
39
+    animation-iteration-count: infinite;
40
+  }
41
+
42
+  .leaf-motion {
43
+    transform-origin: right bottom;
44
+    animation-name: windblow2;
45
+    animation-duration: 6s;
46
+    animation-timing-function: linear;
47
+    animation-iteration-count: infinite;
48
+  }
49
+
50
+  @keyframes windblow {
51
+    50% {
52
+      transform: rotate(-10deg);
53
+    }
54
+  }
55
+  
56
+  @keyframes windblow2 {
57
+    50% {
58
+      transform: rotate(-8deg);
59
+    }
60
+  }
61
+
62
+  .right-grass {
63
+    width: 25vw;
64
+    height: 28vw;
65
+  }
66
+
67
+  .flower-1 {
68
+    width: 15vw;
69
+    height: 10vw;
70
+    right: 13.2vw;
71
+    bottom: 1vw;
72
+    animation-delay: 0;
73
+  }
74
+
75
+  .flower-2 {
76
+    width: 9vw;
77
+    height: 16.5vw;
78
+    right: 8vw;
79
+    bottom: 6vw;
80
+    animation-delay: 1s;
81
+  }
82
+
83
+  .flower-3 {
84
+    width: 8.7vw;
85
+    height: 16vw;
86
+    right: 3vw;
87
+    bottom: 14vw;
88
+    animation-delay: 2s;
89
+  }
90
+
91
+  .grass-leaf {
92
+    width: 10.7vw;
93
+    height: 21vw;
94
+  }
19 95
 }
20 96
 </style>