import type {MotionPreset, Point} from '../types'; /** * 모션 프리셋을 벡터로 변환 * @param preset 모션 프리셋 * @param strength 모션 강도 (기본값: 0.1) * @returns 계산된 벡터 (vectorA) */ export function presetToVector(preset: MotionPreset, strength: number = 0.1): Point { switch (preset) { case 'none': // 애니메이션 없음 return {x: 0, y: 0}; case 'horizontal': // 좌우 왕복 return {x: strength, y: 0}; case 'vertical': // 상하 왕복 return {x: 0, y: strength}; case 'rotate-cw': // 시계방향 회전 (원운동의 시작점) return {x: strength, y: 0}; case 'rotate-ccw': // 반시계방향 회전 (원운동의 시작점) return {x: -strength, y: 0}; case 'pulse': // 펄스 (중심에서 바깥으로) return {x: strength, y: strength}; case 'diagonal-1': // 대각선 (좌상→우하) return {x: strength * 0.707, y: strength * 0.707}; // √2/2 ≈ 0.707 case 'diagonal-2': // 대각선 (우상→좌하) return {x: strength * 0.707, y: -strength * 0.707}; default: return {x: 0, y: 0}; } } /** * 프리셋이 회전 타입인지 확인 */ export function isRotationPreset(preset?: MotionPreset): boolean { return preset === 'rotate-cw' || preset === 'rotate-ccw'; }