Class: OwenAnimationContext

core.OwenAnimationContext(model, mixer, animationClipFactory, stateFactory)

Main controller for the Owen animation system Manages state transitions, animation playback, and user interactions

Constructor

new OwenAnimationContext(model, mixer, animationClipFactory, stateFactory)

Create an Owen animation context

Parameters:
Name Type Description
model THREE.Object3D

The 3D character model

mixer THREE.AnimationMixer

The Three.js animation mixer

animationClipFactory AnimationClipFactory

Factory for creating clips

stateFactory StateFactory

Factory for creating state handlers

Source:

Members

animationClipFactory :AnimationClipFactory

Factory for creating animation clips

Type:
  • AnimationClipFactory
Source:

clips :Map.<string, AnimationClip>

Map of animation clips by name

Type:
  • Map.<string, AnimationClip>
Source:

currentState :string

Current active state

Type:
  • string
Source:

currentStateHandler :StateHandler|null

Current active state handler

Type:
  • StateHandler | null
Source:

inactivityTimeout :number

Inactivity timeout in milliseconds

Type:
  • number
Source:

inactivityTimer :number

Timer for inactivity detection

Type:
  • number
Source:

initialized :boolean

Whether the system is initialized

Type:
  • boolean
Source:

mixer :THREE.AnimationMixer

The Three.js animation mixer

Type:
  • THREE.AnimationMixer
Source:

model :THREE.Object3D

The 3D character model

Type:
  • THREE.Object3D
Source:

nameMapper :AnimationNameMapper

Multi-scheme animation name mapper

Type:
  • AnimationNameMapper
Source:

stateFactory :StateFactory

Factory for creating state handlers

Type:
  • StateFactory
Source:

states :Map.<string, StateHandler>

Map of state handlers by name

Type:
  • Map.<string, StateHandler>
Source:

Methods

dispose() → {void}

Dispose of the animation system and clean up resources

Source:
Returns:
Type
void

getAnimationNames(name) → {Object}

Get all naming scheme variants for an animation

Parameters:
Name Type Description
name string

The animation name in any scheme

Source:
Returns:

Object with all scheme variants: {legacy, artist, hierarchical, semantic}

Type
Object

getAnimationsByStateAndEmotion(state, emotionopt, schemeopt) → {Array.<string>}

Get available animations by state and emotion

Parameters:
Name Type Attributes Default Description
state string

The state name (wait, react, type, sleep)

emotion string <optional>

The emotion name (angry, happy, sad, shocked, neutral)

scheme string <optional>
'semantic'

The naming scheme to return

Source:
Returns:

Array of animation names in the specified scheme

Type
Array.<string>

getAvailableClips() → {Array.<string>}

Get all available animation clip names

Source:
Returns:

Array of clip names

Type
Array.<string>

getAvailableStates() → {Array.<string>}

Get all available state names

Source:
Returns:

Array of state names

Type
Array.<string>

getAvailableTransitions() → {Array.<string>}

Get available transitions from current state

Source:
Returns:

Array of available state transitions

Type
Array.<string>

getClip(name) → {AnimationClip|undefined}

Get an animation clip by name (supports all naming schemes)

Parameters:
Name Type Description
name string

The animation clip name in any supported scheme

Source:
Returns:

The animation clip or undefined if not found

Type
AnimationClip | undefined

getClipByScheme(name, targetSchemeopt) → {AnimationClip|undefined}

Get an animation clip by name in a specific naming scheme

Parameters:
Name Type Attributes Description
name string

The animation name

targetScheme string <optional>

Target scheme: 'legacy', 'artist', 'hierarchical', 'semantic'

Source:
Returns:

The animation clip or undefined if not found

Type
AnimationClip | undefined

getClipsByPattern(pattern) → {Array.<AnimationClip>}

Get animation clips matching a pattern

Parameters:
Name Type Description
pattern string

Pattern to match (supports * wildcards)

Source:
Returns:

Array of matching clips

Type
Array.<AnimationClip>

getCurrentState() → {string}

Get the current state name

Source:
Returns:

The current state name

Type
string

getCurrentStateHandler() → {StateHandler|null}

Get the current state handler

Source:
Returns:

The current state handler

Type
StateHandler | null

(async) handleUserMessage(message) → {Promise.<void>}

Handle a user message

Parameters:
Name Type Description
message string

The user message

Source:
Returns:
Type
Promise.<void>

(async) initialize() → {Promise.<void>}

Initialize the animation system

Source:
Returns:
Type
Promise.<void>

onUserActivity() → {void}

Called when user activity is detected

Source:
Returns:
Type
void

(async) transitionTo(newStateName, emotionopt) → {Promise.<void>}

Transition to a new state

Parameters:
Name Type Attributes Default Description
newStateName string

The name of the state to transition to

emotion string <optional>
Emotions.NEUTRAL

The emotion for the transition

Source:
Throws:

If state is not found or transition is invalid

Type
Error
Returns:
Type
Promise.<void>

update(deltaTime) → {void}

Update the animation system (call every frame)

Parameters:
Name Type Description
deltaTime number

Time elapsed since last update (ms)

Source:
Returns:
Type
void

validateAnimationName(name) → {Object}

Validate an animation name and get suggestions if invalid

Parameters:
Name Type Description
name string

The animation name to validate

Source:
Returns:

Validation result with isValid, scheme, error, and suggestions

Type
Object