All files / systems/animation/catalogs StepSkeletalAnimations.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145                                                                    76x                                                   76x                                                   76x                                         76x                             76x                                       9x    
/**
 * Korean martial arts step movement animations with skeletal keyframes
 *
 * Defines realistic tactical step animation sequences for precise footwork
 * with 30cm distance, 300ms duration, and guard maintenance.
 *
 * All step animations are implemented using the MartialArtsAnimationBuilder pattern.
 *
 * @module systems/animation/StepSkeletalAnimations
 * @category Animation System
 * @korean 발걸음애니메이션
 */
 
import type { SkeletalAnimation } from "@/types/skeletal";
import { MartialArtsAnimationBuilder } from "../builders/MartialArtsAnimationBuilder";
 
/**
 * FORWARD STEP Animation (전진보법)
 *
 * Tactical forward step with weight transfer and guard maintenance.
 *
 * Animation phases:
 * 1. Preparation (0-0.1s): Weight shifts to back foot, crouch slightly
 * 2. Movement (0.1-0.2s): Front foot lifts and extends forward
 * 3. Landing (0.2-0.25s): Front foot plants, weight transfers forward
 * 4. Stabilization (0.25-0.3s): Back foot follows, body straightens
 *
 * Distance: 30cm forward
 * Duration: 300ms
 * Guard: Maintained throughout
 *
 * @korean 전진보법애니메이션
 */
export const STEP_FORWARD_ANIMATION: SkeletalAnimation =
  MartialArtsAnimationBuilder.create("step_forward", "전진보법")
    .asMovement(0.3, false)
    .stance()
    .forwardStep(0.12, "ease-out")
    .forwardStep(0.1, "linear")
    .recover(0.08, "ease-in")
    .build();
 
/**
 * BACKWARD STEP Animation (후진보법)
 *
 * Tactical backward step for defensive retreat while maintaining guard.
 *
 * Animation phases:
 * 1. Preparation (0-0.1s): Weight shifts to front foot
 * 2. Movement (0.1-0.2s): Back foot lifts and extends backward
 * 3. Landing (0.2-0.25s): Back foot plants, weight transfers
 * 4. Stabilization (0.25-0.3s): Front foot follows, guard maintained
 *
 * Distance: 30cm backward
 * Duration: 300ms
 * Guard: Maintained throughout
 *
 * @korean 후진보법애니메이션
 */
export const STEP_BACK_ANIMATION: SkeletalAnimation =
  MartialArtsAnimationBuilder.create("step_back", "후진보법")
    .asMovement(0.3, false)
    .stance()
    .backwardStep(0.12, "ease-out")
    .backwardStep(0.1, "linear")
    .recover(0.08, "ease-in")
    .build();
 
/**
 * STEP LEFT Animation (좌측보법)
 *
 * Lateral step to the left while maintaining forward-facing guard.
 *
 * Animation phases:
 * 1. Preparation (0-0.1s): Weight shifts to right foot
 * 2. Movement (0.1-0.2s): Left foot lifts and extends laterally
 * 3. Landing (0.2-0.25s): Left foot plants, weight transfers
 * 4. Stabilization (0.25-0.3s): Right foot follows, stance width maintained
 *
 * Distance: 30cm lateral (left)
 * Duration: 300ms
 * Guard: Maintained forward-facing
 *
 * @korean 좌측보법애니메이션
 */
export const STEP_LEFT_ANIMATION: SkeletalAnimation =
  MartialArtsAnimationBuilder.create("step_left", "좌측보법")
    .asMovement(0.3, false)
    .stance()
    .sideStepLeft(0.12, "ease-out")
    .sideStepLeft(0.1, "linear")
    .recover(0.08, "ease-in")
    .build();
 
/**
 * STEP RIGHT Animation (우측보법)
 *
 * Lateral step to the right while maintaining forward-facing guard.
 * Mirror of step left.
 *
 * Distance: 30cm lateral (right)
 * Duration: 300ms
 * Guard: Maintained forward-facing
 *
 * @korean 우측보법애니메이션
 */
export const STEP_RIGHT_ANIMATION: SkeletalAnimation =
  MartialArtsAnimationBuilder.create("step_right", "우측보법")
    .asMovement(0.3, false)
    .stance()
    .sideStepRight(0.12, "ease-out")
    .sideStepRight(0.1, "linear")
    .recover(0.08, "ease-in")
    .build();
 
/**
 * Map of all step animations by name
 *
 * Provides quick lookup for step movement animations.
 *
 * @korean 발걸음애니메이션맵
 */
export const STEP_ANIMATIONS = new Map<string, SkeletalAnimation>([
  ["step_forward", STEP_FORWARD_ANIMATION],
  ["step_back", STEP_BACK_ANIMATION],
  ["step_left", STEP_LEFT_ANIMATION],
  ["step_right", STEP_RIGHT_ANIMATION],
]);
 
/**
 * Get step animation by name
 *
 * Returns the skeletal animation for the specified step direction.
 * Returns undefined if animation not found.
 *
 * @param animationName - Animation state name (e.g., "step_forward")
 * @returns Skeletal animation or undefined
 * @korean 발걸음애니메이션가져오기
 */
export function getStepAnimation(
  animationName: string
): SkeletalAnimation | undefined {
  return STEP_ANIMATIONS.get(animationName);
}