Skip to Content
Kinemium

AnimationTrack

Control one playing animation on a rig.

AnimationTrack is a live handle to one animation clip. It reports playback state, exposes events, and provides methods to play, stop, and blend the clip.

Getting started

local track = animator:LoadAnimation(animation)
track.Looped = true
track:Play(0.2, 1, 1)

task.wait(2)
track:Stop(0.2)

Properties

PropertyTypeAccessDescription
AnimationAnimation?Read-onlyClip this track came from.
IsPlayingbooleanRead-onlyWhether the clip is currently playing.
LengthnumberRead-onlyClip length in seconds.
LoopedbooleanRead/writeRestart when the clip ends.
PriorityEnum.AnimationPriorityRead/writeBlending priority.
SpeednumberRead-onlyCurrent playback speed. Use AdjustSpeed().
TimePositionnumberRead/writeCurrent position in seconds.
WeightCurrentnumberRead-onlyCurrent blend weight.
WeightTargetnumberRead-onlyTarget blend weight.

Methods

SignatureDescription
Play(fadeTime?: number, weight?: number, speed?: number)Starts playback. Defaults are 0.1, 1, and 1.
Stop(fadeTime?: number)Stops playback with an optional fade.
AdjustSpeed(speed?: number)Changes playback speed.
AdjustWeight(weight?: number, fadeTime?: number)Changes blend weight.
GetMarkerReachedSignal(name: string): signalReturns the signal for a named marker.
GetTimeOfKeyframe(name: string): numberReturns the time of a named keyframe or raises an error.
GetParameter(name: string): anyReads a stored track parameter.
SetParameter(name: string, value: any)Stores a track parameter. Passing nil removes it.
GetParameterDefaults(): tableReturns an empty table.

Events

EventArgumentsDescription
StoppednoneFires when playback stops.
EndednoneFires when a non-looped clip reaches its end.
DidLoopnoneFires each time a looped clip restarts.
KeyframeReachednameFires when a keyframe is reached.

GetMarkerReachedSignal() creates a signal the first time you ask for a marker and reuses it afterward.

Notes

  • A track becomes invalid when its animator is destroyed or the rig is released; calls then do nothing or raise an error.
  • Priority and TimePosition can be assigned directly.
  • Speed is read-only; use AdjustSpeed().
  • Parameters are stored per track and accept any value.
  • GetParameterDefaults() currently returns an empty table, so don't rely on it for real defaults.

See also

  • Animator and AnimationController for creating tracks.
  • Animation for clip selection.

On this page