feat: 将 35 个姓名放入半透明大区块

- 姓名按 4 列 × 9 行排列,仍保留右下角空位
- 大区块背景 alpha 0.5,不再为每个姓名单独绘制底板
This commit is contained in:
rogerwang2008 committed 2026-11-11 00:31:12 +08:00
1 parent 6406858015
commit 1b6872424a
2 files changed
+25 -18

No files matched your search

+18 -10
View File
@@ -123,7 +123,7 @@
credits.textContent = '演职员表';
scene.append(credits);
/* 35 个 nametag:4 列 × 9 行,右下角缺一个 */
/* 35 个姓名:4 列 × 9 行,放在一个半透明大区块上 */
const NAMES = [
'郑滕飞', '秦雪莹', '关宸宇', '王天晓', '谢雨舟', '储明威', '庞熙若',
'刘婉莹', '陈彦淇', '古雅文', '周胤伯', '郑佳欣', '娄敬庭', '张加弛',
@@ -143,6 +143,21 @@
top: 12,
};
const blockWidth = TAG.cols * TAG.width + (TAG.cols - 1) * TAG.gapX;
const blockHeight = TAG.rows * TAG.height + (TAG.rows - 1) * TAG.gapY;
const block = document.createElement('div');
block.className = 'nametag-block';
block.style.left = `${TAG.left}em`;
block.style.top = `${TAG.top}em`;
block.style.width = `${blockWidth}em`;
block.style.height = `${blockHeight}em`;
block.style.gridTemplateColumns = `repeat(${TAG.cols}, ${TAG.width}em)`;
block.style.gridAutoRows = `${TAG.height}em`;
block.style.columnGap = `${TAG.gapX}em`;
block.style.rowGap = `${TAG.gapY}em`;
scene.append(block);
let nameIndex = 0;
for (let row = 0; row < TAG.rows; row++) {
for (let col = 0; col < TAG.cols; col++) {
@@ -151,17 +166,10 @@
const name = NAMES[nameIndex++];
if (!name) break;
const tag = document.createElement('div');
tag.className = 'nametag';
tag.style.left = `${TAG.left + col * (TAG.width + TAG.gapX)}em`;
tag.style.top = `${TAG.top + row * (TAG.height + TAG.gapY)}em`;
const label = document.createElement('span');
const label = document.createElement('div');
label.className = 'nametag-name';
label.textContent = name;
tag.append(label);
scene.append(tag);
block.append(label);
}
}
})();