耗时72小时打造!乱世西游传奇超写实官网全栈重构(附完整源码)

大家好,我是前端攻城狮小李,花了整整3个昼夜,纯手写完成了这款乱世西游传奇手游的官网页面。这是我第一次尝试东方仙侠风格的UI设计,过程充满挑战但成就感满满。

灵感目标:https://lsxy.500mm.cn/

先上最终效果链接:https://bjdzm.cn/

目标网站:https://m.bjdzm.cn/

目标网站:https://hz.bjdzm.cn/

 

设计灵感

这款游戏主打东方古典奇幻风格,所以整个页面的设计围绕 "暗黑仙侠" 这个主题展开:

  1. 配色方案:采用火焰橙(#ff6b6b)、月光蓝(#48dbfb)、黄金黄(#feca57)作为主色调,营造出热血与神秘交织的视觉氛围
  2. 字体选择:引入了西遊記專用字體作为标题字体,增强东方文化特色
  3. 视觉层次:通过多层背景叠加、视差滚动、Canvas粒子等技术构建沉浸式体验

核心技术实现

1. 自定义CSS变量系统

为了提高代码可维护性,我自定义了完整的CSS变量系统:

:root {
    --primary-color: #ff6b6b;
    --secondary-color: #feca57;
    --accent-color: #48dbfb;
    --bg-dark: #0a0a0a;
    --bg-medium: #1a1a2e;
    --bg-light: #16213e;
}

2. 渐变文字与背景

整个页面大量使用线性渐变和径向渐变来增强视觉冲击力:

.logo {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientFlow 8s ease infinite;
}

3. Canvas粒子背景

通过原生JavaScript实现Canvas粒子效果,模拟星空闪烁的梦幻场景:

class Particle {
    constructor() {
        this.x = Math.random() * canvas.width;
        this.y = Math.random() * canvas.height;
        this.size = Math.random() * 3 + 1;
        this.speedX = Math.random() * 2 - 1;
        this.speedY = Math.random() * 2 - 1;
        this.color = `rgba(${Math.random()*255}, ${Math.random()*255}, ${Math.random()*255}, 0.8)`;
    }

    update() {
        this.x += this.speedX;
        this.y += this.speedY;
        if (this.x < 0 || this.x > canvas.width) this.speedX *= -1;
        if (this.y < 0 || this.y > canvas.height) this.speedY *= -1;
    }

    draw() {
        ctx.fillStyle = this.color;
        ctx.beginPath();
        ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
        ctx.fill();
    }
}

4. 视差滚动效果

通过多层背景叠加和滚动监听实现视差效果,营造出深度感:

window.addEventListener('scroll', () => {
    const scrollTop = window.pageYOffset;
    const parallaxBg = document.querySelector('.parallax-bg');
    parallaxBg.style.transform = `translateY(${scrollTop * 0.5}px)`;
});

5. 复杂交互动画

为了提升用户体验,几乎所有交互元素都添加了精细的动画效果:

  • 导航链接悬停下划线动画
  • 卡片元素悬停缩放效果
  • 按钮点击闪光动画
  • 滚动触发的渐入动画

6. 响应式设计

使用媒体查询和灵活的布局系统实现移动端适配:

@media (max-width: 768px) {
    .hero-title {
        font-size: 48px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }
}

性能优化

1. 懒加载策略

对于图片资源采用懒加载机制,提高首屏加载速度:

<img loading="lazy" src="image.jpg" alt="description">

2. CSS优化

  • 使用CSS变量统一管理颜色
  • 合并重复样式
  • 使用transform替代position进行动画

3. JavaScript优化

  • 使用requestAnimationFrame进行动画循环
  • 事件委托减少内存占用
  • 防抖节流处理滚动事件

踩坑记录

1. 渐变文字兼容性问题

在Safari浏览器中,-webkit-background-clip: text 需要配合 -webkit-text-fill-color: transparent 使用,否则会出现文字模糊的情况。

2. Canvas性能问题

最初创建了1000个粒子,导致页面卡顿,后来优化为200个粒子,平衡了视觉效果和性能。

3. 视差滚动卡顿

在移动端视差滚动效果出现卡顿,后来通过硬件加速(transform: translateZ(0))解决了这个问题。

后续计划

  1. 添加WebGL粒子效果替代Canvas
  2. 实现游戏角色3D模型展示
  3. 添加动态视频背景
  4. 集成游戏预约系统

源码获取

完整代码已上传至GitHub:优快云完整html代码

如果觉得这个项目对你有帮助,欢迎点赞、收藏、转发三连支持!有任何问题或建议,欢迎在评论区留言讨论。

结语

这次开发让我对前端视觉表现有了更深的理解,也体会到了纯手写代码的乐趣和成就感。希望这个项目能为大家带来一些启发和帮助。

<html lang="zh-CN"><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>乱世西游传奇 - 再续前缘</title>
    <style>
        /* 自定义属性 */
        :root {
            --primary-color: #ff6b6b;
            --secondary-color: #feca57;
            --accent-color: #48dbfb;
            --bg-dark: #0a0a0a;
            --bg-medium: #1a1a2e;
            --bg-light: #16213e;
            --text-primary: #ffffff;
            --text-secondary: rgba(255, 255, 255, 0.7);
            --border-color: rgba(255, 255, 255, 0.1);
        }

        /* 全局重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* 字体加载 */
        @font-face {
            font-family: 'XiyouFont';
            src: url('https://example.com/xiyou-font.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
        }

        body {
            font-family: 'Noto Sans SC', sans-serif;
            background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 50%, var(--bg-light) 100%);
            color: var(--text-primary);
            overflow-x: hidden;
            position: relative;
        }

        /* 视差背景 */
        .parallax-bg {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: url('https://example.com/parallax-bg.jpg') center/cover no-repeat;
            opacity: 0.1;
            z-index: -2;
            transform: translateZ(0);
        }

        /* Canvas粒子背景 */
        #particles-canvas {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            opacity: 0.6;
        }

        /* 头部导航 */
        header {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
            backdrop-filter: blur(20px);
            border-bottom: 1px solid var(--border-color);
            z-index: 1000;
            transition: all 0.3s ease;
        }

        header.scrolled {
            background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        }

        .nav-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 20px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            font-family: 'XiyouFont', 'Noto Sans SC', sans-serif;
            font-size: 36px;
            font-weight: 700;
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
            background-size: 200% 200%;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: gradientFlow 8s ease infinite;
            position: relative;
        }

        @keyframes gradientFlow {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }

        .logo::before {
            content: '';
            position: absolute;
            bottom: -5px;
            left: 0;
            width: 100%;
            height: 2px;
            background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
            background-size: 200% 200%;
            animation: gradientFlow 8s ease infinite;
        }

        .nav-links {
            display: flex;
            gap: 40px;
        }

        .nav-links a {
            color: var(--text-primary);
            text-decoration: none;
            font-weight: 500;
            font-size: 16px;
            position: relative;
            transition: all 0.3s ease;
            padding: 5px 0;
        }

        .nav-links a::before {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 0;
            height: 2px;
            background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
            transition: width 0.3s ease;
        }

        .nav-links a:hover {
            color: var(--primary-color);
        }

        .nav-links a:hover::before {
            width: 100%;
        }

        /* 英雄区域 */
        .hero {
            position: relative;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .hero::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: url('https://example.com/hero-bg.jpg') center/cover no-repeat;
            opacity: 0.2;
            z-index: -1;
        }

        .hero-content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 30px;
            text-align: center;
            position: relative;
            z-index: 1;
        }

        .hero-title {
            font-family: 'XiyouFont', 'Noto Sans SC', sans-serif;
            font-size: 80px;
            font-weight: 900;
            margin-bottom: 30px;
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
            background-size: 300% 300%;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: pulseGlow 3s ease-in-out infinite;
            text-shadow: 0 0 50px rgba(255, 107, 107, 0.3);
        }

        @keyframes pulseGlow {
            0%, 100% { 
                background-position: 0% 50%;
                filter: drop-shadow(0 0 20px rgba(255, 107, 107, 0.5));
            }
            50% { 
                background-position: 100% 50%;
                filter: drop-shadow(0 0 40px rgba(255, 107, 107, 0.8));
            }
        }

        .hero-subtitle {
            font-size: 28px;
            margin-bottom: 50px;
            color: var(--secondary-color);
            text-shadow: 0 0 30px rgba(254, 202, 87, 0.5);
            font-weight: 600;
        }

        .cta-buttons {
            display: flex;
            gap: 30px;
            justify-content: center;
            margin-bottom: 80px;
        }

        .btn {
            padding: 18px 50px;
            font-size: 20px;
            font-weight: 600;
            border: none;
            border-radius: 60px;
            cursor: pointer;
            transition: all 0.4s ease;
            text-decoration: none;
            display: inline-block;
            position: relative;
            overflow: hidden;
            box-shadow: 0 10px 30px rgba(255, 107, 107, 0.2);
        }

        .btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s ease;
        }

        .btn:hover::before {
            left: 100%;
        }

        .btn-primary {
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
            color: #000;
            font-weight: 700;
        }

        .btn-primary:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 60px rgba(255, 107, 107, 0.5);
        }

        .btn-secondary {
            background: rgba(255, 255, 255, 0.1);
            color: var(--text-primary);
            border: 2px solid var(--secondary-color);
        }

        .btn-secondary:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 60px rgba(254, 202, 87, 0.5);
            background: rgba(254, 202, 87, 0.1);
        }

        /* 角色展示区域 */
        .characters {
            padding: 150px 0;
            background: linear-gradient(180deg, transparent 0%, var(--bg-dark) 100%);
            position: relative;
            z-index: 2;
        }

        .characters-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 30px;
        }

        .section-title {
            font-size: 56px;
            font-weight: 700;
            text-align: center;
            margin-bottom: 80px;
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            position: relative;
        }

        .section-title::after {
            content: '';
            position: absolute;
            bottom: -20px;
            left: 50%;
            transform: translateX(-50%);
            width: 100px;
            height: 3px;
            background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
        }

        .characters-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 40px;
        }

        .character-card {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            padding: 40px 30px;
            text-align: center;
            transition: all 0.4s ease;
            backdrop-filter: blur(10px);
            position: relative;
            overflow: hidden;
        }

        .character-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
            opacity: 0;
            transition: opacity 0.4s ease;
            z-index: -1;
        }

        .character-card:hover::before {
            opacity: 0.1;
        }

        .character-card:hover {
            transform: translateY(-15px);
            border-color: var(--primary-color);
            box-shadow: 0 30px 80px rgba(255, 107, 107, 0.3);
        }

        .character-avatar {
            width: 150px;
            height: 150px;
            margin: 0 auto 30px;
            border-radius: 50%;
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 72px;
            box-shadow: 0 20px 60px rgba(255, 107, 107, 0.3);
            position: relative;
            overflow: hidden;
        }

        .character-avatar::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent);
            transform: rotate(45deg);
            transition: transform 0.3s ease;
        }

        .character-card:hover .character-avatar::before {
            transform: rotate(90deg);
        }

        .character-name {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 15px;
            color: var(--text-primary);
        }

        .character-description {
            font-size: 14px;
            color: var(--text-secondary);
            line-height: 1.8;
            margin-bottom: 25px;
        }

        .character-skills {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: center;
        }

        .skill-tag {
            padding: 6px 18px;
            background: rgba(255, 107, 107, 0.2);
            border: 1px solid rgba(255, 107, 107, 0.3);
            border-radius: 30px;
            font-size: 12px;
            font-weight: 500;
            color: var(--primary-color);
            transition: all 0.3s ease;
        }

        .character-card:hover .skill-tag {
            background: rgba(255, 107, 107, 0.4);
            border-color: var(--primary-color);
        }

        /* 游戏特色 */
        .features {
            padding: 150px 0;
            background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
            position: relative;
            z-index: 2;
        }

        .features-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 30px;
        }

        .features-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 50px;
        }

        .feature-card {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            padding: 40px 30px;
            transition: all 0.4s ease;
            backdrop-filter: blur(10px);
        }

        .feature-card:hover {
            transform: translateY(-10px);
            border-color: var(--accent-color);
            box-shadow: 0 20px 60px rgba(72, 219, 251, 0.2);
        }

        .feature-icon {
            font-size: 64px;
            margin-bottom: 30px;
            background: linear-gradient(45deg, var(--accent-color), var(--secondary-color));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .feature-title {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 20px;
            color: var(--text-primary);
        }

        .feature-description {
            font-size: 14px;
            color: var(--text-secondary);
            line-height: 1.8;
        }

        /* 剧情展示 */
        .story {
            padding: 150px 0;
            background: linear-gradient(180deg, var(--bg-medium) 0%, var(--bg-light) 100%);
            position: relative;
            z-index: 2;
        }

        .story-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 30px;
        }

        .story-text {
            font-size: 18px;
            line-height: 2;
            color: var(--text-secondary);
            text-align: center;
            margin-bottom: 60px;
        }

        /* 下载区域 */
        .download {
            padding: 150px 0;
            background: linear-gradient(180deg, var(--bg-light) 0%, var(--bg-dark) 100%);
            text-align: center;
            position: relative;
            z-index: 2;
        }

        .download-title {
            font-size: 64px;
            font-weight: 700;
            margin-bottom: 30px;
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .download-subtitle {
            font-size: 20px;
            color: var(--text-secondary);
            margin-bottom: 60px;
        }

        /* 页脚 */
        footer {
            padding: 80px 0 40px;
            background: var(--bg-dark);
            text-align: center;
            border-top: 1px solid var(--border-color);
            position: relative;
            z-index: 2;
        }

        .footer-content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 30px;
        }

        .footer-links {
            display: flex;
            gap: 30px;
            justify-content: center;
            margin-bottom: 40px;
            flex-wrap: wrap;
        }

        .footer-links a {
            color: var(--text-secondary);
            text-decoration: none;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .footer-links a:hover {
            color: var(--primary-color);
        }

        .copyright {
            color: var(--text-secondary);
            font-size: 14px;
            margin-top: 30px;
        }

        /* 响应式设计 */
        @media (max-width: 1200px) {
            .features-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 768px) {
            .nav-links {
                display: none;
            }

            .hero-title {
                font-size: 48px;
            }

            .hero-subtitle {
                font-size: 20px;
            }

            .section-title {
                font-size: 36px;
            }

            .features-grid {
                grid-template-columns: 1fr;
            }

            .cta-buttons {
                flex-direction: column;
                align-items: center;
            }
        }

        /* 滚动条样式 */
        ::-webkit-scrollbar {
            width: 8px;
        }

        ::-webkit-scrollbar-track {
            background: var(--bg-dark);
        }

        ::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, var(--secondary-color), var(--primary-color));
        }
    </style>
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;500;700;900&amp;display=swap" rel="stylesheet">
</head>
<body>
    <!-- 视差背景 -->
    <div class="parallax-bg"></div>

    <!-- Canvas粒子背景 -->
    <canvas id="particles-canvas" width="412" height="823"></canvas>

    <!-- 头部导航 -->
    <header id="header" class="">
        <div class="nav-container">
            <div class="logo">乱世西游传奇</div>
            <nav class="nav-links">
                <a href="#home">首页</a>
                <a href="#characters">角色</a>
                <a href="#features">特色</a>
                <a href="#story">剧情</a>
                <a href="#download">下载</a>
            </nav>
        </div>
    </header>

    <!-- 英雄区域 -->
    <section class="hero" id="home">
        <div class="hero-content">
            <h1 class="hero-title">再续前缘</h1>
            <p class="hero-subtitle">经典西游IP全新演绎,开启乱世征程</p>
            <div class="cta-buttons">
                <a href="#download" class="btn btn-primary">立即下载</a>
                <a href="#characters" class="btn btn-secondary">探索角色</a>
            </div>
        </div>
    </section>

    <!-- 角色展示区域 -->
    <section class="characters" id="characters">
        <div class="characters-container">
            <h2 class="section-title">西游英雄</h2>
            <div class="characters-grid">
                <div class="character-card">
                    <div class="character-avatar" style="transform: scale(1) rotate(0deg);">🐒</div>
                    <h3 class="character-name">齐天大圣</h3>
                    <p class="character-description">曾经大闹天宫的美猴王,拥有七十二变和筋斗云,手持如意金箍棒,战斗力超群。</p>
                    <div class="character-skills">
                        <span class="skill-tag">七十二变</span>
                        <span class="skill-tag">筋斗云</span>
                        <span class="skill-tag">金箍棒</span>
                    </div>
                </div>
                <div class="character-card">
                    <div class="character-avatar">🐷</div>
                    <h3 class="character-name">天蓬元帅</h3>
                    <p class="character-description">曾经掌管十万天兵的天蓬元帅,因调戏嫦娥被贬下凡,拥有九齿钉耙和三十六变。</p>
                    <div class="character-skills">
                        <span class="skill-tag">三十六变</span>
                        <span class="skill-tag">九齿钉耙</span>
                        <span class="skill-tag">天罡战气</span>
                    </div>
                </div>
                <div class="character-card">
                    <div class="character-avatar" style="transform: scale(1) rotate(0deg);">🐴</div>
                    <h3 class="character-name">沙悟净</h3>
                    <p class="character-description">曾经的卷帘大将,因失手打碎琉璃盏被贬下凡,手持降妖宝杖,擅长防御和治疗。</p>
                    <div class="character-skills">
                        <span class="skill-tag">降妖宝杖</span>
                        <span class="skill-tag">金刚不坏</span>
                        <span class="skill-tag">普渡众生</span>
                    </div>
                </div>
                <div class="character-card">
                    <div class="character-avatar" style="transform: scale(1) rotate(0deg);">👨</div>
                    <h3 class="character-name">唐僧</h3>
                    <p class="character-description">西天取经的领导者,慈悲为怀,拥有紧箍咒和佛法无边的力量,擅长治愈和净化。</p>
                    <div class="character-skills">
                        <span class="skill-tag">紧箍咒</span>
                        <span class="skill-tag">佛法无边</span>
                        <span class="skill-tag">普渡众生</span>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- 游戏特色 -->
    <section class="features" id="features">
        <div class="features-container">
            <h2 class="section-title">游戏特色</h2>
            <div class="features-grid">
                <div class="feature-card">
                    <div class="feature-icon">⚔️</div>
                    <h3 class="feature-title">热血战斗</h3>
                    <p class="feature-description">极致战斗体验,技能连招流畅,打击感十足,让你畅享指尖上的快感。</p>
                </div>
                <div class="feature-card">
                    <div class="feature-icon">🌍</div>
                    <h3 class="feature-title">开放世界</h3>
                    <p class="feature-description">超大地图自由探索,隐藏副本、神秘宝箱、奇遇任务等你发现。</p>
                </div>
                <div class="feature-card">
                    <div class="feature-icon">🎁</div>
                    <h3 class="feature-title">丰富福利</h3>
                    <p class="feature-description">每日签到、在线礼包、成长基金等超多福利,助你快速成长。</p>
                </div>
                <div class="feature-card">
                    <div class="feature-icon">👥</div>
                    <h3 class="feature-title">社交互动</h3>
                    <p class="feature-description">公会系统、好友互动、跨服对战,与好友一起并肩作战。</p>
                </div>
                <div class="feature-card">
                    <div class="feature-icon">🎮</div>
                    <h3 class="feature-title">玩法多样</h3>
                    <p class="feature-description">PVE副本、PVP竞技、修仙炼丹、坐骑养成等多种玩法任你体验。</p>
                </div>
                <div class="feature-card">
                    <div class="feature-icon">🎨</div>
                    <h3 class="feature-title">精美画质</h3>
                    <p class="feature-description">超高清游戏画面,细腻的角色建模,沉浸式的游戏体验。</p>
                </div>
            </div>
        </div>
    </section>

    <!-- 剧情展示 -->
    <section class="story" id="story">
        <div class="story-container">
            <h2 class="section-title">游戏剧情</h2>
            <div class="story-text">
                天地初开,三界有序,然万年浩劫将至,妖魔鬼怪横行于世。
                曾经的师徒四人早已归隐山林,如今妖魔再现,苍生陷入水深火热之中。
                作为一名新晋的西游英雄,你将踏上新的征程,寻找散落各地的神兵利器,
                招募各路英雄豪杰,共同对抗邪魔外道,拯救苍生。
            </div>
        </div>
    </section>

    <!-- 下载区域 -->
    <section class="download" id="download">
        <div class="characters-container">
            <h2 class="download-title">立即下载</h2>
            <p class="download-subtitle">加入乱世西游传奇,开启你的西游征程</p>
            <div class="cta-buttons">
                <a href="https://m.bjdzm.cn/" class="btn btn-primary">安卓下载</a>
                <a href="https://m.bjdzm.cn/" class="btn btn-primary">iOS下载</a>
            </div>
        </div>
    </section>

    <!-- 页脚 -->
    <footer>
        <div class="footer-content">
            <div class="footer-links">
                <a href="https://m.bjdzm.cn/">关于我们</a>
                <a href="https://m.bjdzm.cn/">联系我们</a>
                <a href="https://bjdzm.cn/">隐私政策</a>
                <a href="https://bjdzm.cn/">用户协议</a>
            </div>
            <div class="copyright">
                © 2025 乱世西游传奇 https://hz.bjdzm.cn/ 版权所有
            </div>
        </div>
    </footer>

    <script>
        // Canvas粒子效果
        const canvas = document.getElementById('particles-canvas');
        const ctx = canvas.getContext('2d');

        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;

        window.addEventListener('resize', () => {
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;
        });

        // 粒子类
        class Particle {
            constructor() {
                this.x = Math.random() * canvas.width;
                this.y = Math.random() * canvas.height;
                this.size = Math.random() * 3 + 1;
                this.speedX = Math.random() * 2 - 1;
                this.speedY = Math.random() * 2 - 1;
                this.color = `rgba(${Math.random()*255}, ${Math.random()*255}, ${Math.random()*255}, 0.8)`;
            }

            update() {
                this.x += this.speedX;
                this.y += this.speedY;

                if (this.x < 0 || this.x > canvas.width) this.speedX *= -1;
                if (this.y < 0 || this.y > canvas.height) this.speedY *= -1;
            }

            draw() {
                ctx.fillStyle = this.color;
                ctx.beginPath();
                ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
                ctx.fill();
            }
        }

        // 初始化粒子
        const particles = [];
        for (let i = 0; i < 200; i++) {
            particles.push(new Particle());
        }

        // 动画循环
        function animate() {
            ctx.clearRect(0, 0, canvas.width, canvas.height);

            particles.forEach(particle => {
                particle.update();
                particle.draw();
            });

            requestAnimationFrame(animate);
        }

        animate();

        // 滚动监听
        window.addEventListener('scroll', () => {
            const header = document.getElementById('header');
            if (window.scrollY > 50) {
                header.classList.add('scrolled');
            } else {
                header.classList.remove('scrolled');
            }
        });

        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });

        // 字符卡片动画
        const characterCards = document.querySelectorAll('.character-card');

        characterCards.forEach(card => {
            card.addEventListener('mouseenter', () => {
                const avatar = card.querySelector('.character-avatar');
                avatar.style.transform = 'scale(1.1) rotate(5deg)';
            });

            card.addEventListener('mouseleave', () => {
                const avatar = card.querySelector('.character-avatar');
                avatar.style.transform = 'scale(1) rotate(0deg)';
            });
        });
    </script>

</body></html>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值