张延森 2 år sedan
förälder
incheckning
e70bfbeb6a
3 ändrade filer med 67 tillägg och 3 borttagningar
  1. 1
    1
      src/App.vue
  2. 59
    0
      src/components/Fog.vue
  3. 7
    2
      src/components/Image.vue

+ 1
- 1
src/App.vue Visa fil

@@ -24,7 +24,7 @@ onMounted(() => {
24 24
 <template>
25 25
   <Loader :loading="loading" :percent="percent" />
26 26
   <ScrollDown />
27
-  <Image v-for="res in resources" :key="res.image" :resource="res"></Image>
27
+  <Image v-for="(res, inx) in resources" :key="res.image" :resource="res" :show-fog="inx === 0"></Image>
28 28
 </template>
29 29
 
30 30
 <style scoped>

+ 59
- 0
src/components/Fog.vue Visa fil

@@ -0,0 +1,59 @@
1
+<template>
2
+  <div class="fog-box">
3
+    <div class="fog"></div>
4
+    <svg width="0" height="0" >
5
+      <filter id="steam">
6
+        <feTurbulence type="fractalNoise" baseFrequency=".01" numOctaves="10" />
7
+        <feDisplacementMap in="SourceGraphic" scale="180" />
8
+      </filter>
9
+    </svg>
10
+  </div>
11
+</template>
12
+
13
+<style lang="less" scoped>
14
+
15
+@fog-color: #787F78;
16
+@fog-last-time: 20s;
17
+
18
+.fog-box {
19
+  position: absolute;
20
+  z-index: 20;
21
+  width: 100%;
22
+  height: 100%;
23
+  overflow: hidden;
24
+  // overflow-y: hidden;
25
+
26
+  .fog{
27
+    position: absolute;
28
+    top: -400px;
29
+    width: 100%;
30
+    height: 100%;
31
+    border-radius: 50%;
32
+    box-shadow: -156px 492px 123px -252px @fog-color;
33
+    filter: url(#steam);
34
+    min-width: 600px;
35
+    min-height: 600px;
36
+    animation-name: fogAnimation;
37
+    animation-duration: @fog-last-time;
38
+    animation-direction: normal;
39
+    animation-iteration-count: infinite;
40
+    animation-timing-function: ease-in-out;
41
+    will-change: transform, opacity;
42
+  }
43
+
44
+  @keyframes fogAnimation {
45
+    0%{
46
+      transform: translate(-20%, -20%);
47
+      opacity: 0;
48
+    }
49
+    50% {
50
+      opacity: 0.8;
51
+    }
52
+    100%{
53
+      transform: translate(60%, -40%);
54
+      opacity: 0;
55
+    }
56
+  }
57
+}
58
+
59
+</style>

+ 7
- 2
src/components/Image.vue Visa fil

@@ -1,5 +1,6 @@
1 1
 <template>
2 2
   <div class="img-wrapper">
3
+    <Fog v-if="showFog" />
3 4
     <img :src="resource.img.src" @load="onLoad" alt="">
4 5
     <div v-if="resource.playBtn" class="paybtn" :style="btnStyle" @click="onPlayBtn">
5 6
       <AudioPlayingVue :style="iconStyle" />
@@ -11,13 +12,17 @@
11 12
 <script setup>
12 13
 import { computed, ref, watch } from 'vue';
13 14
 import { useModel } from '@zjxpcyc/vue-tiny-store';
15
+import Fog from './Fog.vue';
14 16
 import AudioPlayingVue from './AudioPlaying.vue';
15 17
 
16 18
 const [current, updateCurrent] = useModel('audio');
17 19
 
18 20
 const props = defineProps({
19
-  resource: Object,
20
-  default: () => ({})
21
+  resource: {
22
+    type: Object,
23
+    default: () => ({})
24
+  },
25
+  showFog: Boolean,
21 26
 });
22 27
 
23 28
 const btnStyle = ref({});