- 删除从未显示的 idle 手势帧(小程序包内 png 和视频用高清帧),训练分包减少 17KB - 删除骨架连线 BONES、镜像函数 mirrorPose(骨架已去掉)和未使用的 Bgm 类型 - 只给单测用的 sampleMotion 移到测试目录 - 删除训练菜单里未使用的 .menu-icon-text 样式 - 补全 history 单测数据缺少的 adviceKind 字段(严格类型检查报错)
16 lines
652 B
TypeScript
16 lines
652 B
TypeScript
/** 单测辅助:把示范动作按时间采样成 Pose 序列(文件名不带 .test,不会被当成用例执行) */
|
|
import type { Pose } from '../keypoints.ts'
|
|
import { MOTIONS, type MoveId } from '../motions.ts'
|
|
|
|
export function sampleMotion(id: MoveId, seconds: number, fps = 12, startMs = 0): Pose[] {
|
|
const spec = MOTIONS[id]
|
|
const frames: Pose[] = []
|
|
const n = Math.round(seconds * fps)
|
|
for (let i = 0; i < n; i++) {
|
|
const tSec = i / fps
|
|
const points = spec.poseAt(tSec / spec.cycleSeconds)
|
|
frames.push({ points, scores: points.map(() => 0.9), t: startMs + tSec * 1000 })
|
|
}
|
|
return frames
|
|
}
|