feat(时间轴): 动作片段支持拖拽调整起止时间

This commit is contained in:
tongtong committed 2026-09-18 10:55:48 +08:00
1 parent efe44a35a6
commit 9d3a5b9bea
14 files changed
+366 -18

No files matched your search

@@ -31,6 +31,21 @@ describe("computeMotionOverrides", () => {
).toEqual({});
});
it("only drives the character inside the [startTime, endTime] segment", () => {
const segment = { motion: WALK, time: 1, characterId: "x", startTime: 0.5, endTime: 2.5 };
// 区间内:正常驱动
expect(computeMotionOverrides(segment)).not.toEqual({});
// 区间起点之前:保持静止
expect(
computeMotionOverrides({ motion: WALK, time: 0.1, characterId: "x", startTime: 0.5, endTime: 2.5 })
).toEqual({});
// 区间终点之后:保持静止
expect(
computeMotionOverrides({ motion: WALK, time: 3, characterId: "x", startTime: 0.5, endTime: 2.5 })
).toEqual({});
});
/** 求使左肢相位 θL = target 的 time(speed=1,走路频率)。 */
function timeForLeftPhase(target: number, characterId: string): number {
const phase = hashIdToPhase(characterId);