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 | 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x | /**
* Facial animation types for realistic combat emotion and damage
*
* Defines facial expression system with damage tracking, eye tracking,
* and smooth expression transitions for authentic human-like combat feedback.
*
* @module types/facial
* @category Type Definitions
* @korean 얼굴애니메이션타입
*/
import * as THREE from "three";
/**
* Facial expression states for combat
*
* Represents emotional and physical states visible on fighter's face.
* Each expression corresponds to specific combat situations.
*
* @public
* @category Facial Animation
* @korean 얼굴표정
*/
export enum FacialExpression {
/** Calm, ready state */
NEUTRAL = "neutral",
/** Concentrated, ready to attack */
FOCUSED = "focused",
/** Pain response after hit */
PAINED = "pained",
/** Low stamina, heavy breathing */
EXHAUSTED = "exhausted",
/** Brief satisfaction after successful strike */
VICTORIOUS = "victorious",
/** Knocked out, unconscious */
DEFEATED = "defeated",
}
/**
* Bilingual names for facial expressions
*
* @public
* @category Facial Animation
* @korean 표정이름
*/
export const FACIAL_EXPRESSION_NAMES: Record<
FacialExpression,
{ korean: string; english: string; romanized: string }
> = {
[FacialExpression.NEUTRAL]: {
korean: "평온",
english: "Neutral",
romanized: "pyeong-on",
},
[FacialExpression.FOCUSED]: {
korean: "집중",
english: "Focused",
romanized: "jipjung",
},
[FacialExpression.PAINED]: {
korean: "고통",
english: "Pained",
romanized: "gotong",
},
[FacialExpression.EXHAUSTED]: {
korean: "지침",
english: "Exhausted",
romanized: "jichim",
},
[FacialExpression.VICTORIOUS]: {
korean: "승리",
english: "Victorious",
romanized: "seungri",
},
[FacialExpression.DEFEATED]: {
korean: "패배",
english: "Defeated",
romanized: "paebae",
},
};
/**
* Facial damage state tracking
*
* Tracks accumulated damage to face for visual feedback.
* Includes bruising, swelling, and bleeding effects.
*
* @public
* @category Facial Animation
* @korean 얼굴손상상태
*/
export interface FacialDamageState {
/** Left eye swelling (0-1, 0=none, 1=fully swollen) */
readonly leftEyeSwelling: number;
/** Right eye swelling (0-1, 0=none, 1=fully swollen) */
readonly rightEyeSwelling: number;
/** Mouth/lip bleeding intensity (0-1) */
readonly mouthBleeding: number;
/** Nose bleeding intensity (0-1) */
readonly noseBleeding: number;
/** Bruise intensity on left cheek (0-1) */
readonly leftCheekBruise: number;
/** Bruise intensity on right cheek (0-1) */
readonly rightCheekBruise: number;
/** Forehead bruise/cut intensity (0-1) */
readonly foreheadBruise: number;
/** Jaw bruise intensity (0-1) */
readonly jawBruise: number;
/** Total facial damage accumulation (0-100) */
readonly totalFacialDamage: number;
}
/**
* Expression state with transition timing
*
* Manages current expression and smooth transition to next expression.
*
* @public
* @category Facial Animation
* @korean 표정상태
*/
export interface ExpressionState {
/** Current facial expression */
readonly expression: FacialExpression;
/** Expression intensity (0-1, affects degree of expression) */
readonly intensity: number;
/** Time to transition to new expression (seconds) */
readonly transitionTime: number;
/** Previous expression (for blending) */
readonly previousExpression?: FacialExpression;
/** Transition progress (0-1, 0=start, 1=complete) */
readonly transitionProgress?: number;
}
/**
* Eye openness values for expressions
*
* @public
* @category Facial Animation
* @korean 눈개방도
*/
export const EYE_OPENNESS: Record<FacialExpression, number> = {
[FacialExpression.NEUTRAL]: 1.0, // Fully open
[FacialExpression.FOCUSED]: 0.7, // Narrowed
[FacialExpression.PAINED]: 0.3, // Squinted
[FacialExpression.EXHAUSTED]: 0.5, // Half-closed
[FacialExpression.VICTORIOUS]: 0.9, // Nearly fully open
[FacialExpression.DEFEATED]: 0.0, // Closed
};
/**
* Mouth openness values for expressions
*
* @public
* @category Facial Animation
* @korean 입개방도
*/
export const MOUTH_OPENNESS: Record<FacialExpression, number> = {
[FacialExpression.NEUTRAL]: 0.0, // Closed
[FacialExpression.FOCUSED]: 0.0, // Closed, determined
[FacialExpression.PAINED]: 0.8, // Open, yelling
[FacialExpression.EXHAUSTED]: 0.4, // Panting
[FacialExpression.VICTORIOUS]: 0.2, // Slight smile
[FacialExpression.DEFEATED]: 0.1, // Slack
};
/**
* Head movement animation type
*
* Defines types of head movements for combat reactions.
*
* @public
* @category Facial Animation
* @korean 머리움직임타입
*/
export enum HeadMovementType {
/** Head snaps back when hit */
RECOIL = "recoil",
/** Slight nod forward during attack */
NOD = "nod",
/** Head tilts to avoid strike */
TILT = "tilt",
/** Head turns to track opponent */
TURN = "turn",
/** Head shakes when stunned */
SHAKE = "shake",
/** Head drops when defeated */
DROP = "drop",
}
/**
* Head movement animation keyframes
*
* Sequence of Euler rotations for head movement animations.
*
* @public
* @category Facial Animation
* @korean 머리움직임키프레임
*/
export interface HeadMovementKeyframes {
/** Movement type identifier */
readonly type: HeadMovementType;
/** Sequence of rotation keyframes */
readonly rotations: readonly THREE.Euler[];
/** Duration of each keyframe in seconds */
readonly frameDuration: number;
/** Total animation duration in seconds */
readonly totalDuration: number;
/** Whether animation loops */
readonly loop: boolean;
}
/**
* Eye tracking state
*
* Manages eye direction and pupil position for opponent tracking.
*
* @public
* @category Facial Animation
* @korean 눈추적상태
*/
export interface EyeTrackingState {
/** Target position to look at (opponent position) */
readonly targetPosition: THREE.Vector3;
/** Current look direction (normalized) */
readonly lookDirection: THREE.Vector3;
/** Pupil offset from center (-1 to 1 for each axis) */
readonly pupilOffset: { x: number; y: number };
/** Tracking speed (smoothing factor) */
readonly trackingSpeed: number;
/** Whether tracking is enabled */
readonly enabled: boolean;
}
/**
* Default facial damage state (no damage)
*
* @public
* @category Facial Animation
* @korean 기본얼굴손상상태
*/
export const DEFAULT_FACIAL_DAMAGE: FacialDamageState = {
leftEyeSwelling: 0,
rightEyeSwelling: 0,
mouthBleeding: 0,
noseBleeding: 0,
leftCheekBruise: 0,
rightCheekBruise: 0,
foreheadBruise: 0,
jawBruise: 0,
totalFacialDamage: 0,
};
/**
* Default expression state (neutral)
*
* @public
* @category Facial Animation
* @korean 기본표정상태
*/
export const DEFAULT_EXPRESSION_STATE: ExpressionState = {
expression: FacialExpression.NEUTRAL,
intensity: 1.0,
transitionTime: 0.2,
};
/**
* Default eye tracking state
*
* @public
* @category Facial Animation
* @korean 기본눈추적상태
*/
export const DEFAULT_EYE_TRACKING: EyeTrackingState = {
targetPosition: new THREE.Vector3(0, 1.9, 5), // Looking forward
lookDirection: new THREE.Vector3(0, 0, 1), // Forward
pupilOffset: { x: 0, y: 0 },
trackingSpeed: 0.1,
enabled: true,
};
/**
* Face3D component props
*
* @public
* @category Facial Animation
* @korean 얼굴3D속성
*/
export interface Face3DProps {
/** Current facial expression */
readonly expression: FacialExpression;
/** Facial damage state */
readonly damage: FacialDamageState;
/** Opponent position for eye tracking */
readonly opponentPosition: THREE.Vector3;
/** Current head rotation (Euler angles) */
readonly headRotation: THREE.Euler;
/** Enable eye tracking (default: true) */
readonly enableEyeTracking?: boolean;
/** Enable damage visualization (default: true) */
readonly enableDamageVisuals?: boolean;
/** Mobile mode (simplified rendering) */
readonly isMobile?: boolean;
/** Skin tone color (default: 0xffdbac) */
readonly skinColor?: number;
}
/**
* Eye component props
*
* @public
* @category Facial Animation
* @korean 눈3D속성
*/
export interface EyeProps {
/** Eye position relative to head */
readonly position: [number, number, number];
/** Current facial expression */
readonly expression: FacialExpression;
/** Look direction for pupil tracking */
readonly lookDirection: THREE.Vector3;
/** Eye swelling amount (0-1) */
readonly swelling: number;
/** Whether this is the left or right eye */
readonly side: "left" | "right";
}
/**
* Mouth component props
*
* @public
* @category Facial Animation
* @korean 입3D속성
*/
export interface MouthProps {
/** Mouth position relative to head */
readonly position: [number, number, number];
/** Current facial expression */
readonly expression: FacialExpression;
/** Bleeding intensity (0-1) */
readonly bleeding: number;
}
|