feat: 完善文字画视觉并新增 PDF 导出

- 调整飞鸟、楼群与标题配色和布局
- 新增 uv + Playwright PDF 导出脚本,四边各留 1em
- 页面标题改为「封面」
This commit is contained in:
rogerwang2008 committed 2026-11-10 21:22:49 +08:00
1 parent 17a224be27
commit 6085fc24d3
8 files changed
+343 -19

No files matched your search

+20 -9
View File
@@ -39,22 +39,23 @@
/* 飞鸟:数量减少,间距不等,仅少量成对;上下拉开分布 */
const birds = [
{ x: 0, y: 2, kind: 'gull' },
{ x: 26, y: 2, kind: 'gull' },
{ x: 0, y: 2, kind: 'magpie' },
{ x: 26, y: 2, kind: 'magpie' },
{ x: 1, y: 4, kind: 'sparrow' },
{ x: 3, y: 8, kind: 'crow' },
{ x: 6, y: 13, kind: 'gull' },
{ x: 6, y: 13, kind: 'magpie' },
{ x: 9, y: 15, kind: 'sparrow' },
{ x: 26, y: 5, kind: 'crow' },
{ x: 17, y: 9, kind: 'sparrow' },
{ x: 21, y: 12, kind: 'gull' },
{ x: 21, y: 12, kind: 'magpie' },
{ x: 19, y: 15, kind: 'crow' },
];
/* 天线:单列「线」,从 y 向下叠 h 格;楼顶在第 31 行,露出部分为 3 / 4 格 */
/* 天线:单列「线」,从 y 向下叠 h 格;最右楼顶另加一根深色 */
const antennas = [
{ x: 7, y: 28, h: 3 },
{ x: 22, y: 27, h: 4 },
{ x: 26, y: 34, h: 3, cls: 'ant ant-dark' },
];
/* 楼群:n 对应 .bld-n,最终按 x/y/w/h 铺满「楼」(高度裁到第 44 行) */
@@ -72,12 +73,13 @@
/* 标题区:整格扣出的居中矩形,左右各留 3 格 */
const TITLE = {
text: '关于「甲子」的虚构故事',
emphasis: '甲子',
top: 14,
height: 5,
side: 3,
};
const BIRD_WORDS = { sparrow: '麻雀', gull: '海鸥', crow: '乌鸦' };
const BIRD_WORDS = { sparrow: '麻雀', magpie: '喜鹊', crow: '乌鸦' };
const grid = Array.from({ length: ROWS }, () =>
Array.from({ length: COLS }, () => ({ ch: '天', cls: 'sky' }))
@@ -112,8 +114,8 @@
put(x + 1, y, b, `bird-${kind}`);
}
for (const { x, y, h } of antennas) {
for (let i = 0; i < h; i++) put(x, y + i, '线', 'ant');
for (const { x, y, h, cls = 'ant' } of antennas) {
for (let i = 0; i < h; i++) put(x, y + i, '线', cls);
}
for (const { n, x, y, w, h } of buildings) {
@@ -153,7 +155,16 @@
const title = document.createElement('h1');
title.className = 'title';
title.textContent = TITLE.text;
const [before, after] = TITLE.text.split(TITLE.emphasis);
if (after === undefined) {
title.textContent = TITLE.text;
} else {
const em = document.createElement('span');
em.className = 'title-em';
em.textContent = TITLE.emphasis;
title.append(before, em, after);
}
panel.append(title);
scene.append(panel);