Files
zyt/TUICallKit-Vue3/training/pose/__tests__/sampleMotion.ts
T
long 4932ed7651 refactor: 移除 AI 跟练中没有作用的代码
- 删除从未显示的 idle 手势帧(小程序包内 png 和视频用高清帧),训练分包减少 17KB
- 删除骨架连线 BONES、镜像函数 mirrorPose(骨架已去掉)和未使用的 Bgm 类型
- 只给单测用的 sampleMotion 移到测试目录
- 删除训练菜单里未使用的 .menu-icon-text 样式
- 补全 history 单测数据缺少的 adviceKind 字段(严格类型检查报错)
2026-10-31 10:33:25 +08:00

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
}