|
| 1 | +// @ai-context |
| 2 | +// Chronos 六态形态定义与视觉参数:类型、展示元数据、Canvas 演示渲染参数。 |
| 3 | +// Chronos six-state definitions and visual params for the web demo. |
| 4 | +// Why: 状态机与展示数据集中定义,ChronosDemo 组件与 dive 内容配置共享同一来源,避免漂移。 |
| 5 | + |
| 6 | +export type ChronosState = |
| 7 | + | "asleep" |
| 8 | + | "breathing" |
| 9 | + | "focus" |
| 10 | + | "short_break" |
| 11 | + | "long_break" |
| 12 | + | "milestone"; |
| 13 | + |
| 14 | +export interface ChronosStateMeta { |
| 15 | + key: ChronosState; |
| 16 | + name: string; |
| 17 | + icon: string; |
| 18 | + desc: string; |
| 19 | +} |
| 20 | + |
| 21 | +export const CHRONOS_STATES: ChronosStateMeta[] = [ |
| 22 | + { key: "asleep", name: "沉睡", icon: "🌑", desc: "暗红余烬脉动,等待被唤醒。" }, |
| 23 | + { key: "breathing", name: "呼吸", icon: "🌕", desc: "60bpm 心跳红光,准备好开始。" }, |
| 24 | + { key: "focus", name: "专注", icon: "🔥", desc: "白炽星体,粒子随倒计时消散。" }, |
| 25 | + { key: "short_break", name: "短休", icon: "🌱", desc: "嫩绿种子自旋,萌芽新生。" }, |
| 26 | + { key: "long_break", name: "长休", icon: "🌳", desc: "种子破土,长成参天大树。" }, |
| 27 | + { key: "milestone", name: "划时代点", icon: "💡", desc: "把时间抽象,变成有生命的伙伴。" }, |
| 28 | +]; |
| 29 | + |
| 30 | +/** 六态渲染参数:RGB 主色 / 心跳强度(0-1) / 粒子规模 / 漂移速度 / 光晕强度 / 是否粒子消散 */ |
| 31 | +export interface ChronosStateStyle { |
| 32 | + color: [number, number, number]; |
| 33 | + pulse: number; |
| 34 | + scale: number; |
| 35 | + drift: number; |
| 36 | + glow: number; |
| 37 | + dissipate: boolean; |
| 38 | +} |
| 39 | + |
| 40 | +export const STATE_STYLE: Record<ChronosState, ChronosStateStyle> = { |
| 41 | + asleep: { color: [156, 59, 59], pulse: 0.35, scale: 0.55, drift: 0.25, glow: 0.22, dissipate: false }, |
| 42 | + breathing: { color: [239, 68, 68], pulse: 1.0, scale: 1.0, drift: 0.4, glow: 0.4, dissipate: false }, |
| 43 | + focus: { color: [249, 115, 22], pulse: 0.2, scale: 1.2, drift: 0.7, glow: 0.55, dissipate: true }, |
| 44 | + short_break: { color: [74, 222, 128], pulse: 0.55, scale: 0.9, drift: 0.55, glow: 0.45, dissipate: false }, |
| 45 | + long_break: { color: [34, 197, 94], pulse: 0.3, scale: 1.1, drift: 0.35, glow: 0.5, dissipate: false }, |
| 46 | + milestone: { color: [251, 191, 36], pulse: 0.9, scale: 1.15, drift: 0.6, glow: 0.6, dissipate: false }, |
| 47 | +}; |
0 commit comments