head.js
1.43 KB
// head.js — head 轨道动作(颈/头)。
/** @type {Record<string, import('../types.js').AnimationClip>} */
export const HEAD_CLIPS = {
'head.idle': {
id: 'head.idle', track: 'head', kind: 'pose', duration: 0,
bones: { head: [{ t: 0 }], neck: [{ t: 0 }] },
},
'head.talk_shake': {
id: 'head.talk_shake', track: 'head', kind: 'loop', duration: 320,
bones: {
head: [{ t: 0, drot: -2.5, dy: 0 }, { t: 0.5, drot: 2.5, dy: -1.5 }, { t: 1, drot: -2.5, dy: 0 }],
},
},
// 点头:向前下俯一下再回正(以竖直位移为主,俯仰方向随 facing)。
'head.nod': {
id: 'head.nod', track: 'head', kind: 'oneshot', duration: 620,
bones: {
head: [{ t: 0, drot: 0, dy: 0 }, { t: 0.32, drot: -10, dy: 10 }, { t: 0.62, drot: 4, dy: -2 }, { t: 1, drot: 0, dy: 0 }],
},
},
// 抬头 / 低头:以竖直位移(dy)为主表达上下,叠加小幅俯仰(drot)。
// 符号约定(facing=right 基准):低头=向前下俯(drot 负, dy 正),抬头=向后上仰(drot 正, dy 负)。
// 身体整体随 facing 做水平镜像,因此 facing=left 时这两个方向会自动翻转,与朝向保持一致。
'head.lookup': {
id: 'head.lookup', track: 'head', kind: 'pose', duration: 0,
bones: { head: [{ t: 0, drot: 9, dy: -10 }] },
},
'head.lookdown': {
id: 'head.lookdown', track: 'head', kind: 'pose', duration: 0,
bones: { head: [{ t: 0, drot: -10, dy: 11 }] },
},
}