Skip to content

Class: AnimationComponent ​

Single-clip playback (no blending). AnimationSystem samples curves each tick and writes values through auto-dirty setters, so animated property changes propagate naturally. Curves can target descendants — see AnimationClip for path/component/property semantics.

Clips come from two places: clipAssets (ids of .anim clip assets — what the editor authors) and clips (inline AnimationClip data — handy from code). Names must be unique across both; GetClip / Play look in clips first.

Extends ​

Constructors ​

Constructor ​

ts
new AnimationComponent(): AnimationComponent;

Returns ​

AnimationComponent

Inherited from ​

Component.constructor

Properties ​

PropertyModifierTypeDefault valueInherited from
clipAssetspublicstring[]undefined-
clipspublicAnimationClip[]undefined-
defaultClippublicstringundefined-
dirtypublicbooleantrueComponent.dirty
enabledpublicbooleantrueComponent.enabled
playOnLoadpublicbooleanundefined-

Methods ​

GetClip() ​

ts
GetClip(name): AnimationClip | undefined;

Parameters ​

ParameterType
namestring

Returns ​

AnimationClip | undefined


GetClips() ​

ts
GetClips(): AnimationClip[];

Every clip this component can play — inline first, then clip assets.

Returns ​

AnimationClip[]


GetState() ​

ts
GetState(name): 
  | AnimationState
  | undefined;

Lazy-creates on first ask. Useful for things like anim.GetState('walk').time = 0.5.

Parameters ​

ParameterType
namestring

Returns ​

| AnimationState | undefined


IsPlaying() ​

ts
IsPlaying(clipName?): boolean;

Parameters ​

ParameterType
clipName?string

Returns ​

boolean


OnFinished() ​

ts
OnFinished(cb): AnimationUnsubscribe;

Parameters ​

ParameterType
cb(s) => void

Returns ​

AnimationUnsubscribe


OnFrameEvent() ​

ts
OnFrameEvent(name, cb): AnimationUnsubscribe;

Fires once per pass over the named marker in AnimationClip.events.

Parameters ​

ParameterType
namestring
cb(payload) => void

Returns ​

AnimationUnsubscribe


OnLoopComplete() ​

ts
OnLoopComplete(cb): AnimationUnsubscribe;

Parameters ​

ParameterType
cb(s) => void

Returns ​

AnimationUnsubscribe


OnPause() ​

ts
OnPause(cb): AnimationUnsubscribe;

Parameters ​

ParameterType
cb(s) => void

Returns ​

AnimationUnsubscribe


OnPlay() ​

ts
OnPlay(cb): AnimationUnsubscribe;

Parameters ​

ParameterType
cb(s) => void

Returns ​

AnimationUnsubscribe


OnResume() ​

ts
OnResume(cb): AnimationUnsubscribe;

Parameters ​

ParameterType
cb(s) => void

Returns ​

AnimationUnsubscribe


OnStop() ​

ts
OnStop(cb): AnimationUnsubscribe;

Parameters ​

ParameterType
cb(s) => void

Returns ​

AnimationUnsubscribe


Pause() ​

ts
Pause(): void;

Returns ​

void


Play() ​

ts
Play(clipName?, options?): 
  | AnimationState
  | null;

---------- Playback ---------- Stops the in-flight clip first. Returns null if the name doesn't resolve to a clip.

Parameters ​

ParameterType
clipName?string
options?AnimationPlayOptions

Returns ​

| AnimationState | null


PlayClip() ​

ts
PlayClip(clip, options?): AnimationState;

Plays clip data this component doesn't list (an Animator state's clip asset). Its state is kept under the clip's name, and replaced when a different object arrives (a reload).

Parameters ​

ParameterType
clipAnimationClip
options?AnimationPlayOptions

Returns ​

AnimationState


Resume() ​

ts
Resume(): void;

Returns ​

void


Stop() ​

ts
Stop(): void;

Returns ​

void

© 2026 PlayAdGentic