Files
cmr-mini/miniprogram/game/presentation/trackStyleConfig.ts

93 lines
2.0 KiB
TypeScript

export type TrackDisplayMode = 'none' | 'full' | 'tail'
export type TrackStyleProfile = 'classic' | 'neon'
export type TrackTailLengthPreset = 'short' | 'medium' | 'long'
export type TrackColorPreset =
| 'mint'
| 'cyan'
| 'sky'
| 'blue'
| 'violet'
| 'pink'
| 'orange'
| 'yellow'
export interface TrackColorPresetEntry {
colorHex: string
headColorHex: string
}
export const TRACK_TAIL_LENGTH_METERS: Record<TrackTailLengthPreset, number> = {
short: 32,
medium: 52,
long: 78,
}
export const TRACK_COLOR_PRESET_MAP: Record<TrackColorPreset, TrackColorPresetEntry> = {
mint: {
colorHex: '#15a38d',
headColorHex: '#63fff0',
},
cyan: {
colorHex: '#18b8c9',
headColorHex: '#7cf4ff',
},
sky: {
colorHex: '#4a9cff',
headColorHex: '#c9eeff',
},
blue: {
colorHex: '#3a63ff',
headColorHex: '#9fb4ff',
},
violet: {
colorHex: '#7c4dff',
headColorHex: '#d0b8ff',
},
pink: {
colorHex: '#ff4fb3',
headColorHex: '#ffc0ec',
},
orange: {
colorHex: '#ff8a2b',
headColorHex: '#ffd0a3',
},
yellow: {
colorHex: '#f0c419',
headColorHex: '#fff0a8',
},
}
export interface TrackVisualizationConfig {
mode: TrackDisplayMode
style: TrackStyleProfile
tailLength: TrackTailLengthPreset
colorPreset: TrackColorPreset
tailMeters: number
tailMaxSeconds: number
fadeOutWhenStill: boolean
stillSpeedKmh: number
fadeOutDurationMs: number
colorHex: string
headColorHex: string
widthPx: number
headWidthPx: number
glowStrength: number
}
export const DEFAULT_TRACK_VISUALIZATION_CONFIG: TrackVisualizationConfig = {
mode: 'full',
style: 'neon',
tailLength: 'medium',
colorPreset: 'mint',
tailMeters: TRACK_TAIL_LENGTH_METERS.medium,
tailMaxSeconds: 30,
fadeOutWhenStill: true,
stillSpeedKmh: 0.6,
fadeOutDurationMs: 3000,
colorHex: TRACK_COLOR_PRESET_MAP.mint.colorHex,
headColorHex: TRACK_COLOR_PRESET_MAP.mint.headColorHex,
widthPx: 4.2,
headWidthPx: 6.8,
glowStrength: 0.2,
}