feat: 检索词表 + 表情技能 + 海报字重编排 三向增强

- 中文语义词表 425 → 619 条(+194),新增行业细分/商业指标/技术工程/合规风控/节日节气/生活服务等 17 组场景词;对 11.8 万图标名语料复核覆盖率 99.0%

- 表情技能 12 → 20(motion 11→13 新增循环接缝/多元素错峰;emotion 1→7 新增强度匹配/场景克制/覆盖度/可读性/调性一致/情绪跳变)

- 共享技能 54 → 55:新增头像向技能 avatar-safe-zone(圆/方裁切安全区),映射到方案评审步骤

- 海报字体层级:新增 TYPE_SCALES 四档白名单(impact/editorial/steady/quiet),AI 决策 JSON 增加 typeScaleId,渲染层按预设输出 400/700/800 与字号比;非法值回退默认

- 修复 audit-emojis.html 技能数量断言过期(12→20);emoji-smoke 62/62 通过,audit-emojis 27 通过 0 失败

- 版本联动 20261108e(cn-tags / skills core+layout / sticker skills / poster-generator+ai)
This commit is contained in:
sgp
2026-11-08 10:45:28 +08:00
parent 50d6e019ce
commit beb10e170b
16 changed files with 2020 additions and 80 deletions
+14 -5
View File
@@ -10,16 +10,20 @@ const HGB_PosterAI = (function () {
function buildPrompt(opt) {
const layoutList = HGB_PosterGenerator.LAYOUTS.map(l => `${l.id}:${l.name}`).join('\n');
const paletteList = HGB_PosterGenerator.PALETTES.map(p => `${p.id}:${p.name}(背景 ${p.bg})`).join('\n');
const sys = `你是顶级的海报设计师。请基于用户提供的主题信息,从白名单中选择版式与配色,设计多套专业海报方案。
const scaleList = HGB_PosterGenerator.TYPE_SCALES
.map(s => `${s.id}:${s.name}(标题 ${s.titleWeight} / 副标题 ${s.subWeight},标题占画布宽 ${Math.round(s.titleRatio * 1000) / 10}%)— ${s.note}`)
.join('\n');
const sys = `你是顶级的海报设计师。请基于用户提供的主题信息,从白名单中选择版式、配色与字体层级,设计多套专业海报方案。
设计原则:
1. 标题(title)精炼有力、突出主题;副标题(subtitle)补充说明(可空)。
2. 版式 layoutId 与配色 paletteId 必须从白名单中选择,不得编造。
3. 多套方案尽量使用不同的版式与配色,呈现不同设计方向。
4. 每套方案给出贴切的中文方案名(name)与设计理念(concept)。
2. 版式 layoutId、配色 paletteId、字体层级 typeScaleId 必须从白名单中选择,不得编造。
3. 字体层级按信息调性选择:促销/活动用强冲击,文化/品牌叙事用编辑感,政务/金融用稳健均衡,高端/极简用克制留白。
4. 多套方案尽量使用不同的版式、配色与字体层级,呈现不同设计方向。
5. 每套方案给出贴切的中文方案名(name)与设计理念(concept)。
只输出 JSON,不要输出任何其他文字。JSON 结构:
{ "overallConcept": "整体理念", "plans": [ { "name": "方案名", "title": "主标题", "subtitle": "副标题(可空)", "paletteId": "indigo", "layoutId": "centered", "concept": "设计理念" } ] }
{ "overallConcept": "整体理念", "plans": [ { "name": "方案名", "title": "主标题", "subtitle": "副标题(可空)", "paletteId": "indigo", "layoutId": "centered", "typeScaleId": "impact", "concept": "设计理念" } ] }
其中 plans 数组包含 ${opt.count || 5} 套方案。`;
const user = `【主题信息】
- 行业/主题:${opt.industry || '通用'}
@@ -33,6 +37,9 @@ ${layoutList}
【配色白名单】
${paletteList}
【字体层级白名单】
${scaleList}
请设计 ${opt.count || 5} 套海报方案。`;
return [
{ role: 'system', content: sys },
@@ -54,6 +61,7 @@ ${paletteList}
for (const p of data.plans) {
if (!HGB_PosterGenerator.PALETTES.some(x => x.id === p.paletteId)) p._paletteInvalid = true;
if (!HGB_PosterGenerator.LAYOUTS.some(x => x.id === p.layoutId)) p._layoutInvalid = true;
if (!HGB_PosterGenerator.TYPE_SCALES.some(x => x.id === p.typeScaleId)) p._scaleInvalid = true;
}
return data;
}
@@ -63,6 +71,7 @@ ${paletteList}
const decision = HGB_PosterGenerator.defaultDecision(p.title, p.subtitle);
if (!p._paletteInvalid) decision.paletteId = p.paletteId;
if (!p._layoutInvalid) decision.layoutId = p.layoutId;
if (!p._scaleInvalid) decision.typeScaleId = p.typeScaleId;
const elements = HGB_PosterGenerator.generate(spec, decision);
return {
id: 'poster_' + Date.now().toString(36) + idx.toString(36),
+31 -12
View File
@@ -13,6 +13,24 @@ const HGB_PosterGenerator = (function () {
{ id: 'minimal', name: '极简', bg: '#ffffff', primary: '#111827', accent: '#4f46e5' }
];
/**
* 字体层级预设(白名单):AI 只能从中选择,保证标题/副标题的字号比与字重组合可控。
* 字重限制在 400 / 700 / 800 —— 渲染器只内嵌 Noto Sans SC Regular(400) 与 Bold(700-900),
* 超出范围的权重会被浏览器合成,视觉不可控。
*/
const TYPE_SCALES = [
{ id: 'impact', name: '强冲击', titleWeight: 800, subWeight: 400, titleRatio: 0.075, subRatio: 0.38, note: '促销/活动主视觉,超大粗标题压场' },
{ id: 'editorial', name: '编辑感', titleWeight: 700, subWeight: 400, titleRatio: 0.062, subRatio: 0.44, note: '文化/品牌叙事,标题收敛、副标题更可读' },
{ id: 'steady', name: '稳健均衡', titleWeight: 700, subWeight: 700, titleRatio: 0.068, subRatio: 0.40, note: '政务/金融等信息型海报,标题副标题同粗同稳' },
{ id: 'quiet', name: '克制留白', titleWeight: 400, subWeight: 400, titleRatio: 0.052, subRatio: 0.46, note: '高端/极简,细标题+大留白,靠空间而非字重建立层级' }
];
const DEFAULT_SCALE = 'impact';
function scaleOf(id) {
return TYPE_SCALES.find(s => s.id === id) || TYPE_SCALES[0];
}
function uid(p) { return p + '_' + Date.now().toString(36) + Math.random().toString(36).slice(2, 6); }
function rect(id, x, y, w, h, fill) { return { id, type: 'rect', x, y, w, h, fill }; }
@@ -28,9 +46,9 @@ const HGB_PosterGenerator = (function () {
const cw = spec.w, ch = spec.h, els = [];
els.push(rect(uid('bg'), 0, 0, cw, ch, o.palette.bg));
els.push(circle(uid('dot'), cw / 2, ch * 0.30, ch * 0.12, o.palette.accent));
const fs = Math.round(cw * 0.075);
els.push(text(uid('title'), o.title, cw / 2, ch * 0.50, fs, 800, o.palette.primary, 'middle'));
if (o.sub) els.push(text(uid('sub'), o.sub, cw / 2, ch * 0.56, Math.round(fs * 0.38), 400, o.palette.primary, 'middle'));
const fs = Math.round(cw * o.scale.titleRatio);
els.push(text(uid('title'), o.title, cw / 2, ch * 0.50, fs, o.scale.titleWeight, o.palette.primary, 'middle'));
if (o.sub) els.push(text(uid('sub'), o.sub, cw / 2, ch * 0.56, Math.round(fs * o.scale.subRatio), o.scale.subWeight, o.palette.primary, 'middle'));
els.push(rect(uid('bar'), cw / 2 - cw * 0.12, ch * 0.62, cw * 0.24, 8, o.palette.accent));
return els;
}
@@ -42,9 +60,9 @@ const HGB_PosterGenerator = (function () {
els.push(rect(uid('bg'), 0, 0, cw, ch, o.palette.bg));
els.push(rect(uid('side'), 0, 0, cw * 0.06, ch, o.palette.accent));
const mx = cw * 0.13;
const fs = Math.round(cw * 0.08);
els.push(text(uid('title'), o.title, mx, ch * 0.44, fs, 800, o.palette.primary, 'start'));
if (o.sub) els.push(text(uid('sub'), o.sub, mx, ch * 0.52, Math.round(fs * 0.36), 400, o.palette.primary, 'start'));
const fs = Math.round(cw * o.scale.titleRatio);
els.push(text(uid('title'), o.title, mx, ch * 0.44, fs, o.scale.titleWeight, o.palette.primary, 'start'));
if (o.sub) els.push(text(uid('sub'), o.sub, mx, ch * 0.52, Math.round(fs * o.scale.subRatio), o.scale.subWeight, o.palette.primary, 'start'));
els.push(rect(uid('bar'), mx, ch * 0.58, cw * 0.18, 8, o.palette.accent));
return els;
}
@@ -55,9 +73,9 @@ const HGB_PosterGenerator = (function () {
const cw = spec.w, ch = spec.h, els = [];
els.push(rect(uid('bg'), 0, 0, cw, ch, o.palette.bg));
els.push(rect(uid('band'), 0, ch * 0.18, cw, ch * 0.16, o.palette.accent));
const fs = Math.round(cw * 0.07);
els.push(text(uid('title'), o.title, cw / 2, ch * 0.26, fs, 800, o.palette.bg, 'middle'));
if (o.sub) els.push(text(uid('sub'), o.sub, cw / 2, ch * 0.55, Math.round(fs * 0.42), 400, o.palette.primary, 'middle'));
const fs = Math.round(cw * o.scale.titleRatio);
els.push(text(uid('title'), o.title, cw / 2, ch * 0.26, fs, o.scale.titleWeight, o.palette.bg, 'middle'));
if (o.sub) els.push(text(uid('sub'), o.sub, cw / 2, ch * 0.55, Math.round(fs * o.scale.subRatio), o.scale.subWeight, o.palette.primary, 'middle'));
return els;
}
}
@@ -67,13 +85,14 @@ const HGB_PosterGenerator = (function () {
function generate(spec, decision) {
const palette = PALETTES.find(p => p.id === decision.paletteId) || PALETTES[0];
const layout = LAYOUTS.find(l => l.id === decision.layoutId) || LAYOUTS[0];
const o = { palette, title: decision.title || '海报标题', sub: decision.sub || '' };
const scale = scaleOf(decision.typeScaleId);
const o = { palette, scale, title: decision.title || '海报标题', sub: decision.sub || '' };
return layout.build(spec, o);
}
function defaultDecision(title, sub) {
return { paletteId: 'indigo', layoutId: 'centered', title: title || '海报标题', sub: sub || '' };
return { paletteId: 'indigo', layoutId: 'centered', typeScaleId: DEFAULT_SCALE, title: title || '海报标题', sub: sub || '' };
}
return { PALETTES, LAYOUTS, generate, defaultDecision };
return { PALETTES, LAYOUTS, TYPE_SCALES, scaleOf, generate, defaultDecision };
})();
+1229 -34
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -5,7 +5,7 @@
## 生成时间
2026-11-07T18:50:43.761Z
2026-11-08T02:38:04.341Z
## ① 图标库(共享,LOGO/头像/海报共用)
@@ -21,10 +21,10 @@
## ③ 技能库
- 共享技能:54(分类:layout 10 / color 9 / typography 8 / icon 8 / ai 6 / presentation 5 / export 8)
- 共享技能:55(分类:layout 11 / color 9 / typography 8 / icon 8 / ai 6 / presentation 5 / export 8)
- 海报技能:64(分类:layout 8 / color 8 / typography 8 / grid 8 / hierarchy 8 / print 8 / creative 8 / ai 8)
- 表情技能:12(分类:motion 11 / emotion 1)
- 三区覆盖(共享,按 scene/workspaces):LOGO 向 54 / 头像向 45 / 海报向 54 / 未标注 0
- 表情技能:20(分类:motion 13 / emotion 7)
- 三区覆盖(共享,按 scene/workspaces):LOGO 向 54 / 头像向 46 / 海报向 54 / 未标注 0
- 三区覆盖(海报专属):LOGO 向 0 / 头像向 0 / 海报向 64
- 技能明细:js/data/manifest/skills.json
+176 -3
View File
@@ -1,9 +1,9 @@
{
"kind": "skills",
"generatedAt": "2026-08-23T17:18:35.193Z",
"generatedAt": "2026-11-08T02:38:00.293Z",
"guide": "js/data/manifest/README.md",
"shared": {
"total": 54,
"total": 55,
"categories": [
{
"step": 1,
@@ -288,6 +288,46 @@
"poster"
]
},
{
"id": "avatar-safe-zone",
"name": "头像安全区",
"category": "layout",
"emoji": "⭕",
"scene": "头像导出前的圆/方裁切安全检查(微信/QQ/抖音等平台多为圆形裁切)",
"summary": "圆形裁切时主体直径占画布 62%-78% 最稳(平台会裁掉四角),方形 70%-88%;主体中心偏移不得超过留白的一半,否则裁切后偏边。",
"params": [
{
"name": "crop",
"type": "string",
"required": false,
"desc": "裁切形状:'circle' 圆形(默认)/ 'square' 方形"
},
{
"name": "subjectRatio",
"type": "number",
"required": false,
"desc": "主体直径占画布比例(默认 0.7)"
},
{
"name": "size",
"type": "number",
"required": false,
"desc": "画布边长 px(默认 300)"
},
{
"name": "offset",
"type": "object",
"required": false,
"desc": "主体中心相对画布中心偏移 {x,y}(px)"
}
],
"source": "自研(平台头像裁切规范:圆形内切 + 留白安全域)",
"step": 3,
"kind": "check",
"workspaces": [
"avatar"
]
},
{
"id": "contrast-check",
"name": "对比度校验",
@@ -2495,7 +2535,7 @@
]
},
"sticker": {
"total": 12,
"total": 20,
"categories": null,
"skills": [
{
@@ -2692,6 +2732,139 @@
"workspaces": [
"emoji"
]
},
{
"id": "motion-loop-seam",
"name": "循环接缝",
"category": "motion",
"emoji": "🔁",
"scene": "检查循环类动画(漂浮/呼吸/脉冲/旋转)首尾帧是否闭合,避免导出 GIF 时出现跳帧",
"summary": "周期动画必须满足 f(0) ≈ f(1):正弦驱动天然闭合;含位移累加或线性旋转的动画需确认整周期回到原点。",
"params": {
"type": "动画类型 id",
"cycles": "整周期内的往返次数(默认 1)",
"amplitude": "强度倍率"
},
"source": "自研(循环动画连续性)",
"workspaces": [
"emoji"
]
},
{
"id": "motion-multi-element",
"name": "多元素错峰",
"category": "motion",
"emoji": "🎚",
"scene": "表情由主图 + 装饰(星星/汗滴/符号)组成时,检查各元素是否错峰,避免整组同相抖动",
"summary": "N 个元素应按周期均匀分配相位延迟(delay = period / N),主图领先、装饰跟随 0.1-0.25 个周期。",
"params": {
"elements": "元素数量",
"duration": "周期秒(默认 1.2)",
"leadRatio": "主图领先比例(默认 0.08)"
},
"source": "自研(分层动画错峰)",
"workspaces": [
"emoji"
]
},
{
"id": "emotion-intensity",
"name": "情绪强度匹配",
"category": "emotion",
"emoji": "🌡",
"scene": "评估动画幅度/节奏是否与情绪强度一致(微笑用轻浮动,狂喜才用夸张弹跳)",
"summary": "强度 1-5 与动效幅度映射:1-2 用呼吸/淡入,3 用脉冲/浮动,4-5 才用弹跳/心跳/抖动。",
"params": {
"intensity": "情绪强度 1-5(默认 3)",
"amplitude": "动效幅度倍率(默认 1)",
"type": "动画类型 id"
},
"source": "自研(情绪-动效映射)",
"workspaces": [
"emoji"
]
},
{
"id": "emotion-context",
"name": "场景克制度",
"category": "emotion",
"emoji": "🏷",
"scene": "同一情绪在不同使用场景(聊天/弹幕/工作群/亲密关系)需要不同表达强度",
"summary": "工作场景避免强烈负向与夸张动效;弹幕需高辨识度短动效;亲密场景可夸张;聊天居中即可。",
"params": {
"scene": "场景(chat/bullet/work/intimate,默认 chat)",
"emotion": "情绪 id(如 joy/anger/sad/wow/love)",
"amplitude": "动效幅度(默认 1)"
},
"source": "自研(场景化表情规范)",
"workspaces": [
"emoji"
]
},
{
"id": "emotion-coverage",
"name": "情绪覆盖度",
"category": "emotion",
"emoji": "🎭",
"scene": "检查一套表情包的情绪分布是否失衡(全是开心 / 缺中性 / 负向过多)",
"summary": "健康的一组表情建议:正向 50%-70%、中性 15%-30%、负向 10%-25%,且必含至少 1 个中性锚点。",
"params": {
"emotions": "情绪 id 数组或 {joy:4, neutral:1} 计数对象"
},
"source": "自研(表情包情绪配比)",
"workspaces": [
"emoji"
]
},
{
"id": "emotion-clarity",
"name": "情绪可读性",
"category": "emotion",
"emoji": "👁",
"scene": "小尺寸(48-96px)下表情是否一眼可辨,装饰过多会削弱情绪识别",
"summary": "主体占画面 ≥ 60%、装饰元素 ≤ 2 个、避免细碎线条;小尺寸优先强化眼神与嘴形这类情绪特征。",
"params": {
"size": "展示尺寸 px(默认 64)",
"subjectRatio": "主体占比 0-1(默认 0.7)",
"decorations": "装饰元素数(默认 1)",
"fineLines": "细碎线条数(默认 0)"
},
"source": "自研(小尺寸可读性)",
"workspaces": [
"emoji"
]
},
{
"id": "emotion-brand-fit",
"name": "角色调性一致性",
"category": "emotion",
"emoji": "🧭",
"scene": "角色/IP/品牌有固定调性时,检查表情情绪是否越界(严谨品牌不适合夸张搞怪)",
"summary": "调性决定可用情绪集:friendly 全开、calm 去狂喜狂怒、sharp 弱化软萌、formal 仅中性+轻正向。",
"params": {
"tone": "调性(friendly/calm/sharp/formal,默认 friendly)",
"emotion": "情绪 id",
"amplitude": "动效幅度(默认 1)"
},
"source": "自研(品牌调性-情绪白名单)",
"workspaces": [
"emoji"
]
},
{
"id": "emotion-transition",
"name": "情绪跳变",
"category": "emotion",
"emoji": "↔️",
"scene": "一组表情按顺序播放或成套使用时,相邻情绪强度落差过大会显得突兀",
"summary": "相邻情绪强度差建议 ≤2;强负向与强正向之间应有中性过渡项。",
"params": {
"sequence": "情绪 id 数组(按使用顺序)"
},
"source": "自研(情绪序列过渡)",
"workspaces": [
"emoji"
]
}
]
}
+1 -1
View File
@@ -77,7 +77,7 @@ const HGB_Skills = (function () {
'neutral-palette': 2,
// ③ 方案评审(检查类)
'composition': 3, 'align-check': 3, 'negative-space': 3, 'spacing-check': 3, 'proportion-check': 3,
'visual-balance': 3, 'focal-point': 3, 'rule-of-thirds': 3, 'circle-crop-safety': 3,
'visual-balance': 3, 'focal-point': 3, 'rule-of-thirds': 3, 'circle-crop-safety': 3, 'avatar-safe-zone': 3,
'contrast-check': 3, 'wcag-contrast': 3, 'color-blind-check': 3, 'monochrome-check': 3,
'font-hierarchy': 3, 'text-fit': 3, 'tiny-readable': 3, 'letter-spacing-check': 3, 'line-break': 3,
'cjk-mix-check': 3,
+47
View File
@@ -389,6 +389,53 @@
const edge = { plan: { elements: [{ type: 'icon', iconId: 'x', x: 585, y: 300, w: 30, h: 30 }] } };
return { generated: this.run({ plan }).pass !== undefined, edge: this.run(edge).risky.length };
}
},
{
id: 'avatar-safe-zone',
name: '头像安全区',
category: 'layout',
emoji: '⭕',
scene: '头像导出前的圆/方裁切安全检查(微信/QQ/抖音等平台多为圆形裁切)',
summary: '圆形裁切时主体直径占画布 62%-78% 最稳(平台会裁掉四角),方形 70%-88%;主体中心偏移不得超过留白的一半,否则裁切后偏边。',
params: [
{ name: 'crop', type: 'string', required: false, desc: "裁切形状:'circle' 圆形(默认)/ 'square' 方形" },
{ name: 'subjectRatio', type: 'number', required: false, desc: '主体直径占画布比例(默认 0.7)' },
{ name: 'size', type: 'number', required: false, desc: '画布边长 px(默认 300)' },
{ name: 'offset', type: 'object', required: false, desc: '主体中心相对画布中心偏移 {x,y}(px)' }
],
source: '自研(平台头像裁切规范:圆形内切 + 留白安全域)',
workspaces: ['avatar'],
run: function (args) {
const crop = (args.crop === 'square') ? 'square' : 'circle';
const ratio = Number(args.subjectRatio) || 0.7;
const size = Number(args.size) || 300;
const off = args.offset || { x: 0, y: 0 };
const dx = Number(off.x) || 0;
const dy = Number(off.y) || 0;
const range = crop === 'circle' ? [0.62, 0.78] : [0.7, 0.88];
const pad = size * (1 - ratio) / 2;
const tips = [];
if (ratio > range[1]) tips.push('主体占比 ' + Math.round(ratio * 100) + '% 偏大(建议 ≤' + Math.round(range[1] * 100) + '%),' + (crop === 'circle' ? '圆形裁切会切到主体边缘' : '导出后显拥挤'));
if (ratio < range[0]) tips.push('主体占比 ' + Math.round(ratio * 100) + '% 偏小(建议 ≥' + Math.round(range[0] * 100) + '%),头像缩小后辨识度不足');
const maxOff = pad * 0.5;
if (Math.abs(dx) > maxOff || Math.abs(dy) > maxOff) {
tips.push('主体中心偏移 (x' + Math.round(dx) + ', y' + Math.round(dy) + ') 超过安全留白的一半(±' + Math.round(maxOff) + 'px),裁切后偏边');
}
if (crop === 'circle' && ratio > 0.78) tips.push('圆形裁切的安全直径约为画布的 100%,但视觉留白建议保留 12% 以上');
return {
pass: tips.length === 0,
crop, subjectRatio: ratio, size, offset: { x: dx, y: dy }, safeRange: range, padding: Math.round(pad),
verdict: tips.length ? tips.join(';') : crop === 'circle' ? '主体在圆形裁切安全区内,四角留白充足' : '主体比例与居中位置符合方形头像规范',
suggest: tips.length ? '建议把主体缩放到画布 ' + Math.round((range[0] + range[1]) / 2 * 100) + '% 并居中' : '无需调整'
};
},
test: function () {
const good = this.run({ crop: 'circle', subjectRatio: 0.7, size: 300, offset: { x: 0, y: 0 } });
const big = this.run({ crop: 'circle', subjectRatio: 0.95, size: 300 });
const off = this.run({ crop: 'square', subjectRatio: 0.75, size: 300, offset: { x: 60, y: 0 } });
return { good: good.pass, bigFails: big.pass === false, offsetFails: off.pass === false };
}
}
]);
})();
+240 -1
View File
@@ -1,5 +1,5 @@
/**
* 画个标 · 表情技能(12 个:motion 11 / emotion 1)
* 画个标 · 表情技能(20 个:motion 13 / emotion 7)
* 全部为纯函数:run(args) 返回 {ok/tip/...},test() 可自跑。
* 用于表情生成后的评审/优化建议(动态节奏/物理/循环/体积/平台/情绪)。
* 来源标注「自研」或公开设计原则。
@@ -264,5 +264,244 @@ HGB_StickerSkills.register([
return { ok: smooth || eased, tip: (smooth ? '正弦驱动,平滑自然' : eased ? '含减速/压缩段,物理自然' : '线性驱动,建议叠加缓动曲线') + '(' + t + ')' };
},
test() { return this.run({ type: 'bounce' }); }
},
/* ---------- 第二批 motion(动效质量深化,2026-11-08) ---------- */
{
id: 'motion-loop-seam', name: '循环接缝', category: 'motion', emoji: '🔁',
scene: '检查循环类动画(漂浮/呼吸/脉冲/旋转)首尾帧是否闭合,避免导出 GIF 时出现跳帧',
summary: '周期动画必须满足 f(0) ≈ f(1):正弦驱动天然闭合;含位移累加或线性旋转的动画需确认整周期回到原点。',
params: { type: '动画类型 id', cycles: '整周期内的往返次数(默认 1)', amplitude: '强度倍率' },
source: '自研(循环动画连续性)',
run(args) {
const t = args.type || 'float';
const cycles = Number(args.cycles) || 1;
const amp = Number(args.amplitude) || 1;
const periodic = ['float', 'breath', 'pulse', 'heartbeat', 'wiggle', 'bounce', 'hopspin'];
const smoothLoop = ['float', 'breath', 'pulse', 'heartbeat'];
const spinning = ['spin', 'twirl'];
const continuous = spinning.includes(t);
const closed = periodic.includes(t) || continuous;
const intCycles = Math.abs(cycles - Math.round(cycles)) < 1e-6;
const ok = closed && intCycles;
const tips = [];
if (!closed) tips.push('该动画不保证首尾闭合,建议改用正弦驱动或补首尾过渡帧');
if (!intCycles) tips.push('往返次数需为整数(当前 ' + cycles + '),否则末帧与首帧错位');
if (smoothLoop.includes(t) && amp > 1.4) tips.push('幅度过大时接缝更明显,建议 amplitude ≤ 1.4');
return {
ok, type: t, cycles, amplitude: amp,
tip: tips.length ? tips.join(';') : '首尾帧闭合,循环无跳帧(' + t + ' × ' + cycles + ' 周期)'
};
},
test() {
return { ok: this.run({ type: 'float', cycles: 2, amplitude: 1 }).ok, bad: this.run({ type: 'float', cycles: 1.5 }).ok };
}
},
{
id: 'motion-multi-element', name: '多元素错峰', category: 'motion', emoji: '🎚',
scene: '表情由主图 + 装饰(星星/汗滴/符号)组成时,检查各元素是否错峰,避免整组同相抖动',
summary: 'N 个元素应按周期均匀分配相位延迟(delay = period / N),主图领先、装饰跟随 0.1-0.25 个周期。',
params: { elements: '元素数量', duration: '周期秒(默认 1.2)', leadRatio: '主图领先比例(默认 0.08)' },
source: '自研(分层动画错峰)',
run(args) {
const n = Math.max(1, Number(args.elements) || 3);
const d = Number(args.duration) || 1.2;
const lead = Number(args.leadRatio) || 0.08;
const step = n > 1 ? (0.85 - lead) / (n - 1) : 0;
const delays = [];
for (let i = 0; i < n; i++) delays.push(Math.round((-lead - step * i) * d * 1000) / 1000);
const samePhase = n > 1 && step * d < 0.02;
const maxDelay = Math.abs(delays[delays.length - 1] || 0);
const ok = !samePhase && maxDelay < d;
return {
ok, count: n, period: d, delays,
tip: ok
? n + ' 个元素按 ' + (step * d).toFixed(2) + 's 间隔错峰,最长延迟 ' + maxDelay.toFixed(2) + 's 在周期内'
: '元素同相或延迟超出周期,建议减小元素数或缩短延迟步长'
};
},
test() {
return { ok: this.run({ elements: 3, duration: 1.2 }).ok, single: this.run({ elements: 1 }).ok };
}
},
/* ---------- emotion 情绪传达(第二批,2026-11-08) ---------- */
{
id: 'emotion-intensity', name: '情绪强度匹配', category: 'emotion', emoji: '🌡',
scene: '评估动画幅度/节奏是否与情绪强度一致(微笑用轻浮动,狂喜才用夸张弹跳)',
summary: '强度 1-5 与动效幅度映射:1-2 用呼吸/淡入,3 用脉冲/浮动,4-5 才用弹跳/心跳/抖动。',
params: { intensity: '情绪强度 1-5(默认 3)', amplitude: '动效幅度倍率(默认 1)', type: '动画类型 id' },
source: '自研(情绪-动效映射)',
run(args) {
const intensity = Math.min(5, Math.max(1, Number(args.intensity) || 3));
const amp = Number(args.amplitude) || 1;
const t = args.type || 'pulse';
const strong = ['bounce', 'heartbeat', 'shake', 'hopspin', 'spin'];
const gentle = ['breath', 'fade', 'float', 'pulse', 'twirl', 'wiggle'];
const isStrong = strong.includes(t);
const expectedStrong = intensity >= 4;
const match = isStrong === expectedStrong;
const ampOk = intensity >= 4 ? amp >= 0.9 : amp <= 1.2;
const tips = [];
if (!match) tips.push(expectedStrong ? '强度 ' + intensity + ' 建议用更有力的动效(弹跳/心跳/抖动)' : '强度 ' + intensity + ' 用强动效会显得夸张,建议改呼吸/浮动/脉冲');
if (!ampOk) tips.push(intensity >= 4 ? '幅度偏小(' + amp + '),可提到 1.0+' : '幅度偏大(' + amp + '),建议 ≤ 1.2');
return {
ok: match && ampOk, intensity, amplitude: amp, type: t,
suggestTypes: expectedStrong ? strong : gentle,
tip: tips.length ? tips.join(';') : '情绪强度与动效力度匹配(强度 ' + intensity + ' × ' + t + ')'
};
},
test() {
return { ok: this.run({ intensity: 5, amplitude: 1.1, type: 'bounce' }).ok, gentle: this.run({ intensity: 1, amplitude: 0.8, type: 'breath' }).ok };
}
},
{
id: 'emotion-context', name: '场景克制度', category: 'emotion', emoji: '🏷',
scene: '同一情绪在不同使用场景(聊天/弹幕/工作群/亲密关系)需要不同表达强度',
summary: '工作场景避免强烈负向与夸张动效;弹幕需高辨识度短动效;亲密场景可夸张;聊天居中即可。',
params: { scene: '场景(chat/bullet/work/intimate,默认 chat)', emotion: '情绪 id(如 joy/anger/sad/wow/love)', amplitude: '动效幅度(默认 1)' },
source: '自研(场景化表情规范)',
run(args) {
const scene = args.scene || 'chat';
const emotion = args.emotion || 'joy';
const amp = Number(args.amplitude) || 1;
const cap = { chat: 1.3, bullet: 1.4, work: 0.9, intimate: 1.6 }[scene];
const negative = ['anger', 'sad', 'disgust', 'cry'].includes(emotion);
const strongNegInWork = scene === 'work' && negative && amp > 0.8;
const bulletSlow = scene === 'bullet' && amp < 0.9;
const ok = amp <= (cap || 1.3) && !strongNegInWork && !bulletSlow;
const tips = [];
if (amp > (cap || 1.3)) tips.push(scene + ' 场景建议幅度 ≤ ' + cap);
if (strongNegInWork) tips.push('工作场景的负向情绪建议收敛到 0.8 以下或改用中性表达');
if (bulletSlow) tips.push('弹幕场景需要更强视觉冲击,幅度建议 ≥ 0.9');
return {
ok, scene, emotion, amplitude: amp, cap: cap || 1.3,
tip: tips.length ? tips.join(';') : scene + ' 场景下 ' + emotion + ' 的表达强度合适'
};
},
test() {
return { ok: this.run({ scene: 'chat', emotion: 'joy', amplitude: 1.1 }).ok, work: this.run({ scene: 'work', emotion: 'anger', amplitude: 0.6 }).ok };
}
},
{
id: 'emotion-coverage', name: '情绪覆盖度', category: 'emotion', emoji: '🎭',
scene: '检查一套表情包的情绪分布是否失衡(全是开心 / 缺中性 / 负向过多)',
summary: '健康的一组表情建议:正向 50%-70%、中性 15%-30%、负向 10%-25%,且必含至少 1 个中性锚点。',
params: { emotions: '情绪 id 数组或 {joy:4, neutral:1} 计数对象' },
source: '自研(表情包情绪配比)',
run(args) {
const src = args.emotions;
const counts = {};
if (Array.isArray(src)) for (const e of src) counts[e] = (counts[e] || 0) + 1;
else if (src && typeof src === 'object') Object.assign(counts, src);
const total = Object.values(counts).reduce((a, b) => a + b, 0);
if (!total) return { ok: false, tip: '请提供至少一个情绪(数组或计数对象)' };
const group = e => ['joy', 'love', 'wow', 'excited', 'happy', 'laugh'].includes(e) ? 'pos'
: ['neutral', 'calm', 'think', 'hmm'].includes(e) ? 'neu' : 'neg';
let pos = 0, neu = 0, neg = 0;
for (const [e, n] of Object.entries(counts)) {
const g = group(e);
if (g === 'pos') pos += n; else if (g === 'neu') neu += n; else neg += n;
}
const r = { pos: pos / total, neu: neu / total, neg: neg / total };
const tips = [];
if (r.neu < 0.15) tips.push('缺中性锚点(当前 ' + Math.round(r.neu * 100) + '%),建议补 15%-30%');
if (r.pos > 0.8) tips.push('正向占比过高(' + Math.round(r.pos * 100) + '%),情绪层次单一');
if (r.neg > 0.3) tips.push('负向占比过高(' + Math.round(r.neg * 100) + '%),正式场景易误用');
return {
ok: tips.length === 0, total,
ratio: { pos: Math.round(r.pos * 100), neu: Math.round(r.neu * 100), neg: Math.round(r.neg * 100) },
tip: tips.length ? tips.join(';') : '情绪分布均衡(正 ' + Math.round(r.pos * 100) + '% / 中 ' + Math.round(r.neu * 100) + '% / 负 ' + Math.round(r.neg * 100) + '%)'
};
},
test() {
return { balanced: this.run({ emotions: { joy: 6, neutral: 2, sad: 2 } }).ok, unbalanced: this.run({ emotions: { joy: 9, wow: 1 } }).ok };
}
},
{
id: 'emotion-clarity', name: '情绪可读性', category: 'emotion', emoji: '👁',
scene: '小尺寸(48-96px)下表情是否一眼可辨,装饰过多会削弱情绪识别',
summary: '主体占画面 ≥ 60%、装饰元素 ≤ 2 个、避免细碎线条;小尺寸优先强化眼神与嘴形这类情绪特征。',
params: { size: '展示尺寸 px(默认 64)', subjectRatio: '主体占比 0-1(默认 0.7)', decorations: '装饰元素数(默认 1)', fineLines: '细碎线条数(默认 0)' },
source: '自研(小尺寸可读性)',
run(args) {
const size = Number(args.size) || 64;
const ratio = Number(args.subjectRatio) || 0.7;
const deco = Number(args.decorations) || 0;
const fine = Number(args.fineLines) || 0;
const small = size <= 96;
const tips = [];
if (ratio < 0.6) tips.push('主体占比 ' + Math.round(ratio * 100) + '% 偏小,建议 ≥60%');
if (deco > 2) tips.push('装饰 ' + deco + ' 个过多,小尺寸建议 ≤2');
if (small && fine > 0) tips.push('小尺寸下 ' + fine + ' 条细碎线条会糊,建议简化');
return {
ok: tips.length === 0, size, subjectRatio: ratio, decorations: deco,
tip: tips.length ? tips.join(';') : size + 'px 下主体清晰、装饰克制,情绪一眼可辨'
};
},
test() {
return { ok: this.run({ size: 64, subjectRatio: 0.72, decorations: 1 }).ok, noisy: this.run({ size: 64, subjectRatio: 0.5, decorations: 3 }).ok };
}
},
{
id: 'emotion-brand-fit', name: '角色调性一致性', category: 'emotion', emoji: '🧭',
scene: '角色/IP/品牌有固定调性时,检查表情情绪是否越界(严谨品牌不适合夸张搞怪)',
summary: '调性决定可用情绪集:friendly 全开、calm 去狂喜狂怒、sharp 弱化软萌、formal 仅中性+轻正向。',
params: { tone: '调性(friendly/calm/sharp/formal,默认 friendly)', emotion: '情绪 id', amplitude: '动效幅度(默认 1)' },
source: '自研(品牌调性-情绪白名单)',
run(args) {
const tone = args.tone || 'friendly';
const emotion = args.emotion || 'joy';
const amp = Number(args.amplitude) || 1;
const allow = {
friendly: ['joy', 'love', 'wow', 'sad', 'anger', 'neutral', 'laugh', 'think'],
calm: ['joy', 'neutral', 'think', 'calm', 'sad'],
sharp: ['anger', 'wow', 'joy', 'neutral', 'think'],
formal: ['neutral', 'joy', 'think']
}[tone] || ['joy', 'neutral'];
const inSet = allow.includes(emotion);
const ampCap = { friendly: 1.6, calm: 0.9, sharp: 1.3, formal: 0.7 }[tone] || 1.2;
const ampOk = amp <= ampCap;
const tips = [];
if (!inSet) tips.push(tone + ' 调性不建议使用 ' + emotion + ',可用:' + allow.join('/'));
if (!ampOk) tips.push(tone + ' 调性幅度建议 ≤ ' + ampCap + '(当前 ' + amp + ')');
return {
ok: inSet && ampOk, tone, emotion, amplitude: amp, allowed: allow,
tip: tips.length ? tips.join(';') : emotion + ' 符合 ' + tone + ' 调性,幅度 ' + amp + ' 在安全区'
};
},
test() {
return { ok: this.run({ tone: 'calm', emotion: 'joy', amplitude: 0.8 }).ok, bad: this.run({ tone: 'formal', emotion: 'anger', amplitude: 1.2 }).ok };
}
},
{
id: 'emotion-transition', name: '情绪跳变', category: 'emotion', emoji: '↔️',
scene: '一组表情按顺序播放或成套使用时,相邻情绪强度落差过大会显得突兀',
summary: '相邻情绪强度差建议 ≤2;强负向与强正向之间应有中性过渡项。',
params: { sequence: '情绪 id 数组(按使用顺序)' },
source: '自研(情绪序列过渡)',
run(args) {
const seq = Array.isArray(args.sequence) ? args.sequence : [];
if (seq.length < 2) return { ok: true, tip: '少于 2 个情绪,无需检查过渡' };
const level = { neutral: 1, calm: 1, think: 2, hmm: 2, joy: 3, love: 4, laugh: 4, wow: 4, sad: 3, cry: 4, anger: 5, excited: 5 };
const jump = [];
for (let i = 1; i < seq.length; i++) {
const a = level[seq[i - 1]] || 3, b = level[seq[i]] || 3;
if (Math.abs(a - b) >= 3) jump.push(seq[i - 1] + '→' + seq[i] + '(差' + Math.abs(a - b) + ')');
}
return {
ok: jump.length === 0, length: seq.length, jumps: jump,
tip: jump.length ? '情绪跳变过大:' + jump.join('、') + ',建议中间插入中性/轻度情绪过渡' : '情绪过渡平滑(' + seq.length + ' 个)'
};
},
test() {
return { smooth: this.run({ sequence: ['joy', 'wow', 'neutral'] }).ok, jump: this.run({ sequence: ['anger', 'calm', 'joy'] }).ok };
}
}
]);