wzp
2026-04-03 c90776d50aa7275744657ee934dcdd61fb9e3db4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<link rel="preload" href="/wp-content/uploads/2026/03/YSBTH.ttf" as="font" type="font/ttf" crossorigin="anonymous">
 
<style>
    /* 2. 单独引入字体,确保预加载动画能第一时间读取,不干等 Elementor */
    @font-face {
        font-family: '优设标题黑';
        /* 【注意:请把 url 里的链接也替换成你真实的 ttf 字体链接,和上面保持一致】 */
        src: url('/wp-content/uploads/2026/03/YSBTH.ttf') format('truetype');
        font-display: swap; 
    }
 
    /* 添加了 ys_edu_ 前缀以防止与 WordPress 主题冲突 */
    #ys_edu_custom-preloader {
        position: fixed;
        top: 0; 
        left: 0; 
        width: 100vw; 
        height: 100vh;
        background: linear-gradient(to right, #00d1fe, #a5fed9);
        z-index: 999999;
        display: none; /* ← 改为 none */
        justify-content: center;
        align-items: center;
        transition: opacity 0.6s ease;
    }
 
    .ys_edu_preloader-wrapper {
        display: flex;
        align-items: center;
        justify-content: center;
    }
 
    .ys_edu_img1 {
        height: 120px; 
        display: block;
    }
 
    /* 初始状态:图片缩放为0 */
    .ys_edu_img1-container {
        transform: scale(0);
        margin-top: -20px;
    }
 
    /* 初始状态:抽屉宽度为0 */
    .ys_edu_text-container {
        width: 0;
        overflow: hidden;
        margin-left: 0;
        display: flex;
        align-items: center;
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent 100%);
        mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent 100%);
    }
 
    /* 初始状态:字符透明、偏移、模糊 */
    .ys_edu_char {
        font-size: 80px; 
        font-weight: 400; 
        /* 已经修改为调用上方声明的优设标题黑 */
        font-family: '优设标题黑', 'YouSheBiaoTiHei', sans-serif; 
        color: #ffffff; 
        display: inline-block; 
        opacity: 0;
        transform: translateX(40px); 
        filter: blur(12px); 
    }
 
    /* ========================================= */
    /* 发令枪:当 JS 添加 ys_edu_start-anim 类名后动画开始 */
    /* ========================================= */
 
    /* 1. 触发图片放大 */
    .ys_edu_start-anim .ys_edu_img1-container {
        animation: ys_edu_zoomIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    }
 
    /* 2. 触发抽屉拉出 */
    .ys_edu_start-anim .ys_edu_text-container {
        animation: ys_edu_slideTextDrawer 1.2s cubic-bezier(0.25, 1, 0.5, 1) 1s forwards; 
    }
 
    /* 3. 触发逐字显现 */
    .ys_edu_start-anim .ys_edu_char {
        animation: ys_edu_charFadeIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
        animation-delay: calc(1s + var(--i) * 0.1s); 
    }
 
    @keyframes ys_edu_zoomIn {
        0% { transform: scale(0); opacity: 0; }
        100% { transform: scale(1); opacity: 1; }
    }
 
    @keyframes ys_edu_slideTextDrawer {
        0% { width: 0; margin-left: 0; }
        100% { width: 480px; margin-left: 20px; }
    }
 
    @keyframes ys_edu_charFadeIn {
        0% { opacity: 0; transform: translateX(40px); filter: blur(12px); }
        100% { opacity: 1; transform: translateX(0); filter: blur(0px); }
    }
 
    /* 移动端适配:缩小 logo 与文字,并控制抽屉展开宽度 */
    @media (max-width: 767px) {
        .ys_edu_preloader-wrapper {
            padding: 0 16px;
        }
 
        .ys_edu_img1 {
            height: 72px;
        }
 
        .ys_edu_img1-container {
            margin-top: -10px;
        }
 
        .ys_edu_text-container {
            -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
            mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
        }
 
        .ys_edu_char {
            font-size: clamp(34px, 8.2vw, 46px);
            transform: translateX(22px);
            filter: blur(8px);
        }
 
        .ys_edu_start-anim .ys_edu_text-container {
            animation: ys_edu_slideTextDrawer_mobile 1.1s cubic-bezier(0.25, 1, 0.5, 1) 0.9s forwards;
        }
 
        .ys_edu_start-anim .ys_edu_char {
            animation: ys_edu_charFadeIn_mobile 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
            animation-delay: calc(0.9s + var(--i) * 0.08s);
        }
    }
 
    @keyframes ys_edu_slideTextDrawer_mobile {
        0% { width: 0; margin-left: 0; }
        100% { width: min(58vw, 220px); margin-left: 10px; }
    }
 
    @keyframes ys_edu_charFadeIn_mobile {
        0% { opacity: 0; transform: translateX(22px); filter: blur(8px); }
        100% { opacity: 1; transform: translateX(0); filter: blur(0px); }
    }
</style>
 
<div id="ys_edu_custom-preloader">
    <div class="ys_edu_preloader-wrapper">
        <div class="ys_edu_img1-container">
            <img id="ys_edu_preloader-logo" src="" alt="YStar Edu Logo" class="ys_edu_img1">
        </div>
 
        <div class="ys_edu_text-container">
            <span class="ys_edu_char" style="--i:1">Y</span>
            <span class="ys_edu_char" style="--i:2">S</span>
            <span class="ys_edu_char" style="--i:3">t</span>
            <span class="ys_edu_char" style="--i:4">a</span>
            <span class="ys_edu_char" style="--i:5">r</span>
            <span class="ys_edu_char" style="--i:6">&nbsp;</span>
            <span class="ys_edu_char" style="--i:7">E</span>
            <span class="ys_edu_char" style="--i:8">d</span>
            <span class="ys_edu_char" style="--i:9">u</span>
        </div>
    </div>
</div>
 
<script>
    // 立即执行:判断本地是否已经记录过播放状态
    (function() {
        if (!localStorage.getItem('ys_edu_preloader_shown')) {
            var preloader = document.getElementById('ys_edu_custom-preloader');
            if (preloader) preloader.style.display = 'flex';
        }
    })();
</script>
 
<script>
    document.addEventListener('DOMContentLoaded', function() {
        const preloader = document.getElementById('ys_edu_custom-preloader');
 
        // 再次确认:如果已经播放过,直接跳过后续的 JS 动画逻辑
        if (localStorage.getItem('ys_edu_preloader_shown')) {
            return; 
        }
 
        const logoUrl = "/wp-content/uploads/2026/03/preload-logo.webp";
        const img = new Image();
        img.src = logoUrl;
 
        img.onload = function() {
            const logoElement = document.getElementById('ys_edu_preloader-logo');
            if (preloader && logoElement) {
                logoElement.src = logoUrl;
                preloader.classList.add('ys_edu_start-anim');
                const animStartTime = Date.now();
 
                window.addEventListener('load', function() {
                    const minTime = 3000;
                    const checkInterval = setInterval(function() {
                        if (Date.now() - animStartTime >= minTime) {
                            clearInterval(checkInterval);
                            preloader.style.opacity = '0';
                            setTimeout(function() {
                                preloader.style.display = 'none';
                                // 动画结束,将状态永久写入用户的浏览器本地存储
                                localStorage.setItem('ys_edu_preloader_shown', 'true');
                            }, 600);
                        }
                    }, 100);
                });
            }
        };
 
        img.onerror = function() {
            if (preloader) preloader.style.display = 'none';
            // 即使图片加载失败,也标记为已播放,避免每次刷新都卡死
            localStorage.setItem('ys_edu_preloader_shown', 'true');
        };
    });
</script>