Optionalevents: AnimationEventsPrivateclearEnable or reconfigure animation queue system
Korean: 애니메이션 대기열 활성화/재설정
The queue is enabled by default. Use this method to reconfigure the queue size or conflict resolution strategy.
Maximum queue size (default: 3)
Conflict resolution strategy (default: "timestamp")
Get current animation configuration
Current animation config or undefined
Get current guard stance if in a guard animation
Trigram stance or null if not in guard
Get predicted future keyframe for latency reduction
Korean: 예측된 미래 키프레임 가져오기
Returns a keyframe predicted ahead by predictionTimeAhead (default: 1 frame). This reduces perceived input latency by showing where the animation will be in the near future rather than where it currently is.
Integration point: Use this instead of the current keyframe when applying to the rig if motion prediction is enabled.
Current skeletal animation keyframe
Predicted future keyframe, or current if prediction disabled
Get interpolated blend weights for current stance transition frame
Korean: 현재 프레임 블렌드 가중치
Returns the interpolated blend data for the current frame during stance_change animation. Uses the keyframe data from the transition matrix to provide smooth stance interpolation.
Blend data with stance and weight, or null if not in transition
Get full internal state (for debugging/testing)
Current state machine state
PrivateprocessEnable or disable motion prediction
Korean: 동작 예측 설정
Enables motion prediction to reduce perceived input latency by predicting future animation frames based on current velocity (1-2 frames ahead).
Whether to enable motion prediction
OptionalpredictionTime: numberOptional: time ahead to predict (default: 16.67ms)
Set preferred easing function for transitions
Korean: 선호 이징 함수 설정
Sets the default easing curve for animation transitions. Can use presets like "natural-motion", "smooth-transition", etc.
Easing function name
Attempt to transition to a new animation state
Checks transition rules and priority system before transitioning.
Target animation state
Whether transition was successful
Transition to ATTACK state with a technique-specific duration.
The default ATTACK config is 200ms (12 frames), but real techniques range from 350ms to 1200ms. This method overrides the ATTACK frame count to match the actual skeletal animation duration so the state machine stays in ATTACK for the full technique.
The skeletal animation duration in seconds
Whether transition was successful
Attempt to transition to a new animation state with queue support
Korean: 대기열 지원 상태 전환
Enhanced version of transitionTo() that automatically queues animations when they cannot be executed immediately. Since the queue is enabled by default, this is the recommended method for animation transitions.
The queued animation will be automatically processed when the current animation completes, following priority and conflict resolution rules.
Target animation state
Whether transition was successful, queued, or failed
Transition to stance_change animation with specific stance transition data
Korean: 자세 전환 애니메이션 시작
Initiates a stance change animation with the specific transition data from the 64-transition matrix. This provides stance-specific keyframes and blend weights for smooth interpolation.
Source trigram stance
Target trigram stance
Whether transition was successful
// Start transition from Heaven to Lake stance
const success = machine.transitionToStanceChange(
TrigramStance.GEON,
TrigramStance.TAE
);
if (success) {
// During update loop, use getStanceTransitionBlend() to interpolate
const blend = machine.getStanceTransitionBlend();
if (blend) {
// Apply blend weights to stance poses
applyStanceBlend(blend);
}
}
Transition to stance-specific guard animation
Convenience method to transition to a stance guard based on trigram stance. Automatically maps trigram stance to corresponding guard animation state.
Trigram stance identifier
Whether transition was successful
Update animation state with delta time
Call this in useFrame for 60fps updates. Handles frame progression, looping, and completion.
Time elapsed since last update (in seconds)
Animation update result with current state and frame
Update motion prediction with skeletal keyframe data
Korean: 동작 예측 업데이트
This should be called from the skeletal animation layer when applying interpolated keyframes to the rig. It updates velocity tracking for motion prediction to reduce perceived latency.
Integration point: Call this from your skeletal animation system after computing the current interpolated keyframe (e.g., from getInterpolatedKeyframe).
Current skeletal animation keyframe with bone positions/rotations
Time elapsed since last update
// In your skeletal animation update loop:
const currentKeyframe = getInterpolatedKeyframe(animation, time);
// Update motion prediction (for next frame)
if (machine.isMotionPredictionEnabled()) {
machine.updateMotionPredictionState(currentKeyframe, deltaTime);
}
// Apply keyframe to rig
applyKeyframeToRig(rig, currentKeyframe);
PrivateanimationAnimation queue for pending animations
Korean: 애니메이션 대기열
Stores animation requests that couldn't be executed immediately due to non-interruptible animations or priority conflicts. Processed automatically when current animation completes.
Enabled by default with max size 3 and timestamp-based conflict resolution. Can be disabled with disableQueue() or reconfigured with enableQueue().
Private ReadonlyanimationsCreate a new animation state machine
Clones the provided config map so per-instance mutations (e.g. dynamic attack duration) don't affect shared defaults.
PrivateconflictConflict resolution strategy for equal-priority animations
Korean: 충돌 해결 전략
Determines how to resolve conflicts when multiple animations have equal priority. Default: timestamp (FIFO).
PrivatecurrentCurrent stance transition data (null when not in stance_change animation)
Korean: 현재 자세 전환 데이터
Tracks the active stance transition for use during stance_change animation. Provides access to keyframes and blend weights for smooth interpolation.
PrivatecurrentPrivateenableEnable motion prediction for latency reduction
Korean: 동작 예측 활성화
When enabled, predicts future animation frames based on current velocity to reduce perceived input latency by 16-33ms (1-2 frames at 60fps).
Private Optional ReadonlyeventsPrivateframePrivatejustPrivatejustPrivatemotionMotion prediction state for latency reduction
Korean: 동작 예측 상태
Tracks animation velocities for motion prediction to reduce perceived latency. Updated each frame with velocity calculations for smooth anticipation.
PrivatepredictionMotion prediction time ahead (seconds)
Korean: 예측 시간
How far ahead to predict motion (default: 1 frame = 16.67ms at 60fps). Typical range: 0.016-0.033 seconds for <50ms total latency.
PrivatepreferredPreferred easing function for smooth transitions
Korean: 선호 이징 함수
Default easing curve for animation blending and transitions. Can be overridden per animation or transition.
PrivatepreviousPrevious keyframe for motion prediction velocity calculation
Korean: 이전 키프레임
PrivatepreviousPrivatetimePrivate Static ReadonlyGUARD_Static mapping from TrigramStance to guard AnimationState Prevents repeated object allocation in transitionToStanceGuard()
Private Static ReadonlySTANCE_Static reverse mapping from guard AnimationState to TrigramStance Prevents repeated object allocation in getCurrentGuardStance()
Player Animation State Machine
Manages animation state, transitions, and timing with frame-accurate updates. Integrates priority system, automatic animation queueing, and event callbacks.
Animation Queue: Enabled by default with max size 3 and timestamp-based conflict resolution. Automatically queues animations that cannot execute immediately and processes them when the current animation completes.
Example
Korean
플레이어애니메이션상태머신