-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfancy-header-preview.html
More file actions
357 lines (325 loc) · 13.8 KB
/
Copy pathfancy-header-preview.html
File metadata and controls
357 lines (325 loc) · 13.8 KB
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Header Font Preview · v1.12.0</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@700;900&family=Noto+Serif+TC:wght@700;900&display=swap" rel="stylesheet">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: "Microsoft JhengHei", "微軟正黑體", -apple-system, BlinkMacSystemFont, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
background-attachment: fixed;
min-height: 100vh;
overflow-x: hidden;
color: white;
}
#stellar-bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
opacity: 0.7;
}
.preview-container {
position: relative;
z-index: 1;
padding: 30px 30px 60px;
max-width: 1400px;
margin: 0 auto;
}
.intro {
text-align: center;
margin-bottom: 30px;
padding: 20px;
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(10px);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.15);
}
.intro h2 { font-size: 18px; margin-bottom: 6px; }
.intro p { font-size: 13px; opacity: 0.85; }
.preview-section {
position: relative;
margin-bottom: 24px;
padding: 60px 30px;
border-radius: 24px;
background: rgba(0, 0, 0, 0.18);
backdrop-filter: blur(8px);
border: 1px solid rgba(255, 255, 255, 0.12);
min-height: 220px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.option-label {
position: absolute;
top: 14px;
left: 18px;
padding: 4px 12px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.15);
color: white;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.5px;
border: 1px solid rgba(255, 255, 255, 0.25);
}
.option-tagline {
font-size: 13px;
color: rgba(255, 255, 255, 0.7);
margin-top: 22px;
text-align: center;
}
/* ============================================== */
/* Shared Option A style: emoji + gradient text */
/* ============================================== */
.hero-title {
display: inline-flex;
align-items: center;
gap: 14px;
font-size: 40px;
letter-spacing: 1.5px;
line-height: 1.3;
}
.hero-emoji {
font-size: 42px;
filter: drop-shadow(0 2px 8px rgba(102, 126, 234, 0.4));
-webkit-text-fill-color: initial;
}
.hero-text {
background: linear-gradient(135deg, #a3b3ff 0%, #c4a3ff 50%, #e9d5ff 100%);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
color: transparent;
filter:
drop-shadow(0 2px 12px rgba(102, 126, 234, 0.6))
drop-shadow(0 0 24px rgba(196, 181, 253, 0.3));
}
/* ============================================== */
/* Font variants */
/* ============================================== */
/* FONT 1 · Microsoft JhengHei (current baseline) — modern sans, system font */
.font-1 {
font-family: "Microsoft JhengHei", "微軟正黑體", sans-serif;
font-weight: 800;
}
/* FONT 2 · Noto Sans TC 900 — modern display sans, heavier presence */
.font-2 {
font-family: "Noto Sans TC", "Microsoft JhengHei", "微軟正黑體", sans-serif;
font-weight: 900;
}
/* FONT 3 · Noto Serif TC 900 — elegant serif, academic feel */
.font-3 {
font-family: "Noto Serif TC", "新細明體", "PMingLiU", serif;
font-weight: 900;
letter-spacing: 2.5px;
}
</style>
</head>
<body>
<canvas id="stellar-bg"></canvas>
<div class="preview-container">
<div class="intro">
<h2>Header 字體三選一 · 都用 Option A (Gradient + Glow) 風格</h2>
<p>🎓 emoji 不被 gradient 吃掉,保留原始彩色 · 字體變化在中文與字重</p>
</div>
<!-- FONT 1 -->
<section class="preview-section">
<span class="option-label">FONT 1 · Microsoft JhengHei (現在用的)</span>
<h1 class="hero-title">
<span class="hero-emoji">🎓</span>
<span class="hero-text font-1">資工系畢業學分檢核系統</span>
</h1>
<div class="option-tagline">
系統字 · 中性、低調 · 800 weight<br>
字寬一致、無襯線、適合資訊密度高的場合
</div>
</section>
<!-- FONT 2 -->
<section class="preview-section">
<span class="option-label">FONT 2 · Noto Sans TC w900 (Google Fonts)</span>
<h1 class="hero-title">
<span class="hero-emoji">🎓</span>
<span class="hero-text font-2">資工系畢業學分檢核系統</span>
</h1>
<div class="option-tagline">
Noto Sans TC · 現代 display sans · 900 weight 最重<br>
筆畫更實、結構更工整、有「標題」的厚重感
</div>
</section>
<!-- FONT 3 -->
<section class="preview-section">
<span class="option-label">FONT 3 · Noto Serif TC w900 (Google Fonts)</span>
<h1 class="hero-title">
<span class="hero-emoji">🎓</span>
<span class="hero-text font-3">資工系畢業學分檢核系統</span>
</h1>
<div class="option-tagline">
Noto Serif TC · 明體系襯線 · 900 weight<br>
有「學術/正式」感、襯線結構讓字更有節奏、適合畢業/檢核這類儀式感場景
</div>
</section>
</div>
<script>
// ===== 星星網絡背景動畫(從 index.html 抽出)=====
(function initStellarBackground() {
const canvas = document.getElementById('stellar-bg');
const ctx = canvas.getContext('2d');
let width, height;
let stars = [];
let shootingStars = [];
let mouse = { x: null, y: null };
let time = 0;
const starColors = [
{ r: 102, g: 126, b: 234 },
{ r: 118, g: 75, b: 162 },
{ r: 147, g: 197, b: 253 },
{ r: 196, g: 181, b: 253 },
{ r: 165, g: 180, b: 252 },
];
const config = {
starCount: 130,
minStarSize: 0.6,
maxStarSize: 4,
connectionDistance: 150,
mouseRadius: 200,
baseSpeed: 0.15,
shootingStarInterval: 12000,
shootingStarChance: 0.4,
};
function resize() {
width = canvas.width = window.innerWidth;
height = canvas.height = window.innerHeight;
}
function createStars() {
stars = [];
for (let i = 0; i < config.starCount; i++) {
const sizeRandom = Math.random();
let size;
if (sizeRandom < 0.6) size = config.minStarSize + Math.random();
else if (sizeRandom < 0.9) size = 1.5 + Math.random() * 1.5;
else size = 2.5 + Math.random() * (config.maxStarSize - 2.5);
const depthFactor = size / config.maxStarSize;
const speed = config.baseSpeed * (0.3 + depthFactor * 0.7);
const color = starColors[Math.floor(Math.random() * starColors.length)];
stars.push({
x: Math.random() * width,
y: Math.random() * height,
vx: (Math.random() - 0.5) * speed,
vy: (Math.random() - 0.5) * speed,
size,
baseOpacity: size > 2.5 ? 0.4 + Math.random() * 0.2 : 0.5 + Math.random() * 0.4,
color,
twinkleSpeed: 0.02 + Math.random() * 0.03,
twinklePhase: Math.random() * Math.PI * 2,
twinkleAmount: 0.2 + Math.random() * 0.3,
});
}
}
function createShootingStar() {
if (Math.random() > config.shootingStarChance) return;
const startX = Math.random() * width * 0.7;
const startY = Math.random() * height * 0.3;
const angle = Math.PI / 6 + Math.random() * Math.PI / 6;
const speed = 8 + Math.random() * 6;
shootingStars.push({
x: startX, y: startY,
vx: Math.cos(angle) * speed,
vy: Math.sin(angle) * speed,
life: 1, decay: 0.015 + Math.random() * 0.01,
length: 80 + Math.random() * 60,
size: 1.5 + Math.random(),
});
}
function drawStar(star) {
const twinkle = Math.sin(time * star.twinkleSpeed + star.twinklePhase);
const opacity = star.baseOpacity + twinkle * star.twinkleAmount * star.baseOpacity;
ctx.beginPath();
ctx.arc(star.x, star.y, star.size, 0, Math.PI * 2);
ctx.fillStyle = `rgba(${star.color.r}, ${star.color.g}, ${star.color.b}, ${Math.max(0.1, opacity)})`;
ctx.fill();
}
function drawShootingStar(star) {
const gradient = ctx.createLinearGradient(
star.x, star.y,
star.x - star.vx * star.length / 10,
star.y - star.vy * star.length / 10
);
gradient.addColorStop(0, `rgba(255, 255, 255, ${star.life * 0.9})`);
gradient.addColorStop(0.3, `rgba(200, 210, 255, ${star.life * 0.6})`);
gradient.addColorStop(1, 'rgba(102, 126, 234, 0)');
ctx.beginPath();
ctx.moveTo(star.x, star.y);
ctx.lineTo(star.x - star.vx * star.length / 10, star.y - star.vy * star.length / 10);
ctx.strokeStyle = gradient;
ctx.lineWidth = star.size * star.life;
ctx.lineCap = 'round';
ctx.stroke();
}
function drawConnection(a, b, distance) {
const opacity = 1 - (distance / config.connectionDistance);
ctx.beginPath();
ctx.moveTo(a.x, a.y);
ctx.lineTo(b.x, b.y);
ctx.strokeStyle = `rgba(102, 126, 234, ${opacity * 0.18})`;
ctx.lineWidth = 0.8;
ctx.stroke();
}
function update() {
time++;
stars.forEach(s => {
s.x += s.vx; s.y += s.vy;
if (s.x < 0 || s.x > width) s.vx *= -1;
if (s.y < 0 || s.y > height) s.vy *= -1;
if (mouse.x !== null && mouse.y !== null) {
const dx = mouse.x - s.x, dy = mouse.y - s.y;
const d = Math.sqrt(dx * dx + dy * dy);
if (d < config.mouseRadius) {
const f = (config.mouseRadius - d) / config.mouseRadius;
s.x -= dx * f * 0.015;
s.y -= dy * f * 0.015;
}
}
});
shootingStars.forEach(s => { s.x += s.vx; s.y += s.vy; s.life -= s.decay; });
shootingStars = shootingStars.filter(s => s.life > 0);
}
function draw() {
ctx.clearRect(0, 0, width, height);
for (let i = 0; i < stars.length; i++) {
for (let j = i + 1; j < stars.length; j++) {
const dx = stars[i].x - stars[j].x;
const dy = stars[i].y - stars[j].y;
const d = Math.sqrt(dx * dx + dy * dy);
if (d < config.connectionDistance) drawConnection(stars[i], stars[j], d);
}
}
stars.forEach(drawStar);
shootingStars.forEach(drawShootingStar);
}
function animate() {
update();
draw();
requestAnimationFrame(animate);
}
window.addEventListener('resize', () => { resize(); createStars(); });
window.addEventListener('mousemove', e => { mouse.x = e.clientX; mouse.y = e.clientY; });
window.addEventListener('mouseleave', () => { mouse.x = null; mouse.y = null; });
setInterval(createShootingStar, config.shootingStarInterval);
resize();
createStars();
animate();
setTimeout(createShootingStar, 2000);
})();
</script>
</body>
</html>