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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 | 53x 53x 2650x 2650x 2650x 2650x 2650x 2650x 901x 1007x 742x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 2650x 53x 53x 53x 53x 53x 53x 53x 371x 371x 371x 371x 371x 371x 371x 371x 53x 53x 53x 53x 53x 53x 53x 53x 53x 371x 371x 371x 371x 371x 371x 371x 371x 53x 53x 53x 53x 53x 53x 53x 53x 53x 265x 265x 265x 265x 265x 265x 265x 265x 53x 53x 53x 53x 53x 53x 53x 53x 53x 318x 318x 318x 318x 318x 318x 318x 318x 53x 53x 53x 53x 53x 53x 53x 53x 53x 371x 371x 371x 371x 371x 371x 371x 371x 53x 53x 53x 53x 53x 53x 53x 53x 53x 371x 371x 371x 371x 371x 371x 371x 371x 53x 53x 53x 53x 53x 53x 53x 53x 53x 265x 265x 265x 265x 265x 265x 265x 265x 53x 53x 53x 53x 53x 53x 53x 53x 53x 318x 318x 318x 318x 318x 318x 318x 318x 53x 53x 53x 53x 8x 13x 13x 55x 11x 2x 53x 53x | /**
* Trigram Stance Idle Animations - Enhanced Breathing & Weight Shift System
*
* Defines complete idle animations for all 8 trigram stances (팔괘) with:
* - Multi-keyframe breathing cycles (4-6 frames per stance)
* - Subtle weight shifts for natural movement
* - Stance-specific rhythms reflecting martial philosophy
* - Proper guard positions from StanceGuardPoses
*
* Each trigram idle is the starting point for all techniques in that stance.
* The breathing and weight shifts reflect the elemental nature:
* - ☰ 건 (Heaven): Powerful, expansive chest breathing
* - ☱ 태 (Lake): Fluid, rippling breath flow
* - ☲ 리 (Fire): Sharp, controlled precision breathing
* - ☳ 진 (Thunder): Deep coiled power breathing
* - ☴ 손 (Wind): Rhythmic continuous flow
* - ☵ 감 (Water): Deep flowing diaphragm breathing
* - ☶ 간 (Mountain): Minimal steady breathing
* - ☷ 곤 (Earth): Deep grounded diaphragm breathing
*
* @module systems/animation/catalogs/StanceIdleAnimations
* @category Animation System
* @korean 팔괘자세대기애니메이션
*/
import { TrigramStance } from "@/types/common";
import type { SkeletalAnimation, StanceGuardPose } from "@/types/skeletal";
import { BoneName } from "@/types/skeletal";
import type { KeyframeConfig } from "../builders/KeyframeConfig";
import { MartialArtsAnimationBuilder } from "../builders/MartialArtsAnimationBuilder";
import {
GAM_WATER_GUARD_POSE,
GAN_MOUNTAIN_GUARD_POSE,
GEON_HIGH_GUARD_POSE,
GON_EARTH_GUARD_POSE,
JIN_THUNDER_GUARD_POSE,
LI_FIRE_GUARD_POSE,
SON_WIND_GUARD_POSE,
STANCE_GUARD_CONFIGS,
TAE_FLUID_GUARD_POSE,
} from "./StanceGuardPoses";
// ═══════════════════════════════════════════════════════════════════════════
// ANIMATION TIMING CONSTANTS (애니메이션 타이밍 상수)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Breathing cycle durations per stance (in seconds)
* Each stance has characteristic breathing rhythm
*
* @korean 호흡주기지속시간
*/
const BREATHING_DURATIONS = {
GEON: 2.4, // Powerful slow breathing
TAE: 2.8, // Fluid flowing breath
LI: 1.8, // Sharp controlled breathing
JIN: 2.2, // Explosive ready breath
SON: 2.0, // Rhythmic continuous flow
GAM: 3.0, // Deep flowing breath
GAN: 2.6, // Steady controlled breath
GON: 2.6, // Grounded diaphragm breath
} as const;
/**
* Weight shift amplitudes per stance (percentage of base)
* Reflects stability vs. mobility of each stance
*
* @korean 체중이동진폭
*/
const WEIGHT_SHIFT_AMPLITUDES = {
GEON: 0.015, // Subtle shift - mobile stance
TAE: 0.02, // Fluid flowing shifts
LI: 0.008, // Minimal - precision stance
JIN: 0.025, // Larger - coiled spring
SON: 0.018, // Rhythmic lateral shifts
GAM: 0.022, // Flowing adaptation
GAN: 0.005, // Minimal - mountain solid
GON: 0.012, // Grounded subtle shifts
} as const;
// ═══════════════════════════════════════════════════════════════════════════
// BREATHING ANIMATION HELPERS (호흡 애니메이션 헬퍼)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Calculates breathing scale at a given phase
*
* @param phase - Breathing phase (0-1, where 0.5 is peak inhale)
* @param min - Minimum scale (exhale)
* @param max - Maximum scale (inhale peak)
* @returns Scale factor for chest/torso
*/
function calculateBreathingScale(
phase: number,
min: number,
max: number
): number {
// Use sine wave for natural breathing rhythm
// Phase 0.5 = peak inhale, 0 and 1 = exhale
const breathPhase = Math.sin(phase * Math.PI * 2);
const amplitude = (max - min) / 2;
const center = (max + min) / 2;
return center + breathPhase * amplitude;
}
/**
* Calculates torso expansion for breathing effect
*
* @param breathingScale - Current breathing scale (0.96-1.04)
* @returns Torso rotation adjustment for breathing
*/
function calculateTorsoBreathingOffset(breathingScale: number): number {
// Chest expands forward slightly on inhale
return (breathingScale - 1) * 0.3;
}
/**
* Calculates weight shift offset at a given phase
*
* @param phase - Weight shift phase (0-1)
* @param amplitude - Maximum shift distance
* @param direction - Primary shift direction ('lateral' | 'forward')
* @returns Position offset for pelvis/hips
*/
function calculateWeightShift(
phase: number,
amplitude: number,
direction: "lateral" | "forward" | "circular"
): { x: number; z: number } {
switch (direction) {
case "lateral":
// Side-to-side weight shift
return {
x: Math.sin(phase * Math.PI * 2) * amplitude,
z: 0,
};
case "forward":
// Front-to-back weight shift
return {
x: 0,
z: Math.sin(phase * Math.PI * 2) * amplitude,
};
case "circular":
// Circular weight shift (water/wind stances)
return {
x: Math.sin(phase * Math.PI * 2) * amplitude * 0.5,
z: Math.cos(phase * Math.PI * 2) * amplitude * 0.5,
};
}
}
// ═══════════════════════════════════════════════════════════════════════════
// GUARD POSE APPLICATION HELPERS (방어자세적용헬퍼)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Applies a complete guard pose to a KeyframeConfig with breathing adjustment
*
* @param kf - KeyframeConfig to apply pose to
* @param pose - Guard pose to apply
* @param breathingOffset - Torso breathing offset
* @param weightOffset - Weight shift offset
*/
function applyGuardPoseToKeyframe(
kf: KeyframeConfig,
pose: StanceGuardPose,
breathingOffset: number,
weightOffset: { x: number; z: number }
): void {
// === ARM POSITIONS (팔 위치) ===
// IMPORTANT: Use SHOULDER_L/R, ELBOW_L/R, WRIST_L/R bone names
// NOT UPPER_ARM, FOREARM, HAND - those are different bones in the hierarchy!
// Left arm - shoulder controls arm lift/rotation
kf.rotate(
BoneName.SHOULDER_L,
pose.leftArm.shoulder.x,
pose.leftArm.shoulder.y,
pose.leftArm.shoulder.z
);
// Elbow controls forearm bend
kf.rotate(
BoneName.ELBOW_L,
pose.leftArm.elbow.x,
pose.leftArm.elbow.y,
pose.leftArm.elbow.z
);
// Wrist controls hand rotation
kf.rotate(
BoneName.WRIST_L,
pose.leftArm.wrist.x,
pose.leftArm.wrist.y,
pose.leftArm.wrist.z
);
// Right arm - mirror bone hierarchy
kf.rotate(
BoneName.SHOULDER_R,
pose.rightArm.shoulder.x,
pose.rightArm.shoulder.y,
pose.rightArm.shoulder.z
);
kf.rotate(
BoneName.ELBOW_R,
pose.rightArm.elbow.x,
pose.rightArm.elbow.y,
pose.rightArm.elbow.z
);
kf.rotate(
BoneName.WRIST_R,
pose.rightArm.wrist.x,
pose.rightArm.wrist.y,
pose.rightArm.wrist.z
);
// === TORSO (몸통) - Full spine chain for proper rotation ===
// SPINE_LOWER: Base torso twist (inherits from pelvis)
kf.rotate(
BoneName.SPINE_LOWER,
pose.torso.x * 0.3,
pose.torso.y * 0.4,
pose.torso.z * 0.3
);
// SPINE_MIDDLE: Mid-torso twist
kf.rotate(
BoneName.SPINE_MIDDLE,
pose.torso.x * 0.3,
pose.torso.y * 0.3,
pose.torso.z * 0.3
);
// SPINE_UPPER: Upper chest with breathing - gets most of the rotation
kf.rotate(
BoneName.SPINE_UPPER,
pose.torso.x * 0.4 + breathingOffset,
pose.torso.y * 0.3,
pose.torso.z * 0.4
);
// === LEG POSITIONS (다리 위치) ===
// IMPORTANT: Use HIP_L/R for hip rotation, not THIGH!
// HIP bone controls the leg's root rotation
// Left leg - HIP controls leg lift/rotation at socket
kf.rotate(
BoneName.HIP_L,
pose.leftLeg.hip.x,
pose.leftLeg.hip.y,
pose.leftLeg.hip.z
);
// KNEE controls lower leg bend (primarily X axis flex)
kf.rotate(
BoneName.KNEE_L,
pose.leftLeg.knee.x,
pose.leftLeg.knee.y,
pose.leftLeg.knee.z
);
// FOOT controls ankle rotation
kf.rotate(
BoneName.FOOT_L,
pose.leftLeg.ankle.x,
pose.leftLeg.ankle.y,
pose.leftLeg.ankle.z
);
// Right leg - mirror bone hierarchy
kf.rotate(
BoneName.HIP_R,
pose.rightLeg.hip.x,
pose.rightLeg.hip.y,
pose.rightLeg.hip.z
);
kf.rotate(
BoneName.KNEE_R,
pose.rightLeg.knee.x,
pose.rightLeg.knee.y,
pose.rightLeg.knee.z
);
kf.rotate(
BoneName.FOOT_R,
pose.rightLeg.ankle.x,
pose.rightLeg.ankle.y,
pose.rightLeg.ankle.z
);
// === PELVIS (골반) - Root of entire body ===
// Controls overall body rotation and position
kf.rotate(BoneName.PELVIS, pose.pelvis.x, pose.pelvis.y, pose.pelvis.z);
// Pelvis position: weight offset (X,Z) + stance height drop (Y)
const pelvisHeight = pose.pelvisHeight ?? 0;
kf.position(BoneName.PELVIS, weightOffset.x, pelvisHeight, weightOffset.z);
// === FOOT POSITIONING (발 위치) ===
// Position feet for stance width and depth
const stanceDepth = pose.stanceDepth ?? 0;
// Left foot: negative X (left side), negative Z (front for forward stances)
kf.position(BoneName.FOOT_L, -pose.stanceWidth / 2, 0, -stanceDepth / 2);
// Right foot: positive X (right side), positive Z (back for forward stances)
kf.position(BoneName.FOOT_R, pose.stanceWidth / 2, 0, stanceDepth / 2);
}
// ═══════════════════════════════════════════════════════════════════════════
// ☰ GEON HEAVEN IDLE (건 하늘 대기)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Creates Geon idle animation with breathing and weight shifts
*/
function createGeonIdleAnimation(): SkeletalAnimation {
const pose = GEON_HIGH_GUARD_POSE;
const { min, max } = pose.breathingRange;
const duration = BREATHING_DURATIONS.GEON;
const amplitude = WEIGHT_SHIFT_AMPLITUDES.GEON;
const frames = STANCE_GUARD_CONFIGS.geon.breathingFrames;
const builder = MartialArtsAnimationBuilder.create(
"stance_geon",
"건 대기"
).asIdle(duration, true);
// Generate keyframes with breathing and weight shift
for (let i = 0; i <= frames; i++) {
const phase = i / frames;
const frameTime = phase * duration;
const breathingScale = calculateBreathingScale(phase, min, max);
const breathingOffset = calculateTorsoBreathingOffset(breathingScale);
const weightOffset = calculateWeightShift(phase, amplitude, "forward");
const kf = builder.at(frameTime);
applyGuardPoseToKeyframe(kf, pose, breathingOffset, weightOffset);
kf.done<MartialArtsAnimationBuilder>();
}
return builder.build();
}
/**
* ☰ 건 (Geon) Heaven Idle Animation
*
* Powerful high guard stance with expansive chest breathing.
* Boxing-style guard protecting chin and temples.
*
* **Breathing**: Slow powerful expansion (2.4s cycle)
* **Weight**: Subtle forward shift for aggression
* **Philosophy**: Heaven's creative force, direct power
*
* @korean 건하늘대기애니메이션
*/
export const GEON_IDLE_ANIMATION: SkeletalAnimation = createGeonIdleAnimation();
// ═══════════════════════════════════════════════════════════════════════════
// ☱ TAE LAKE IDLE (태 연못 대기)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Creates Tae idle animation with breathing and weight shifts
*/
function createTaeIdleAnimation(): SkeletalAnimation {
const pose = TAE_FLUID_GUARD_POSE;
const { min, max } = pose.breathingRange;
const duration = BREATHING_DURATIONS.TAE;
const amplitude = WEIGHT_SHIFT_AMPLITUDES.TAE;
const frames = STANCE_GUARD_CONFIGS.tae.breathingFrames;
const builder = MartialArtsAnimationBuilder.create(
"stance_tae",
"태 대기"
).asIdle(duration, true);
for (let i = 0; i <= frames; i++) {
const phase = i / frames;
const frameTime = phase * duration;
const breathingScale = calculateBreathingScale(phase, min, max);
const breathingOffset = calculateTorsoBreathingOffset(breathingScale);
const weightOffset = calculateWeightShift(phase, amplitude, "circular");
const kf = builder.at(frameTime);
applyGuardPoseToKeyframe(kf, pose, breathingOffset, weightOffset);
kf.done<MartialArtsAnimationBuilder>();
}
return builder.build();
}
/**
* ☱ 태 (Tae) Lake Idle Animation
*
* Fluid mid-guard stance with flowing breath rhythm.
* Lead hand ready for parrying, rear protects chin.
*
* **Breathing**: Flowing waves (2.8s cycle)
* **Weight**: Circular flowing shifts
* **Philosophy**: Lake's adaptability, fluid technique
*
* @korean 태연못대기애니메이션
*/
export const TAE_IDLE_ANIMATION: SkeletalAnimation = createTaeIdleAnimation();
// ═══════════════════════════════════════════════════════════════════════════
// ☲ LI FIRE IDLE (리 불 대기)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Creates Li idle animation with breathing and weight shifts
*/
function createLiIdleAnimation(): SkeletalAnimation {
const pose = LI_FIRE_GUARD_POSE;
const { min, max } = pose.breathingRange;
const duration = BREATHING_DURATIONS.LI;
const amplitude = WEIGHT_SHIFT_AMPLITUDES.LI;
const frames = STANCE_GUARD_CONFIGS.li.breathingFrames;
const builder = MartialArtsAnimationBuilder.create(
"stance_li",
"리 대기"
).asIdle(duration, true);
for (let i = 0; i <= frames; i++) {
const phase = i / frames;
const frameTime = phase * duration;
const breathingScale = calculateBreathingScale(phase, min, max);
const breathingOffset = calculateTorsoBreathingOffset(breathingScale);
const weightOffset = calculateWeightShift(phase, amplitude, "lateral");
const kf = builder.at(frameTime);
applyGuardPoseToKeyframe(kf, pose, breathingOffset, weightOffset);
kf.done<MartialArtsAnimationBuilder>();
}
return builder.build();
}
/**
* ☲ 리 (Li) Fire Idle Animation
*
* Aggressive peekaboo guard with sharp controlled breathing.
* Both hands high protecting face for precision striking.
*
* **Breathing**: Sharp controlled (1.8s cycle)
* **Weight**: Minimal movement for precision
* **Philosophy**: Fire's precision, vital point targeting
*
* @korean 리불대기애니메이션
*/
export const LI_IDLE_ANIMATION: SkeletalAnimation = createLiIdleAnimation();
// ═══════════════════════════════════════════════════════════════════════════
// ☳ JIN THUNDER IDLE (진 천둥 대기)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Creates Jin idle animation with breathing and weight shifts
*/
function createJinIdleAnimation(): SkeletalAnimation {
const pose = JIN_THUNDER_GUARD_POSE;
const { min, max } = pose.breathingRange;
const duration = BREATHING_DURATIONS.JIN;
const amplitude = WEIGHT_SHIFT_AMPLITUDES.JIN;
const frames = STANCE_GUARD_CONFIGS.jin.breathingFrames;
const builder = MartialArtsAnimationBuilder.create(
"stance_jin",
"진 대기"
).asIdle(duration, true);
for (let i = 0; i <= frames; i++) {
const phase = i / frames;
const frameTime = phase * duration;
const breathingScale = calculateBreathingScale(phase, min, max);
const breathingOffset = calculateTorsoBreathingOffset(breathingScale);
// Jin uses forward weight shift (coiled spring releasing)
const weightOffset = calculateWeightShift(phase, amplitude, "forward");
const kf = builder.at(frameTime);
applyGuardPoseToKeyframe(kf, pose, breathingOffset, weightOffset);
kf.done<MartialArtsAnimationBuilder>();
}
return builder.build();
}
/**
* ☳ 진 (Jin) Thunder Idle Animation
*
* Chambered explosive stance with deep power breathing.
* Fists at ribs, coiled spring ready for explosive release.
*
* **Breathing**: Deep coiled power (2.2s cycle)
* **Weight**: Back-loaded with subtle forward pulse
* **Philosophy**: Thunder's explosive force, shocking power
*
* @korean 진천둥대기애니메이션
*/
export const JIN_IDLE_ANIMATION: SkeletalAnimation = createJinIdleAnimation();
// ═══════════════════════════════════════════════════════════════════════════
// ☴ SON WIND IDLE (손 바람 대기)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Creates Son idle animation with breathing and weight shifts
*/
function createSonIdleAnimation(): SkeletalAnimation {
const pose = SON_WIND_GUARD_POSE;
const { min, max } = pose.breathingRange;
const duration = BREATHING_DURATIONS.SON;
const amplitude = WEIGHT_SHIFT_AMPLITUDES.SON;
const frames = STANCE_GUARD_CONFIGS.son.breathingFrames;
const builder = MartialArtsAnimationBuilder.create(
"stance_son",
"손 대기"
).asIdle(duration, true);
for (let i = 0; i <= frames; i++) {
const phase = i / frames;
const frameTime = phase * duration;
const breathingScale = calculateBreathingScale(phase, min, max);
const breathingOffset = calculateTorsoBreathingOffset(breathingScale);
const weightOffset = calculateWeightShift(phase, amplitude, "lateral");
const kf = builder.at(frameTime);
applyGuardPoseToKeyframe(kf, pose, breathingOffset, weightOffset);
kf.done<MartialArtsAnimationBuilder>();
}
return builder.build();
}
/**
* ☴ 손 (Son) Wind Idle Animation
*
* Staggered flowing guard with rhythmic continuous breathing.
* Lead hand extended, rear at chin for combo readiness.
*
* **Breathing**: Rhythmic flowing (2.0s cycle)
* **Weight**: Lateral rhythmic shifts for mobility
* **Philosophy**: Wind's continuous pressure, flowing attack
*
* @korean 손바람대기애니메이션
*/
export const SON_IDLE_ANIMATION: SkeletalAnimation = createSonIdleAnimation();
// ═══════════════════════════════════════════════════════════════════════════
// ☵ GAM WATER IDLE (감 물 대기)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Creates Gam idle animation with breathing and weight shifts
*/
function createGamIdleAnimation(): SkeletalAnimation {
const pose = GAM_WATER_GUARD_POSE;
const { min, max } = pose.breathingRange;
const duration = BREATHING_DURATIONS.GAM;
const amplitude = WEIGHT_SHIFT_AMPLITUDES.GAM;
const frames = STANCE_GUARD_CONFIGS.gam.breathingFrames;
const builder = MartialArtsAnimationBuilder.create(
"stance_gam",
"감 대기"
).asIdle(duration, true);
for (let i = 0; i <= frames; i++) {
const phase = i / frames;
const frameTime = phase * duration;
const breathingScale = calculateBreathingScale(phase, min, max);
const breathingOffset = calculateTorsoBreathingOffset(breathingScale);
const weightOffset = calculateWeightShift(phase, amplitude, "circular");
const kf = builder.at(frameTime);
applyGuardPoseToKeyframe(kf, pose, breathingOffset, weightOffset);
kf.done<MartialArtsAnimationBuilder>();
}
return builder.build();
}
/**
* ☵ 감 (Gam) Water Idle Animation
*
* Mid-level parrying guard with deep flowing breathing.
* Hands ready at solar plexus for redirecting and countering.
*
* **Breathing**: Deep flowing diaphragm (3.0s cycle)
* **Weight**: Circular flowing adaptation
* **Philosophy**: Water's adaptation, flow-into-counter
*
* @korean 감물대기애니메이션
*/
export const GAM_IDLE_ANIMATION: SkeletalAnimation = createGamIdleAnimation();
// ═══════════════════════════════════════════════════════════════════════════
// ☶ GAN MOUNTAIN IDLE (간 산 대기)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Creates Gan idle animation with breathing and weight shifts
*/
function createGanIdleAnimation(): SkeletalAnimation {
const pose = GAN_MOUNTAIN_GUARD_POSE;
const { min, max } = pose.breathingRange;
const duration = BREATHING_DURATIONS.GAN;
const amplitude = WEIGHT_SHIFT_AMPLITUDES.GAN;
const frames = STANCE_GUARD_CONFIGS.gan.breathingFrames;
const builder = MartialArtsAnimationBuilder.create(
"stance_gan",
"간 대기"
).asIdle(duration, true);
for (let i = 0; i <= frames; i++) {
const phase = i / frames;
const frameTime = phase * duration;
const breathingScale = calculateBreathingScale(phase, min, max);
const breathingOffset = calculateTorsoBreathingOffset(breathingScale);
// Gan uses minimal lateral shift (mountain stability)
const weightOffset = calculateWeightShift(phase, amplitude, "lateral");
const kf = builder.at(frameTime);
applyGuardPoseToKeyframe(kf, pose, breathingOffset, weightOffset);
kf.done<MartialArtsAnimationBuilder>();
}
return builder.build();
}
/**
* ☶ 간 (Gan) Mountain Idle Animation
*
* High cover defensive guard with steady controlled breathing.
* Forearms crossed protecting face, immovable stance.
*
* **Breathing**: Steady minimal (2.6s cycle)
* **Weight**: Minimal - mountain solid
* **Philosophy**: Mountain's immovability, defensive mastery
*
* @korean 간산대기애니메이션
*/
export const GAN_IDLE_ANIMATION: SkeletalAnimation = createGanIdleAnimation();
// ═══════════════════════════════════════════════════════════════════════════
// ☷ GON EARTH IDLE (곤 땅 대기)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Creates Gon idle animation with breathing and weight shifts
*/
function createGonIdleAnimation(): SkeletalAnimation {
const pose = GON_EARTH_GUARD_POSE;
const { min, max } = pose.breathingRange;
const duration = BREATHING_DURATIONS.GON;
const amplitude = WEIGHT_SHIFT_AMPLITUDES.GON;
const frames = STANCE_GUARD_CONFIGS.gon.breathingFrames;
const builder = MartialArtsAnimationBuilder.create(
"stance_gon",
"곤 대기"
).asIdle(duration, true);
for (let i = 0; i <= frames; i++) {
const phase = i / frames;
const frameTime = phase * duration;
const breathingScale = calculateBreathingScale(phase, min, max);
const breathingOffset = calculateTorsoBreathingOffset(breathingScale);
// Gon uses forward weight shift (wrestling ready)
const weightOffset = calculateWeightShift(phase, amplitude, "forward");
const kf = builder.at(frameTime);
applyGuardPoseToKeyframe(kf, pose, breathingOffset, weightOffset);
kf.done<MartialArtsAnimationBuilder>();
}
return builder.build();
}
/**
* ☷ 곤 (Gon) Earth Idle Animation
*
* Low underhook wrestling guard with grounded breathing.
* Hands at hip level, elbows protecting ribs for ground control.
*
* **Breathing**: Deep diaphragm (2.6s cycle)
* **Weight**: Grounded subtle shifts
* **Philosophy**: Earth's stability, grounding and takedowns
*
* @korean 곤땅대기애니메이션
*/
export const GON_IDLE_ANIMATION: SkeletalAnimation = createGonIdleAnimation();
// ═══════════════════════════════════════════════════════════════════════════
// TRIGRAM IDLE ANIMATION MAP (팔괘대기애니메이션맵)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Map of all 8 trigram stance idle animations
*
* Use this map for efficient lookup of stance-specific idle animations.
* Each animation includes proper guard position, breathing, and weight shifts.
*
* @korean 팔괘대기애니메이션맵
*/
export const TRIGRAM_IDLE_ANIMATIONS: ReadonlyMap<
TrigramStance,
SkeletalAnimation
> = new Map([
[TrigramStance.GEON, GEON_IDLE_ANIMATION],
[TrigramStance.TAE, TAE_IDLE_ANIMATION],
[TrigramStance.LI, LI_IDLE_ANIMATION],
[TrigramStance.JIN, JIN_IDLE_ANIMATION],
[TrigramStance.SON, SON_IDLE_ANIMATION],
[TrigramStance.GAM, GAM_IDLE_ANIMATION],
[TrigramStance.GAN, GAN_IDLE_ANIMATION],
[TrigramStance.GON, GON_IDLE_ANIMATION],
]);
/**
* Map of all 8 trigram stance idle animations by string name
*
* This map provides string-keyed access to idle animations for registry integration.
* Animation names match the pattern "stance_X" used in useSkeletalAnimation.
*
* @korean 팔괘대기애니메이션문자열맵
*/
export const TRIGRAM_IDLE_ANIMATIONS_BY_NAME: ReadonlyMap<
string,
SkeletalAnimation
> = new Map([
["stance_geon", GEON_IDLE_ANIMATION],
["stance_tae", TAE_IDLE_ANIMATION],
["stance_li", LI_IDLE_ANIMATION],
["stance_jin", JIN_IDLE_ANIMATION],
["stance_son", SON_IDLE_ANIMATION],
["stance_gam", GAM_IDLE_ANIMATION],
["stance_gan", GAN_IDLE_ANIMATION],
["stance_gon", GON_IDLE_ANIMATION],
]);
/**
* Get idle animation for a specific trigram stance
*
* @param stance - Trigram stance identifier
* @returns Stance-specific idle animation with breathing and weight shifts
*
* @example
* ```typescript
* const geonIdle = getTrigramIdleAnimation(TrigramStance.GEON);
* // Returns GEON_IDLE_ANIMATION with high guard, forward breathing
*
* const gamIdle = getTrigramIdleAnimation(TrigramStance.GAM);
* // Returns GAM_IDLE_ANIMATION with flowing parry guard
* ```
*
* @korean 팔괘대기애니메이션가져오기
*/
export function getTrigramIdleAnimation(
stance: TrigramStance
): SkeletalAnimation | undefined {
return TRIGRAM_IDLE_ANIMATIONS.get(stance);
}
/**
* Get idle animation by stance name string
*
* Convenient accessor for string-based stance lookups.
*
* @param stanceName - Stance name (e.g., "geon", "tae", "li")
* @returns Stance-specific idle animation or undefined
*
* @korean 문자열로대기애니메이션가져오기
*/
export function getTrigramIdleByName(
stanceName: string
): SkeletalAnimation | undefined {
const normalizedName = stanceName.toLowerCase();
for (const [stance, animation] of TRIGRAM_IDLE_ANIMATIONS) {
if (stance === normalizedName) {
return animation;
}
}
return undefined;
}
// ═══════════════════════════════════════════════════════════════════════════
// ANIMATION COLLECTION (애니메이션모음)
// ═══════════════════════════════════════════════════════════════════════════
/**
* Array of all trigram idle animations for iteration
*
* @korean 모든팔괘대기애니메이션
*/
export const ALL_TRIGRAM_IDLE_ANIMATIONS: readonly SkeletalAnimation[] = [
GEON_IDLE_ANIMATION,
TAE_IDLE_ANIMATION,
LI_IDLE_ANIMATION,
JIN_IDLE_ANIMATION,
SON_IDLE_ANIMATION,
GAM_IDLE_ANIMATION,
GAN_IDLE_ANIMATION,
GON_IDLE_ANIMATION,
];
/**
* Idle animation metadata for debugging and introspection
*
* @korean 대기애니메이션메타데이터
*/
export const TRIGRAM_IDLE_METADATA = {
GEON: {
name: "stance_geon",
korean: "건 대기",
english: "Heaven Idle",
breathingDuration: BREATHING_DURATIONS.GEON,
weightShiftType: "forward" as const,
philosophy: "Creative force, direct power",
},
TAE: {
name: "stance_tae",
korean: "태 대기",
english: "Lake Idle",
breathingDuration: BREATHING_DURATIONS.TAE,
weightShiftType: "circular" as const,
philosophy: "Adaptability, fluid technique",
},
LI: {
name: "stance_li",
korean: "리 대기",
english: "Fire Idle",
breathingDuration: BREATHING_DURATIONS.LI,
weightShiftType: "lateral" as const,
philosophy: "Precision, vital point targeting",
},
JIN: {
name: "stance_jin",
korean: "진 대기",
english: "Thunder Idle",
breathingDuration: BREATHING_DURATIONS.JIN,
weightShiftType: "forward" as const,
philosophy: "Explosive force, shocking power",
},
SON: {
name: "stance_son",
korean: "손 대기",
english: "Wind Idle",
breathingDuration: BREATHING_DURATIONS.SON,
weightShiftType: "lateral" as const,
philosophy: "Continuous pressure, flowing attack",
},
GAM: {
name: "stance_gam",
korean: "감 대기",
english: "Water Idle",
breathingDuration: BREATHING_DURATIONS.GAM,
weightShiftType: "circular" as const,
philosophy: "Adaptation, flow-into-counter",
},
GAN: {
name: "stance_gan",
korean: "간 대기",
english: "Mountain Idle",
breathingDuration: BREATHING_DURATIONS.GAN,
weightShiftType: "lateral" as const,
philosophy: "Immovability, defensive mastery",
},
GON: {
name: "stance_gon",
korean: "곤 대기",
english: "Earth Idle",
breathingDuration: BREATHING_DURATIONS.GON,
weightShiftType: "forward" as const,
philosophy: "Stability, grounding and takedowns",
},
} as const;
|