Yansen 2 years ago
parent
commit
dbf191ec9f
4 changed files with 148 additions and 1 deletions
  1. BIN
      public/images/pg4/vid-poster.png
  2. 145
    0
      src/pages/pg2-2/Bell.vue
  3. 1
    0
      src/pages/pg4/video.vue
  4. 2
    1
      src/utils/resources.js

BIN
public/images/pg4/vid-poster.png View File


+ 145
- 0
src/pages/pg2-2/Bell.vue View File

@@ -0,0 +1,145 @@
1
+<template>
2
+  <div class="bell-box" @click="toggle">
3
+    <div>
4
+      <div class="center circle abs">
5
+        <div class="inner" :class="{'circle-ani': animate}" />
6
+      </div>
7
+      <div class="center circle abs">
8
+        <div class="outer" :class="{'circle-ani': animate}" />
9
+      </div>
10
+      <div class="center bell-img">
11
+        <img :class="{'bell-ani': animate}" src="/images/pg1/bell.png" alt="">
12
+      </div>
13
+    </div>
14
+    <audio ref="el" src="/audio/audio2.mp3" style="max-width: 0" loop preload="auto"></audio>
15
+  </div>
16
+</template>
17
+
18
+<script setup>
19
+  import { computed, onMounted, ref } from 'vue';
20
+  import { useModel } from '@zjxpcyc/vue-tiny-store';
21
+
22
+  const { pause } = useModel('audio');
23
+  const animate = ref(false);
24
+
25
+  const el = ref();
26
+
27
+  const toggle = () => {
28
+    if (el.value.paused) {
29
+      el.value.play();
30
+      animate.value = true;
31
+    } else {
32
+      el.value.pause();
33
+      animate.value = false;
34
+    }
35
+  }
36
+
37
+  onMounted(() => {
38
+    // 停掉原来的
39
+    pause();
40
+
41
+    //
42
+    el.value.play();
43
+  });
44
+
45
+</script>
46
+
47
+<style lang="less" scoped>
48
+.bell-box {
49
+  @size: 10vw;
50
+
51
+  width: @size;
52
+  height: @size;
53
+
54
+  & > div {
55
+    width: 100%;
56
+    height: 100%;
57
+    position: relative;
58
+  }
59
+
60
+  .center {
61
+    width: 100%;
62
+    height: 100%;
63
+    display: flex;
64
+    justify-content: center;
65
+    align-items: center;
66
+  }
67
+
68
+  .circle {
69
+    top: 2vw;
70
+    left: 0;
71
+    z-index: 0;
72
+
73
+    & > div {
74
+      flex: none;
75
+      width: 50%;
76
+      height: 50%;
77
+      border-radius: 50%;
78
+      opacity: 0;
79
+    }
80
+
81
+    .circle-ani {
82
+      animation-name: bell-circle-show;
83
+    }
84
+
85
+    .inner {
86
+      border: 2px solid #fff;
87
+      animation-duration: 3s;
88
+      animation-timing-function: linear;
89
+      animation-iteration-count: infinite;
90
+    }
91
+
92
+    .outer {
93
+      border: 2px solid #fff;
94
+      animation-duration: 1.5s;
95
+      animation-timing-function: linear;
96
+      animation-iteration-count: infinite;
97
+    }
98
+
99
+    @keyframes bell-circle-show {
100
+      0% {
101
+        opacity: 0;
102
+        transform: scale(1);
103
+      }
104
+
105
+      50% {
106
+        opacity: 1;
107
+      }
108
+
109
+      100% {
110
+        opacity: 0;
111
+        transform: scale(2.4);
112
+      }
113
+    }
114
+  }
115
+
116
+  .bell-img {
117
+    position: relative;
118
+    z-index: 2;
119
+
120
+    .bell-ani {
121
+      animation-name: bell-shake;
122
+    }
123
+
124
+    img {
125
+      flex: none;
126
+      width: 80%;
127
+
128
+      transform-origin: top center;
129
+      animation-duration: 1.4s;
130
+      animation-timing-function: ease-in-out;
131
+      animation-iteration-count: infinite;
132
+      animation-direction: alternate;
133
+    }
134
+  }
135
+
136
+  @keyframes bell-shake {
137
+    from {
138
+      transform: rotate(15deg);
139
+    }
140
+    to {
141
+      transform: rotate(-15deg);
142
+    }
143
+  }
144
+}
145
+</style>

+ 1
- 0
src/pages/pg4/video.vue View File

@@ -8,6 +8,7 @@
8 8
         preload="preload"
9 9
         autoplay="autoplay"
10 10
         :controls="controls"
11
+        poster="/images/pg4/vid-poster.png"
11 12
         ref="mediaRef"
12 13
         @ended="show = true"
13 14
         @play="pause()"

+ 2
- 1
src/utils/resources.js View File

@@ -66,7 +66,7 @@ export const resources = [
66 66
   { image: './images/pg3/btn.png' },
67 67
   { image: './images/pg3/jing.png' },
68 68
   { image: './images/pg3/left-bg.png' },
69
-  { image: './images/pg3/map.png' },
69
+  { image: './images/pg3/map.gif' },
70 70
   { image: './images/pg3/nan.png' },
71 71
   { image: './images/pg3/right-bg.png' },
72 72
   { image: './images/pg3/stele.png' },
@@ -77,6 +77,7 @@ export const resources = [
77 77
   { image: './images/pg4/planting.png' },
78 78
   { image: './images/pg4/播撒种子.png' },
79 79
   { image: './images/pg4/重播.png' },
80
+  { image: './images/pg4/vid-poster.png' },
80 81
 
81 82
   { image: './images/pg4/plant/中国-.png' },
82 83
   { image: './images/pg4/plant/中国.png' },