- 节拍器 hook (useMetronome):setInterval + 漂移自校正,60-200 BPM 误差 <30ms - 训练状态机 hook (useTrainingSession):组数/次数/休息阶段编排 - 语音引导 hook (useVoiceCoach):队列播放,关联节拍回调报数 - BGM hook (useTrainingBgm):训练/休息双音轨手写淡入淡出 - 5 个动作预设:哑铃弯举/推举/侧平举、握力环、健身环卷腹 - CSS 动画组件 exercise-anim:动画时长由 BPM 通过 CSS 变量驱动 - TTS 生成脚本 generate-voice.mjs:调小米 MiMo TTS 自动出 39 段语音 - 静态资源目录占位与素材准备说明 Co-authored-by: Cursor <cursoragent@cursor.com>
117 lines
3.2 KiB
TypeScript
117 lines
3.2 KiB
TypeScript
export type AnimationType =
|
|
| 'curl'
|
|
| 'press'
|
|
| 'sidefly'
|
|
| 'grip'
|
|
| 'crunch'
|
|
|
|
export interface ExercisePreset {
|
|
id: string
|
|
name: string
|
|
equipment: '哑铃' | '握力环' | '健身环' | '徒手'
|
|
icon: string
|
|
animationType: AnimationType
|
|
description: string
|
|
tips: string[]
|
|
contraindication?: string
|
|
|
|
defaultBpm: number
|
|
bpmMin: number
|
|
bpmMax: number
|
|
defaultSets: number
|
|
defaultReps: number
|
|
defaultRestSec: number
|
|
|
|
beatsPerRep: number
|
|
}
|
|
|
|
export const EXERCISE_PRESETS: ExercisePreset[] = [
|
|
{
|
|
id: 'dumbbell-curl',
|
|
name: '哑铃弯举',
|
|
equipment: '哑铃',
|
|
icon: '🏋',
|
|
animationType: 'curl',
|
|
description: '锻炼肱二头肌,注意肘部固定不动',
|
|
tips: ['肘部贴紧身体', '上举吸气,下落呼气', '动作放慢,控制重量'],
|
|
contraindication: '肘关节炎症急性期不宜',
|
|
defaultBpm: 60,
|
|
bpmMin: 40,
|
|
bpmMax: 100,
|
|
defaultSets: 3,
|
|
defaultReps: 12,
|
|
defaultRestSec: 60,
|
|
beatsPerRep: 2,
|
|
},
|
|
{
|
|
id: 'dumbbell-press',
|
|
name: '哑铃推举',
|
|
equipment: '哑铃',
|
|
icon: '🏋',
|
|
animationType: 'press',
|
|
description: '锻炼肩部三角肌,核心保持收紧',
|
|
tips: ['不要含胸驼背', '推举时呼气', '不要锁死肘关节'],
|
|
contraindication: '肩袖损伤者请咨询医生',
|
|
defaultBpm: 60,
|
|
bpmMin: 40,
|
|
bpmMax: 90,
|
|
defaultSets: 3,
|
|
defaultReps: 10,
|
|
defaultRestSec: 90,
|
|
beatsPerRep: 2,
|
|
},
|
|
{
|
|
id: 'dumbbell-sidefly',
|
|
name: '哑铃侧平举',
|
|
equipment: '哑铃',
|
|
icon: '🏋',
|
|
animationType: 'sidefly',
|
|
description: '锻炼三角肌中束,重量宜轻不宜重',
|
|
tips: ['手肘微屈', '抬至与肩平齐即可', '想象用肩膀发力,不是手臂'],
|
|
defaultBpm: 60,
|
|
bpmMin: 40,
|
|
bpmMax: 80,
|
|
defaultSets: 3,
|
|
defaultReps: 12,
|
|
defaultRestSec: 60,
|
|
beatsPerRep: 2,
|
|
},
|
|
{
|
|
id: 'grip-ring',
|
|
name: '握力环训练',
|
|
equipment: '握力环',
|
|
icon: '🟢',
|
|
animationType: 'grip',
|
|
description: '锻炼前臂屈肌群,改善握力',
|
|
tips: ['完全握紧停顿 1 秒', '完全张开放松', '左右手交替'],
|
|
defaultBpm: 80,
|
|
bpmMin: 60,
|
|
bpmMax: 120,
|
|
defaultSets: 4,
|
|
defaultReps: 20,
|
|
defaultRestSec: 45,
|
|
beatsPerRep: 2,
|
|
},
|
|
{
|
|
id: 'crunch',
|
|
name: '集中机(仰卧卷腹)',
|
|
equipment: '健身环',
|
|
icon: '💪',
|
|
animationType: 'crunch',
|
|
description: '锻炼腹直肌,借助健身环增加阻力',
|
|
tips: ['下背贴地', '用腹部发力,不是脖子', '上抬呼气,下落吸气'],
|
|
contraindication: '腰椎间盘突出急性期不宜',
|
|
defaultBpm: 50,
|
|
bpmMin: 40,
|
|
bpmMax: 80,
|
|
defaultSets: 3,
|
|
defaultReps: 15,
|
|
defaultRestSec: 60,
|
|
beatsPerRep: 2,
|
|
},
|
|
]
|
|
|
|
export function getPresetById(id: string): ExercisePreset | undefined {
|
|
return EXERCISE_PRESETS.find((e) => e.id === id)
|
|
}
|