Surf commited on
Commit
9c27eba
·
1 Parent(s): cfb8d75

封面:在真人IP资产上重排大标题与金句(推送 #34)

Browse files
README.md CHANGED
@@ -48,8 +48,8 @@ pinned: false
48
  ### v6.1 过程日志
49
 
50
  - [x] **#33 计划**:已写入本节,尚未提交文字重排代码。
51
- - [ ] **#34 封面重排**:待完成。
52
- - [ ] **#35 构建质检**:待完成。
53
 
54
  ---
55
 
 
48
  ### v6.1 过程日志
49
 
50
  - [x] **#33 计划**:已写入本节,尚未提交文字重排代码。
51
+ - [x] **#34 封面重排**:保留生成图原貌,把封面改成“左侧文字留白 + 右侧真人图”(横版)和“上方真人图 + 下方文字卡”(竖版);重新加入大号“奥德彪”、一条短金句、章节标签、`REAL PERSON IP` 与“语录二创”。
52
+ - [ ] **#35 构建质检**:本地类型检查、构建、387 张浏览器回归和视觉复核已通过,待推送新版入口并做远端核验。
53
 
54
  ---
55
 
assets/index-ip-789374750c.js ADDED
The diff for this file is too large to render. See raw diff
 
index.html CHANGED
@@ -12,7 +12,7 @@
12
  document.documentElement.classList.add('dark');
13
  </script>
14
  <link rel="stylesheet" crossorigin href="./assets/index-Ce46jEpY.css">
15
- <script type="module" crossorigin src="./assets/index-ip-0913f5b5af.js"></script>
16
  </head>
17
  <body>
18
  <div id="root"><!--ssr-outlet--></div>
 
12
  document.documentElement.classList.add('dark');
13
  </script>
14
  <link rel="stylesheet" crossorigin href="./assets/index-Ce46jEpY.css">
15
+ <script type="module" crossorigin src="./assets/index-ip-789374750c.js"></script>
16
  </head>
17
  <body>
18
  <div id="root"><!--ssr-outlet--></div>
src/film/core/covers.ts CHANGED
@@ -56,10 +56,15 @@ export interface CoverBox { role: string; x: number; y: number; w: number; h: nu
56
  export interface CoverLayout { portrait: CoverBox; name: CoverBox; hook: CoverBox; footer: CoverBox }
57
  export function coverLayout(w: number, h: number): CoverLayout {
58
  const p = h > w, s = Math.min(w, h), m = s * 0.065
 
 
 
 
 
59
  return {
60
- portrait: p ? { role: 'portrait', x: w * 0.265, y: h * 0.105, w: w * 0.72, h: w * 0.72 } : { role: 'portrait', x: w * 0.485, y: h * 0.12, w: Math.min(h * 0.83, w * 0.49), h: Math.min(h * 0.83, w * 0.49) },
61
- name: p ? { role: 'name', x: m, y: h * 0.17, w: w * 0.2, h: h * 0.30 } : { role: 'name', x: m, y: h * 0.17, w: w * 0.42, h: h * 0.18 },
62
- hook: p ? { role: 'hook', x: m, y: h * 0.69, w: w - 2 * m, h: h * 0.205 } : { role: 'hook', x: m, y: h * 0.42, w: w * 0.42, h: h * 0.335 },
63
  footer: { role: 'footer', x: m, y: h - s * 0.055, w: w - 2 * m, h: s * 0.022 },
64
  }
65
  }
@@ -93,13 +98,13 @@ function pill(g: CanvasRenderingContext2D, value: string, x: number, y: number,
93
  }
94
 
95
  function drawPortrait(g: CanvasRenderingContext2D, source: HTMLCanvasElement, b: CoverBox, color: string, unit: number) {
96
- // 生成图本身已经包含个人 IP 的鲜明背景;这里统一做圆角裁切、投影和描边。
97
  g.save()
98
  g.shadowColor = '#00170e66'; g.shadowBlur = unit * 24; g.shadowOffsetX = unit * 7; g.shadowOffsetY = unit * 10
99
- g.beginPath(); g.roundRect(b.x, b.y, b.w, b.h, unit * 12); g.clip()
100
  g.drawImage(source, b.x, b.y, b.w, b.h)
101
  g.restore()
102
- g.save(); g.strokeStyle = color; g.lineWidth = Math.max(2, unit * 5); g.beginPath(); g.roundRect(b.x, b.y, b.w, b.h, unit * 12); g.stroke(); g.restore()
103
  }
104
 
105
  export async function renderCover(id: number, ratio: Ratio, design: Design): Promise<HTMLCanvasElement> {
@@ -111,32 +116,32 @@ export async function renderCover(id: number, ratio: Ratio, design: Design): Pro
111
  const green = design === 'tropical', dark = design === 'quoteCard'
112
  const bg = green ? '#086649' : dark ? '#171C19' : YELLOW
113
  const fg = green || dark ? PAPER : INK
 
114
  g.fillStyle = bg; g.fillRect(0, 0, w, h)
115
- // 主视觉装饰位于人物后方,保持脸部和标题无干扰。
116
- g.save(); g.globalAlpha = dark ? 0.08 : 0.15; g.strokeStyle = fg; g.lineWidth = s * 0.002
117
- for (let i = 0; i < 5; i++) { g.beginPath(); g.arc(w * 0.8, h * 0.37, s * (0.18 + i * 0.08), 0, Math.PI * 2); g.stroke() }
118
- g.restore()
119
- g.fillStyle = green ? YELLOW : dark ? '#2B3B2F' : '#E9B900'
120
- g.beginPath(); g.moveTo(w * 0.58, h * 0.16); g.lineTo(w, h * 0.1); g.lineTo(w, h * 0.87); g.lineTo(w * 0.46, h * 0.91); g.closePath(); g.fill()
121
- if (green) {
122
- g.fillStyle = RED; g.beginPath(); g.arc(w * 0.9, h * 0.25, s * 0.13, 0, Math.PI * 2); g.fill()
123
- }
124
- // 页眉为系列设计,不使用“官方/本人发布/亲口说”等暗示背书的标记。
125
- text(g, 'ODEBIAO / THE QUOTES', m, h * 0.047, s * 0.018, fg, FONT.mono, 400)
126
- g.fillStyle = RED; g.fillRect(m, h * 0.087, s * 0.065, s * 0.008)
127
- drawPortrait(g, person, L.portrait, dark || green ? YELLOW : PAPER, u)
128
- const titleBox = textBlock(g, '奥德彪', L.name, p ? 1 : 3, fg, FONT.brush, 400)
129
- if (p) {
130
- // 竖版人物在上、文字在下,姓名竖排不挡脸。
131
- g.fillStyle = bg; g.fillRect(0, h * 0.65, w, h * 0.35)
132
  }
133
- pill(g, getCopy(id)?.chapter || '奥德彪语录', m, p ? h * 0.608 : h * 0.34, s * 0.025, green || dark ? YELLOW : INK, green || dark ? INK : YELLOW)
134
- const hookBox = textBlock(g, coverHook(id), L.hook, p ? 8 : 7, dark ? YELLOW : fg)
135
- g.strokeStyle = green || dark ? '#ffffff44' : '#10171344'; g.lineWidth = Math.max(1, u)
 
 
 
 
 
 
 
 
 
 
136
  g.beginPath(); g.moveTo(m, h - s * 0.09); g.lineTo(w - m, h - s * 0.09); g.stroke()
137
  text(g, `语录二创 · ${pad2(id)} / 43`, L.footer.x, L.footer.y, s * 0.022, fg, FONT.sans, 500)
138
  g.font = `400 ${s * 0.018}px ${FONT.mono}`; g.textAlign = 'right'; g.fillStyle = fg; g.fillText('ON THE ROAD.', w - m, L.footer.y)
139
- // 内部测试读取具体边界;正常下载 PNG 不包含任何测试标记。
140
  c.dataset.layout = JSON.stringify([titleBox, hookBox, L.footer])
141
  c.dataset.portraitAsset = PORTRAIT_ASSET
142
  return c
 
56
  export interface CoverLayout { portrait: CoverBox; name: CoverBox; hook: CoverBox; footer: CoverBox }
57
  export function coverLayout(w: number, h: number): CoverLayout {
58
  const p = h > w, s = Math.min(w, h), m = s * 0.065
59
+ // 生成图作为主视觉整块放在右侧/上方,文字只进入留白色块,不压脸。
60
+ const imageSize = p ? w : Math.min(h * 0.84, w * 0.67)
61
+ const imageX = p ? 0 : w - imageSize
62
+ const imageY = p ? 0 : (h - imageSize) / 2
63
+ const textW = p ? w - 2 * m : Math.max(s * 0.25, imageX - 2 * m)
64
  return {
65
+ portrait: { role: 'portrait', x: imageX, y: imageY, w: imageSize, h: imageSize },
66
+ name: p ? { role: 'name', x: m, y: h * 0.75, w: textW, h: h * 0.08 } : { role: 'name', x: m, y: h * 0.13, w: textW, h: h * 0.18 },
67
+ hook: p ? { role: 'hook', x: m, y: h * 0.875, w: textW, h: h * 0.10 } : { role: 'hook', x: m, y: h * 0.42, w: textW, h: h * 0.30 },
68
  footer: { role: 'footer', x: m, y: h - s * 0.055, w: w - 2 * m, h: s * 0.022 },
69
  }
70
  }
 
98
  }
99
 
100
  function drawPortrait(g: CanvasRenderingContext2D, source: HTMLCanvasElement, b: CoverBox, color: string, unit: number) {
101
+ // 资产本身就是完整个人 IP 画面;封面只负责把它与文字留白拼成海报。
102
  g.save()
103
  g.shadowColor = '#00170e66'; g.shadowBlur = unit * 24; g.shadowOffsetX = unit * 7; g.shadowOffsetY = unit * 10
104
+ g.beginPath(); g.roundRect(b.x, b.y, b.w, b.h, unit * 10); g.clip()
105
  g.drawImage(source, b.x, b.y, b.w, b.h)
106
  g.restore()
107
+ g.save(); g.strokeStyle = color; g.lineWidth = Math.max(2, unit * 4); g.beginPath(); g.roundRect(b.x, b.y, b.w, b.h, unit * 10); g.stroke(); g.restore()
108
  }
109
 
110
  export async function renderCover(id: number, ratio: Ratio, design: Design): Promise<HTMLCanvasElement> {
 
116
  const green = design === 'tropical', dark = design === 'quoteCard'
117
  const bg = green ? '#086649' : dark ? '#171C19' : YELLOW
118
  const fg = green || dark ? PAPER : INK
119
+ const accent = green ? YELLOW : dark ? YELLOW : RED
120
  g.fillStyle = bg; g.fillRect(0, 0, w, h)
121
+ // 左侧/下方是文字留白,生成图只占一块明确的主视觉区域。
122
+ if (!p) {
123
+ const panel = g.createLinearGradient(0, 0, L.portrait.x + s * 0.08, 0)
124
+ panel.addColorStop(0, bg); panel.addColorStop(0.78, bg); panel.addColorStop(1, `${bg}00`)
125
+ g.fillStyle = panel; g.fillRect(0, 0, L.portrait.x + s * 0.12, h)
126
+ } else {
127
+ g.fillStyle = bg; g.fillRect(0, L.portrait.h, w, h - L.portrait.h)
 
 
 
 
 
 
 
 
 
 
128
  }
129
+ drawPortrait(g, person, L.portrait, accent, u)
130
+ // 一条明确的色带把“人物视觉资产”和“封面文案”绑在一起。
131
+ g.fillStyle = accent; g.fillRect(m, p ? L.portrait.h + h * 0.018 : h * 0.08, s * 0.08, Math.max(4, s * 0.012))
132
+ g.save(); g.shadowColor = '#00000088'; g.shadowBlur = s * 0.018
133
+ text(g, 'ODEBIAO / REAL PERSON IP', m, p ? h * 0.705 : h * 0.115, s * 0.018, fg, FONT.mono, 500)
134
+ const titleBox = textBlock(g, '奥德彪', L.name, 3, fg, FONT.brush, 400)
135
+ g.restore()
136
+ const pillY = p ? h * 0.835 : h * 0.33
137
+ pill(g, getCopy(id)?.chapter || '奥德彪语录', m, pillY, s * 0.025, accent, green || dark ? INK : PAPER)
138
+ g.save(); g.shadowColor = '#000000aa'; g.shadowBlur = s * 0.014
139
+ const hookBox = textBlock(g, coverHook(id), L.hook, p ? 9 : 8, dark ? YELLOW : fg, FONT.sans, 800)
140
+ g.restore()
141
+ g.strokeStyle = `${accent}88`; g.lineWidth = Math.max(1, u)
142
  g.beginPath(); g.moveTo(m, h - s * 0.09); g.lineTo(w - m, h - s * 0.09); g.stroke()
143
  text(g, `语录二创 · ${pad2(id)} / 43`, L.footer.x, L.footer.y, s * 0.022, fg, FONT.sans, 500)
144
  g.font = `400 ${s * 0.018}px ${FONT.mono}`; g.textAlign = 'right'; g.fillStyle = fg; g.fillText('ON THE ROAD.', w - m, L.footer.y)
 
145
  c.dataset.layout = JSON.stringify([titleBox, hookBox, L.footer])
146
  c.dataset.portraitAsset = PORTRAIT_ASSET
147
  return c