浏览代码

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

lisenzhou 2 年前
父节点
当前提交
827b6ca5d8
共有 9 个文件被更改,包括 149 次插入64 次删除
  1. 二进制
      public/audio/audio.mp3
  2. 8
    2
      src/App.vue
  3. 2
    1
      src/components/Bell.vue
  4. 26
    4
      src/components/InkEffect.vue
  5. 2
    1
      src/pages/index.vue
  6. 5
    0
      src/pages/pg1/Md3.vue
  7. 6
    1
      src/pages/pg1/index.vue
  8. 82
    43
      src/pages/pg2/index.vue
  9. 18
    12
      src/pages/pg4/video.vue

二进制
public/audio/audio.mp3 查看文件


+ 8
- 2
src/App.vue 查看文件

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

+ 2
- 1
src/components/Bell.vue 查看文件

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

+ 26
- 4
src/components/InkEffect.vue 查看文件

7
 
7
 
8
   const canvasRef = ref();
8
   const canvasRef = ref();
9
   const renderRef = ref();
9
   const renderRef = ref();
10
+  const clearRef = ref();
10
   const props = defineProps({
11
   const props = defineProps({
11
     src: String,
12
     src: String,
12
     active: Boolean,
13
     active: Boolean,
13
     speed: {
14
     speed: {
14
       type: Number,
15
       type: Number,
15
       default: 5,
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
   let frameId = null;
29
   let frameId = null;
26
         renderRef.value();
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
   onMounted(() => {
47
   onMounted(() => {
41
 
57
 
42
     img.src = props.src;
58
     img.src = props.src;
43
     imgMask.src = './images/cloud-texture.png'
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
     function draw() {
67
     function draw() {
46
       i += props.speed;
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
       ctx.clearRect(0, 0, canv.width, canv.height);
73
       ctx.clearRect(0, 0, canv.width, canv.height);
52
       ctx.globalCompositeOperation = "source-over";
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
       ctx.globalCompositeOperation = "source-in";
78
       ctx.globalCompositeOperation = "source-in";
57
       ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight);
79
       ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight);

+ 2
- 1
src/pages/index.vue 查看文件

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

+ 5
- 0
src/pages/pg1/Md3.vue 查看文件

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

+ 6
- 1
src/pages/pg1/index.vue 查看文件

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

+ 82
- 43
src/pages/pg2/index.vue 查看文件

46
 
46
 
47
     <div class="groups abs">
47
     <div class="groups abs">
48
       <div>
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
       </div>
51
       </div>
53
     </div>
52
     </div>
54
     <div class="flower1">
53
     <div class="flower1">
55
       <div>
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
       </div>
56
       </div>
58
     </div>
57
     </div>
59
 
58
 
71
 </template>
70
 </template>
72
 
71
 
73
 <script setup>
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
 </script>
122
 </script>
116
 
123
 
117
 <style lang="less" scoped>
124
 <style lang="less" scoped>
170
       z-index: 2;
177
       z-index: 2;
171
       position: relative;
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
   .flower1 {
190
   .flower1 {
175
     position: absolute;
191
     position: absolute;
184
       width: 50px;
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
   .flower2 {
226
   .flower2 {
188
     position: absolute;
227
     position: absolute;
189
     z-index: 20;
228
     z-index: 20;

+ 18
- 12
src/pages/pg4/video.vue 查看文件

6
         playsinline
6
         playsinline
7
         src="/video/和平宣言-视频-压缩.mp4"
7
         src="/video/和平宣言-视频-压缩.mp4"
8
         preload="preload"
8
         preload="preload"
9
+        autoplay="autoplay"
9
         controls="controls"
10
         controls="controls"
10
         ref="mediaRef"
11
         ref="mediaRef"
11
         @ended="show = true"
12
         @ended="show = true"
13
+        @play="pause()"
14
+        @pause="play()"
12
       ></video>
15
       ></video>
13
       <div class="play-action animate__animated animate__fadeIn" v-if="show">
16
       <div class="play-action animate__animated animate__fadeIn" v-if="show">
14
         <img src="/images/pg4/重播.png" @click="onReplay" alt="" />
17
         <img src="/images/pg4/重播.png" @click="onReplay" alt="" />
19
 </template>
22
 </template>
20
 
23
 
21
 <script setup>
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
 </script>
43
 </script>
38
 
44
 
39
 <style lang="less" scoped>
45
 <style lang="less" scoped>