Skip to content

Commit 2e78acd

Browse files
committed
feat: add shimmer effect
1 parent 751a686 commit 2e78acd

File tree

1 file changed

+56
-18
lines changed

1 file changed

+56
-18
lines changed

src/App.vue

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<template>
1010
<v-app style="overflow: hidden">
11-
<v-app-bar class="liquid-glass-app-bar">
11+
<v-app-bar class="liquid-glass-app-bar" @mousemove="handleAppBarMouseMove" @mouseleave="handleAppBarMouseLeave">
1212
<v-app-bar-nav-icon v-if="$vuetify.display.mobile" @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
1313
<div class="d-flex align-center" v-else>
1414
<span class="app-bar-item" @click="$router.push({ name: 'Hi' }).catch(() => { })"
@@ -88,7 +88,7 @@
8888
<router-view />
8989
</v-main>
9090

91-
<v-footer class="liquid-glass-footer" padless>
91+
<v-footer class="liquid-glass-footer" padless @mousemove="handleFooterMouseMove" @mouseleave="handleFooterMouseLeave">
9292
<div tile class="text-white text-center">
9393
<p class="text-white pt-0 text-xs">
9494
Made with
@@ -119,6 +119,10 @@ export default {
119119
icons: ["mdi-github", "mdi-linkedin",],
120120
drawer: false,
121121
group: null,
122+
appBarMouseX: 0,
123+
appBarMouseY: 0,
124+
footerMouseX: 0,
125+
footerMouseY: 0,
122126
}),
123127
watch: {
124128
group() {
@@ -128,6 +132,24 @@ export default {
128132
methods: {
129133
changeLanguage() {
130134
this.$i18n.locale = this.$i18n.locale == "en" ? "zh" : "en";
135+
},
136+
handleAppBarMouseMove(event) {
137+
const rect = event.currentTarget.getBoundingClientRect();
138+
this.appBarMouseX = event.clientX - rect.left;
139+
this.appBarMouseY = event.clientY - rect.top;
140+
},
141+
handleAppBarMouseLeave() {
142+
this.appBarMouseX = 0;
143+
this.appBarMouseY = 0;
144+
},
145+
handleFooterMouseMove(event) {
146+
const rect = event.currentTarget.getBoundingClientRect();
147+
this.footerMouseX = event.clientX - rect.left;
148+
this.footerMouseY = event.clientY - rect.top;
149+
},
150+
handleFooterMouseLeave() {
151+
this.footerMouseX = 0;
152+
this.footerMouseY = 0;
131153
}
132154
},
133155
components: { vueIcon, eroducate }
@@ -153,16 +175,24 @@ export default {
153175
content: '';
154176
position: absolute;
155177
top: 0;
156-
left: -100%;
157-
width: 100%;
158-
height: 100%;
159-
background: linear-gradient(
160-
90deg,
161-
transparent,
162-
rgba(255, 255, 255, 0.08),
163-
transparent
178+
left: 0;
179+
right: 0;
180+
bottom: 0;
181+
background: radial-gradient(
182+
circle at v-bind(appBarMouseX + 'px') v-bind(appBarMouseY + 'px'),
183+
rgba(255, 255, 255, 0.15) 0%,
184+
rgba(255, 255, 255, 0.08) 30%,
185+
rgba(255, 255, 255, 0.03) 60%,
186+
transparent 80%
164187
);
188+
opacity: 0;
189+
transition: opacity 0.3s ease;
165190
z-index: 1;
191+
pointer-events: none;
192+
}
193+
194+
.liquid-glass-app-bar:hover::before {
195+
opacity: 1;
166196
}
167197
168198
.liquid-glass-app-bar::after {
@@ -199,16 +229,24 @@ export default {
199229
content: '';
200230
position: absolute;
201231
top: 0;
202-
left: -100%;
203-
width: 100%;
204-
height: 100%;
205-
background: linear-gradient(
206-
90deg,
207-
transparent,
208-
rgba(255, 255, 255, 0.08),
209-
transparent
232+
left: 0;
233+
right: 0;
234+
bottom: 0;
235+
background: radial-gradient(
236+
circle at v-bind(footerMouseX + 'px') v-bind(footerMouseY + 'px'),
237+
rgba(255, 255, 255, 0.15) 0%,
238+
rgba(255, 255, 255, 0.08) 30%,
239+
rgba(255, 255, 255, 0.03) 60%,
240+
transparent 80%
210241
);
242+
opacity: 0;
243+
transition: opacity 0.3s ease;
211244
z-index: 1;
245+
pointer-events: none;
246+
}
247+
248+
.liquid-glass-footer:hover::before {
249+
opacity: 1;
212250
}
213251
214252
.liquid-glass-footer::after {

0 commit comments

Comments
 (0)