Przeglądaj źródła

Merge branch 'master' of http://git.ycjcjy.com/H5/njDaTuSha into master

lisenzhou 2 lat temu
rodzic
commit
827b6ca5d8

BIN
public/audio/audio.mp3 Wyświetl plik


+ 8
- 2
src/App.vue Wyświetl plik

@@ -5,7 +5,7 @@
5 5
   import track from '@/utils/track'
6 6
   import Loading from './First.vue';
7 7
 
8
-  const { el } = useModel('audio');
8
+  const { el, play } = useModel('audio');
9 9
   const { setUser, contries } = useModel('user');
10 10
   const show = ref(false);
11 11
   
@@ -42,13 +42,19 @@
42 42
   
43 43
   share();
44 44
 
45
+  const onTouch = () => {
46
+    play();
47
+    window.removeEventListener('touchstart', onTouch);
48
+  }
49
+  window.addEventListener('touchstart', onTouch);
50
+
45 51
 </script>
46 52
 
47 53
 <template>
48 54
   <!-- <Loading v-if="!show" class="loading" @ready="(show = true)" /> -->
49 55
   <router-view></router-view>
50 56
 
51
-  <audio ref="el" src="/audio/audio.mp3" style="max-width: 0"  preload="auto"></audio>
57
+  <audio ref="el" src="/audio/audio.mp3" style="max-width: 0" loop preload="auto"></audio>
52 58
 </template>
53 59
 
54 60
 <style lang="less" scoped>

+ 2
- 1
src/components/Bell.vue Wyświetl plik

@@ -53,7 +53,6 @@ const animate = computed(() => state.value === 1);
53 53
       flex: none;
54 54
       width: 50%;
55 55
       height: 50%;
56
-      border: 2px solid rgba(255, 255, 255, 1);
57 56
       border-radius: 50%;
58 57
       opacity: 0;
59 58
     }
@@ -63,12 +62,14 @@ const animate = computed(() => state.value === 1);
63 62
     }
64 63
 
65 64
     .inner {
65
+      border: 2px solid #fff;
66 66
       animation-duration: 3s;
67 67
       animation-timing-function: linear;
68 68
       animation-iteration-count: infinite;
69 69
     }
70 70
 
71 71
     .outer {
72
+      border: 2px solid #fff;
72 73
       animation-duration: 1.5s;
73 74
       animation-timing-function: linear;
74 75
       animation-iteration-count: infinite;

+ 26
- 4
src/components/InkEffect.vue Wyświetl plik

@@ -7,13 +7,23 @@
7 7
 
8 8
   const canvasRef = ref();
9 9
   const renderRef = ref();
10
+  const clearRef = ref();
10 11
   const props = defineProps({
11 12
     src: String,
12 13
     active: Boolean,
13 14
     speed: {
14 15
       type: Number,
15 16
       default: 5,
16
-    }
17
+    },
18
+    xSpeed: {
19
+      type: Number,
20
+      default: 40,
21
+    },
22
+    ySpeed: {
23
+      type: Number,
24
+      default: 70,
25
+    },
26
+    clearable: Boolean
17 27
   })
18 28
 
19 29
   let frameId = null;
@@ -26,6 +36,12 @@
26 36
         renderRef.value();
27 37
       }
28 38
     }
39
+
40
+    if (props.clearable && !newVal) {
41
+      if (clearRef.value) {
42
+        clearRef.value();
43
+      }
44
+    }
29 45
   })
30 46
 
31 47
   onMounted(() => {
@@ -41,17 +57,23 @@
41 57
 
42 58
     img.src = props.src;
43 59
     imgMask.src = './images/cloud-texture.png'
60
+
61
+    function clear() {
62
+      cxt.clearRect(0, 0, canv.width, canv.height);
63
+    }
64
+
65
+    clearRef.value = clear;
44 66
     
45 67
     function draw() {
46 68
       i += props.speed;
47 69
       
48
-      let maskX = (canv.width - (70 + i)) / 2,
49
-          maskY = (canv.height - (40 + i)) / 2;
70
+      let maskX = (canv.width - (props.ySpeed + i)) / 2,
71
+          maskY = (canv.height - (props.xSpeed + i)) / 2;
50 72
       
51 73
       ctx.clearRect(0, 0, canv.width, canv.height);
52 74
       ctx.globalCompositeOperation = "source-over";
53 75
       
54
-      ctx.drawImage(imgMask, maskX, maskY, 70 + i, 40 + i);
76
+      ctx.drawImage(imgMask, maskX, maskY, props.ySpeed + i, props.xSpeed + i);
55 77
       
56 78
       ctx.globalCompositeOperation = "source-in";
57 79
       ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight);

+ 2
- 1
src/pages/index.vue Wyświetl plik

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <div style="height: 100vh;">
3
-    <Bell class="bell abs" />
3
+    <Bell class="bell" />
4 4
     <div class="pages slide-container">
5 5
       <div class="slide-page-2">
6 6
         <Pg1 class="container" />
@@ -51,6 +51,7 @@ onMounted(() => {
51 51
   right: 30px;
52 52
   top: 30px;
53 53
   z-index: 100;
54
+  position: fixed;
54 55
 }
55 56
 
56 57
 .pages {

+ 5
- 0
src/pages/pg1/Md3.vue Wyświetl plik

@@ -18,6 +18,8 @@
18 18
           autoplay="autoplay"
19 19
           controls="controls"
20 20
           src="/video/9年活动.mp4"
21
+          @play="pause()"
22
+          @pause="play()"
21 23
         ></video>
22 24
       </div>
23 25
     </div>
@@ -25,8 +27,11 @@
25 27
 </template>
26 28
 
27 29
 <script setup>
30
+  import { useModel } from '@zjxpcyc/vue-tiny-store';
28 31
   import Modal from '@/components/Modal.vue';
29 32
   import Animate from '@/components/Animate.vue';
33
+
34
+  const { play, pause } = useModel('audio');
30 35
 </script>
31 36
 
32 37
 <style lang="less" scoped>

+ 6
- 1
src/pages/pg1/index.vue Wyświetl plik

@@ -2,6 +2,7 @@
2 2
   <div class="page pg-bg pg1" parallax>
3 3
     <div class="bg">
4 4
       <div>
5
+        <!-- <InkEffect class="ink-bg" src="/images/pg1/bg1.png" :active="true" /> -->
5 6
         <img src="/images/pg1/bg1.png" alt="">
6 7
       </div>
7 8
     </div>
@@ -27,7 +28,7 @@
27 28
 <script setup>
28 29
   import { onMounted, ref } from 'vue';
29 30
   import { useRouter } from 'vue-router';
30
-  import Bell from '@/components/Bell.vue';
31
+  import InkEffect from '@/components/InkEffect.vue';
31 32
   import Logo from './Logo.vue';
32 33
   import Part1 from './P1.vue';
33 34
   import Part2 from './P2.vue';
@@ -64,6 +65,10 @@
64 65
     & > div {
65 66
       position: relative;
66 67
     }
68
+
69
+    .ink-bg {
70
+      width: 100%;
71
+    }
67 72
   }
68 73
 
69 74
   .conent {

+ 82
- 43
src/pages/pg2/index.vue Wyświetl plik

@@ -46,14 +46,13 @@
46 46
 
47 47
     <div class="groups abs">
48 48
       <div>
49
-        <div>
50
-          <img class="ruins" src="/images/pg2/废墟.png" alt />
51
-        </div>
49
+        <InkEffect class="ink-ruins" src="./images/pg2/废墟color.png" :speed="10" :active="inkActive" :clearable="true" />
50
+        <img class="ruins" src="/images/pg2/废墟.png" alt />
52 51
       </div>
53 52
     </div>
54 53
     <div class="flower1">
55 54
       <div>
56
-        <img src="/images/pg2/flower1.png" alt="" />
55
+        <img :class="{'flower-fly': show}" src="/images/pg2/flower1.png" alt="" @animationend="inkActive = true" />
57 56
       </div>
58 57
     </div>
59 58
 
@@ -71,47 +70,55 @@
71 70
 </template>
72 71
 
73 72
 <script setup>
74
-import { reactive, ref } from "vue";
75
-import { useRouter } from "vue-router";
76
-import Bell from "@/components/Bell.vue";
77
-import Animate from "@/components/Animate.vue";
78
-import Cloud from "./Cloud.vue";
79
-import Smoke from "./smoke.vue";
80
-import Flower1 from "./flower/Flower1.vue";
81
-import Flower2 from "./flower/Flower2.vue";
82
-import Flower3 from "./flower/Flower3.vue";
83
-import usePageShow from "../usePageShow";
84
-
85
-const router = useRouter();
86
-
87
-const onClick = () => {
88
-  router.push(`/pg2-2`);
89
-};
90
-
91
-const flowerAnimate = reactive({
92
-  left: "",
93
-  right: "",
94
-});
95
-
96
-let lastRatio = 0;
97
-const flowShow = ({ intersectionRatio }) => {
98
-  console.log(intersectionRatio);
99
-  const isIn = intersectionRatio > 0.5 && intersectionRatio > lastRatio;
100
-  const isOut = intersectionRatio < 0.9 && intersectionRatio < lastRatio;
101
-
102
-  if (isIn) {
103
-    flowerAnimate.left = "animate__fadeInLeft";
104
-    flowerAnimate.right = "animate__fadeInRight";
105
-  }
106
-  if (isOut) {
107
-    flowerAnimate.left = "animate__fadeOutLeft";
108
-    flowerAnimate.right = "animate__fadeOutRight";
109
-  }
73
+  import { reactive, ref, watch } from "vue";
74
+  import { useRouter } from "vue-router";
75
+  import Bell from "@/components/Bell.vue";
76
+  import Animate from "@/components/Animate.vue";
77
+  import InkEffect from "@/components/InkEffect.vue";
78
+  import Cloud from "./Cloud.vue";
79
+  import Smoke from "./smoke.vue";
80
+  import Flower1 from "./flower/Flower1.vue";
81
+  import Flower2 from "./flower/Flower2.vue";
82
+  import Flower3 from "./flower/Flower3.vue";
83
+  import usePageShow from "../usePageShow";
84
+
85
+  const router = useRouter();
86
+  const inkActive = ref(false);
87
+
88
+  const onClick = () => {
89
+    router.push(`/pg2-2`);
90
+  };
91
+
92
+  const flowerAnimate = reactive({
93
+    left: "",
94
+    right: "",
95
+  });
96
+
97
+  let lastRatio = 0;
98
+  const flowShow = ({ intersectionRatio }) => {
99
+    console.log(intersectionRatio);
100
+    const isIn = intersectionRatio > 0.5 && intersectionRatio > lastRatio;
101
+    const isOut = intersectionRatio < 0.9 && intersectionRatio < lastRatio;
102
+
103
+    if (isIn) {
104
+      flowerAnimate.left = "animate__fadeInLeft";
105
+      flowerAnimate.right = "animate__fadeInRight";
106
+    }
107
+    if (isOut) {
108
+      flowerAnimate.left = "animate__fadeOutLeft";
109
+      flowerAnimate.right = "animate__fadeOutRight";
110
+    }
111
+
112
+    lastRatio = intersectionRatio;
113
+  };
110 114
 
111
-  lastRatio = intersectionRatio;
112
-};
115
+  const [pgRef, show] = usePageShow(flowShow);
113 116
 
114
-const [pgRef, show] = usePageShow(flowShow);
117
+  watch(show, (val) => {
118
+    if (!val) {
119
+      inkActive.value = false;
120
+    }
121
+  })
115 122
 </script>
116 123
 
117 124
 <style lang="less" scoped>
@@ -170,6 +177,15 @@ const [pgRef, show] = usePageShow(flowShow);
170 177
       z-index: 2;
171 178
       position: relative;
172 179
     }
180
+
181
+    .ink-ruins {
182
+      position: absolute;
183
+      z-index: 4;
184
+      top: 0;
185
+      left: 0;
186
+      width: 100%;
187
+      height: 100%;
188
+    }
173 189
   }
174 190
   .flower1 {
175 191
     position: absolute;
@@ -184,6 +200,29 @@ const [pgRef, show] = usePageShow(flowShow);
184 200
       width: 50px;
185 201
     }
186 202
   }
203
+  
204
+
205
+  .flower-fly {
206
+    transform-origin: left bottom;
207
+    animation: flower-fly 3s ease-in-out 1s forwards;
208
+  }
209
+
210
+  @keyframes flower-fly {
211
+    0% {
212
+      transform: rotate(0) translate3d(0, 0, 0);
213
+      opacity: 1;
214
+    }
215
+
216
+    90% {
217
+      opacity: 0;
218
+    }
219
+
220
+    100% {
221
+      transform: rotate(180deg) translate3d(-60vw, -6vh, 0);
222
+      opacity: 0;
223
+    }
224
+  }
225
+
187 226
   .flower2 {
188 227
     position: absolute;
189 228
     z-index: 20;

+ 18
- 12
src/pages/pg4/video.vue Wyświetl plik

@@ -6,9 +6,12 @@
6 6
         playsinline
7 7
         src="/video/和平宣言-视频-压缩.mp4"
8 8
         preload="preload"
9
+        autoplay="autoplay"
9 10
         controls="controls"
10 11
         ref="mediaRef"
11 12
         @ended="show = true"
13
+        @play="pause()"
14
+        @pause="play()"
12 15
       ></video>
13 16
       <div class="play-action animate__animated animate__fadeIn" v-if="show">
14 17
         <img src="/images/pg4/重播.png" @click="onReplay" alt="" />
@@ -19,21 +22,24 @@
19 22
 </template>
20 23
 
21 24
 <script setup>
22
-import { ref } from "vue";
23
-import { useRouter } from "vue-router";
25
+  import { ref } from "vue";
26
+  import { useRouter } from "vue-router";
27
+  import { useModel } from '@zjxpcyc/vue-tiny-store';
24 28
 
25
-const router = useRouter();
26
-const mediaRef = ref();
27
-const show = ref(false);
29
+  const { play, pause } = useModel('audio');
30
+  const router = useRouter();
31
+  const mediaRef = ref();
32
+  const show = ref(false);
28 33
 
29
-const onReplay = () => {
30
-  mediaRef.value.play();
31
-  show.value = false;
32
-};
34
+  const onReplay = () => {
35
+    mediaRef.value.play();
36
+    show.value = false;
37
+  };
38
+
39
+  const onNext = () => {
40
+    router.push("/pg4/next");
41
+  };
33 42
 
34
-const onNext = () => {
35
-  router.push("/pg4/next");
36
-};
37 43
 </script>
38 44
 
39 45
 <style lang="less" scoped>