@@ -25,11 +25,6 @@ const backend = [
2525 { name: ' Apache Spark' , icon: ' devicon:apachespark' }
2626]
2727
28- // const ide = [
29- // { name: 'VSCode', icon: 'devicon:vscode' },
30- // { name: 'IntelliJ IDEA', icon: 'devicon:intellij' }
31- // ]
32-
3328const MAX_POSTS = 10
3429const allPosts = await getBlogCollection ()
3530const allPostsByDate = sortMDByDate (allPosts ).slice (0 , MAX_POSTS )
@@ -39,8 +34,10 @@ const allPostsByDate = sortMDByDate(allPosts).slice(0, MAX_POSTS)
3934 <main class =' flex w-full flex-col' >
4035 <!-- 第一屏 -->
4136 <section class =' relative min-h-screen w-full' >
42- <!-- 网格背景 -->
43- <div class =' grid-background absolute inset-0 z-0' ></div >
37+ <!-- Parallax Background -->
38+ <div id =" animation-viewport" >
39+ <img id =" background-image" src =" /clouds/mountain.jpg" alt =" Mountain background" />
40+ </div >
4441
4542 <!-- 主要内容 - 调整垂直位置 -->
4643 <div class =' relative z-10 flex min-h-screen items-start px-4 pt-32' >
@@ -51,16 +48,12 @@ const allPostsByDate = sortMDByDate(allPosts).slice(0, MAX_POSTS)
5148 <div class =' avatar-container relative shrink-0' >
5249 <!-- 装饰星星 -->
5350 <div class =' stars' >
54- <!-- 上方星星 -->
5551 <span class =' star' style =' --delay: 0s; --offset: -20px' >✨</span >
5652 <span class =' star' style =' --delay: 2s; --offset: -15px' >✨</span >
57- <!-- 右侧星星 -->
5853 <span class =' star' style =' --delay: 1s; --offset: -20px' >✨</span >
5954 <span class =' star' style =' --delay: 1s; --offset: -15px' >✨</span >
60- <!-- 下方星星 -->
6155 <span class =' star' style =' --delay: 2s; --offset: -20px' >✨</span >
6256 <span class =' star' style =' --delay: 2.5s; --offset: -15px' >✨</span >
63- <!-- 左侧星星 -->
6457 <span class =' star' style =' --delay: 3s; --offset: -20px' >✨</span >
6558 <span class =' star' style =' --delay: 1.5s; --offset: -15px' >✨</span >
6659 </div >
@@ -229,18 +222,38 @@ const allPostsByDate = sortMDByDate(allPosts).slice(0, MAX_POSTS)
229222 </main >
230223</PageLayout >
231224
225+ <script >
226+ document.addEventListener('scroll', () => {
227+ const bgImage = document.getElementById('background-image');
228+ if (!bgImage) return;
229+
230+ const scrollTop = window.scrollY;
231+ const zoomDuration = window.innerHeight * 1.5;
232+ const scrollProgress = Math.min(1, scrollTop / zoomDuration);
233+
234+ const scale = 1.4 - (scrollProgress * 0.4);
235+ bgImage.style.transform = `scale(${scale})`;
236+ });
237+ </script >
238+
232239<style >
233- /* 网格背景 */
234- .grid-background {
235- background-image:
236- linear-gradient(var(--grid-color) 1px, transparent 1px),
237- linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
238- background-size: 20px 20px;
239- mask-image: linear-gradient(to bottom, transparent, 15%, white, 85%, transparent);
240+ #animation-viewport {
241+ position: fixed;
242+ top: 0;
243+ left: 0;
244+ height: 100vh;
245+ width: 100vw;
246+ overflow: hidden;
247+ z-index: -1;
240248 }
241249
242- :root {
243- --grid-color: rgba(218, 157, 12, 0.1);
250+ #background-image {
251+ position: absolute;
252+ inset: 0;
253+ width: 100%;
254+ height: 100%;
255+ object-fit: cover;
256+ transform: scale(1.4);
244257 }
245258
246259 /* 招手动画 */
0 commit comments