@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components / AnimationComponent
Class: AnimationComponent
Defined in: components/Animation.ts:71
Animation catalog and runtime state for an entity. Combines clips imported from a model with externally added clips, exposes a state machine for named transitions, and is queried each frame by the animation system to advance mixer time.
Remarks
Use the addState / switchState helpers rather than mutating the state machine directly so the animation system observes transitions.
Extends
Constructors
Constructor
new AnimationComponent(options?): AnimationComponent;Defined in: components/Animation.ts:102
Parameters
| Parameter | Type |
|---|---|
options | AnimationComponentOptions |
Returns
AnimationComponent
Overrides
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
clips | AnimationClip[] | Combined ordered list of clips (model + external) currently loaded. | components/Animation.ts:78 |
clipCatalog | AnimationClipCatalogEntry[] | Per-clip metadata used by the inspector. | components/Animation.ts:80 |
availableClips | string[] | Display names of clips available for state-machine bindings. | components/Animation.ts:82 |
externalClipSources | string[] | URLs/paths of external clip sources (saved with the project). | components/Animation.ts:84 |
paused | boolean | Whether playback is currently paused. | components/Animation.ts:86 |
reverse | boolean | Play the active clip in reverse. | components/Animation.ts:88 |
timeScale | number | Playback speed multiplier (1 = real-time). | components/Animation.ts:90 |
crossFadeDuration | number | Default cross-fade duration in seconds when switching states. | components/Animation.ts:92 |
states | AnimationStateMachine[] | All state-machine entries authored on this entity. | components/Animation.ts:94 |
active | | AnimationStateMachine | null | State currently being played, or null if none. | components/Animation.ts:96 |
activeStateName | string | null | Name of the active state, or null if none. | components/Animation.ts:98 |
stateManager | AnimationStateManager | Manager that drives state transitions; mutate via addState/switchState. | components/Animation.ts:100 |
Methods
setModelClips()
setModelClips(clips): void;Defined in: components/Animation.ts:234
Parameters
| Parameter | Type |
|---|---|
clips | AnimationClip[] |
Returns
void
setImportedClips()
setImportedClips(clips): void;Defined in: components/Animation.ts:239
Parameters
| Parameter | Type |
|---|---|
clips | AnimationClip[] | ImportedClipEntry[] |
Returns
void
setExternalClipSources()
setExternalClipSources(sources): void;Defined in: components/Animation.ts:276
Parameters
| Parameter | Type |
|---|---|
sources | string[] |
Returns
void
addState()
addState(
name,
clipRef,
loop?):
| AnimationStateMachine
| null;Defined in: components/Animation.ts:301
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | undefined |
clipRef | string | undefined |
loop | boolean | false |
Returns
| AnimationStateMachine | null
setStates()
setStates(states): void;Defined in: components/Animation.ts:316
Parameters
| Parameter | Type |
|---|---|
states | { name: string; clip: string; clipId?: string; loop?: boolean; }[] |
Returns
void
getStateConfigs()
getStateConfigs(): {
name: string;
clip: string;
clipId: string | null;
loop: boolean;
}[];Defined in: components/Animation.ts:343
Returns
{ name: string; clip: string; clipId: string | null; loop: boolean; }[]
setActiveState()
setActiveState(name, autoPlay?): boolean;Defined in: components/Animation.ts:352
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | null | undefined |
autoPlay | boolean | true |
Returns
boolean
removeState()
removeState(name): boolean;Defined in: components/Animation.ts:363
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
boolean
switchState()
switchState(name, autoPlay?): boolean;Defined in: components/Animation.ts:371
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | undefined |
autoPlay | boolean | true |
Returns
boolean
playState()
playState(name?): boolean;Defined in: components/Animation.ts:382
Parameters
| Parameter | Type |
|---|---|
name? | string |
Returns
boolean
pauseState()
pauseState(name?): boolean;Defined in: components/Animation.ts:393
Parameters
| Parameter | Type |
|---|---|
name? | string |
Returns
boolean
stopState()
stopState(name?): boolean;Defined in: components/Animation.ts:404
Parameters
| Parameter | Type |
|---|---|
name? | string |
Returns
boolean

