Skip to content

AnimationTrack

Supported Class Animation & Avatar NotCreatable

Controls the playback of an animation on an Animator.

12 Nova members · 17 modern Roblox members not implemented yet

Description

Controls the playback of an animation on an Animator. This object cannot be created, instead it is returned by the Animator.LoadAnimation() method.

Inheritance

Object → Instance → AnimationTrack

Nova inheritance: Instance → AnimationTrack

Properties

Animation Supported Property The Animation object that was used to create this AnimationTrack.
Animation: Object

The Animation object that was used to create this AnimationTrack. To create an AnimationTrack, you must load an Animation object onto an Animator using the Animator.LoadAnimation() method.

Roblox reference signature
Animation: Animation

Roblox documentation

IsPlaying Supported Property A read-only property that returns true when the AnimationTrack is playing.
IsPlaying: bool

A read-only property that returns true when the AnimationTrack is playing.

This property can be used to check if an animation is already playing before playing it (as that would cause it to restart). If you want to obtain all playing AnimationTracks on an Animator or a Humanoid, they should use Animator.GetPlayingAnimationTracks()

Roblox documentation

Length Supported Property A read-only property that returns the length (in seconds) of an AnimationTrack. This will return 0 until the animation has fully loaded and thus may…
Length: float

A read-only property that returns the length (in seconds) of an AnimationTrack. This will return 0 until the animation has fully loaded and thus may not be immediately available.

When the AnimationTrack.Speed of an AnimationTrack is equal to 1, the animation will take AnimationTrack.Length (in seconds) to complete.

Roblox documentation

Priority Supported Property Sets the priority of an AnimationTrack. Depending on what this is set to, playing multiple animations at once will look to this property to figure ou…
Priority: AnimationPriority

This property sets the priority of an AnimationTrack. Depending on what this is set to, playing multiple animations at once will look to this property to figure out which Keyframe poses should be played over one another. It uses AnimationPriority which has 7 priority levels:

  1. Action4 (highest priority)
  2. Action3
  3. Action2
  4. Action
  5. Movement
  6. Idle
  7. Core (lowest priority)

Properly set animation priorities, either through the Animation Editor or through this property, allow multiple animations to be played without them clashing. Where two playing animations direct the target to move the same limb in different ways, the AnimationTrack with the highest priority will show. If both animations have the same priority, the weights of the tracks will be used to combine the animations.

Roblox documentation

TimePosition Supported Property Returns the position in time in seconds that an AnimationTrack is through playing its source animation. Can be set to make the track jump to a specif…
TimePosition: float

Returns the position in time in seconds that an AnimationTrack is through playing its source animation. Can be set to make the track jump to a specific moment in the animation, but the AnimationTrack must be playing to do so. It can also be used in combination with AnimationTrack.AdjustSpeed() to freeze the animation at a desired point by setting speed to 0.

Roblox documentation

Methods

AdjustSpeed Supported Function Changes the AnimationTrack.Speed of an animation. A positive value for speed plays the animation forward, a negative one plays it backwards, and 0 pa…
AnimationTrack:AdjustSpeed(float speed = 1)

This method changes the AnimationTrack.Speed of an animation. A positive value for speed plays the animation forward, a negative one plays it backwards, and 0 pauses it.

A track's initial speed is set as a parameter in AnimationTrack.Play(). However a track's AnimationTrack.Speed can be changed during playback using this method. When speed is equal to 1, the amount of time an animation takes to complete is equal to AnimationTrack.Length (in seconds).

When is adjusted, then the actual time it will take a track to play can be computed by dividing the length by the speed. AnimationTrack.Speed is a unitless quantity.

Roblox reference signature
AnimationTrack:AdjustSpeed(speed: float = 1): null

Roblox documentation

AdjustWeight Supported Function Changes the weight of an animation, with the optional fadeTime parameter determining how long it takes for AnimationTrack.WeightCurrent to reach Anim…
AnimationTrack:AdjustWeight(float weight = 1, float fadeTime = 0.100000001)

Changes the weight of an animation, with the optional fadeTime parameter determining how long it takes for AnimationTrack.WeightCurrent to reach AnimationTrack.WeightTarget.

When weight is set in an AnimationTrack it does not change instantaneously but moves from AnimationTrack.WeightCurrent to AnimationTrack.WeightTarget. The time it takes to do this is determined by the fadeTime parameter given when the animation is played, or the weight is adjusted.

The animation weighting system is used to determine how AnimationTracks playing at the same priority are blended together. The default weight is 1, and no movement will be visible on an AnimationTrack with a weight of 0. The pose that is shown at any point in time is determined by the weighted average of all the Poses and the AnimationTrack.WeightCurrent of each AnimationTrack. See below for an example of animation blending in practice. In most cases blending animations is not required and using AnimationTrack.Priority is more suitable.

Roblox reference signature
AnimationTrack:AdjustWeight(weight: float = 1, fadeTime: float = 0.100000001): null

Roblox documentation

GetTimeOfKeyframe Supported Function Returns the time position of the first Keyframe of the given name in an AnimationTrack.
AnimationTrack:GetTimeOfKeyframe(string keyframeName): double

Returns the time position of the first Keyframe of the given name in an AnimationTrack. If multiple Keyframes share the same name, it will return the earliest one in the animation.

This method will return an error if it is uses with an invalid keyframe name (one that does not exist for example) or if the underlying Animation has not yet loaded. To address this make sure only correct keyframe names are used and the animation has loaded before calling this method.

To check if the animation has loaded, verify that the AnimationTrack.Length is greater than zero.

Roblox reference signature
AnimationTrack:GetTimeOfKeyframe(keyframeName: string): double

Roblox documentation

Play Supported Function Plays the AnimationTrack. Once called an AnimationTrack will play with the specified fadeTime, weight and speed.
AnimationTrack:Play(float fadeTime = 0.100000001, float weight = 1, float speed = 1)

Plays the AnimationTrack. Once called an AnimationTrack will play with the specified fadeTime, weight and speed.

When AnimationTrack.Play() is called the track's animation will begin playing and the weight of the animation will increase from 0 to the specified weight (defaults to 1) over the specified fadeTime.

The speed the AnimationTrack will play at is determined by the speed parameter (defaults to 1). When the speed is equal to 1 the number of seconds the track will take to complete is equal to the track's AnimationTrack.Length property. For example, a speed of 2 will cause the track to play twice as fast.

The weight and speed of the animation can also be changed after the animation has begun playing by using the AnimationTrack.AdjustWeight() and AnimationTrack.AdjustSpeed() methods.

If you want to start the animation at a specific point using AnimationTrack.TimePosition, it's important the animation is played before this is done.

Roblox reference signature
AnimationTrack:Play(fadeTime: float = 0.100000001, weight: float = 1, speed: float = 1): null

Roblox documentation

Stop Supported Function Stops the AnimationTrack.
AnimationTrack:Stop(float fadeTime = 0.100000001)

Stops the AnimationTrack. Once called, the weight of the animation will move towards zero over a length of time specified by the optional fadeTime parameter. For example, if Stop() is called with a fadeTime of 2, it will take two seconds for the weight of the track to reach zero and its effects completely end. Please note this will be the case regardless of the initial weight of the animation.

Usage Notes

After calling Stop(), subsequent calls to Stop() and AdjustWeight() will not work as expected. To adjust a track that's fading out, you must first call Play() to reset the IsPlaying property to true.

It is not recommended to use a fadeTime of 0 in an attempt to override this effect and end the animation immediately for Motor6Ds that have their Motor.MaxVelocity set to zero, as this causes the joints to freeze in place. If it must end immediately, ensure the Motor.MaxVelocity of Motor6Ds in your rig are high enough for them to snap properly.

Roblox reference signature
AnimationTrack:Stop(fadeTime: float = 0.100000001): null

Roblox documentation

Events

KeyframeReached Supported Event Deprecated Fires every time playback of an AnimationTrack reaches a Keyframe that does not have the default name of Keyframe.
KeyframeReached(string keyframeName)

Fires every time playback of an AnimationTrack reaches a Keyframe that does not have the default name of Keyframe. This event lets you run code at predefined points in an animation (set by Keyframe names).

Keyframe names do not need to be unique. For example, if an animation has three keyframes named Particles, this event will fire each time one of these keyframes is reached.

Keyframe names can be set in the Animation Editor when creating or editing an animation. They cannot however be set by a Script on an existing animation prior to playing it.

Roblox reference signature
KeyframeReached(keyframeName: string)

Roblox documentation

Stopped Supported Event Deprecated Fires when the AnimationTrack finishes playing. The AnimationTrack might still animate the subject while the animation "fades out". To catch when the…
Stopped()

Fires when the AnimationTrack finishes playing. The AnimationTrack might still animate the subject while the animation "fades out". To catch when the AnimationTrack is completely done moving anything in the world, use the AnimationTrack.Ended event.

Fires whenever the AnimationTrack finishes playing.

This event has a number of uses. It can be used to wait until an AnimationTrack has stopped before continuing (for example, if chaining a series of animations to play after each other). It can also be used to clean up any Instances created during the animation playback.

Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

Inherited members

Inherited from Instance: 8 properties, 36 methods, 7 events. They are documented on the base class page.

17 modern Roblox member(s) are not implemented yet — expand to inspect

Members declared by Roblox's AnimationTrack class (or by a missing base class) that Nova does not expose. Use this list to scope a migration; the compatibility guide has the recommended workaround.

Properties

Member Signature Status Notes Flags
Looped Looped: bool Not yet Sets whether the animation will repeat after finishing. If it is changed while playing the result will take effect after the animation finishes. —
Speed Speed: float Not yet Read-only property that gives the current playback speed of the AnimationTrack. ReadOnly, NotReplicated
WeightCurrent WeightCurrent: float Not yet Read-only property that gives the current weight of the AnimationTrack. ReadOnly, NotReplicated
WeightTarget WeightTarget: float Not yet Read-only property that gives the current weight of the AnimationTrack. ReadOnly, NotReplicated

Methods

Member Signature Status Notes Flags
GetDebugData AnimationTrack:GetDebugData(): Dictionary Not yet — RobloxScriptSecurity
GetMarkerReachedSignal AnimationTrack:GetMarkerReachedSignal(name: string): RBXScriptSignal Not yet Returns an RBXScriptSignal (event) that fires when a specified KeyframeMarker has been hit in an [animation](Anim… —
GetParameter AnimationTrack:GetParameter(key: string): Variant Not yet Returns the value of a parameter on the animation graph by key. Returns nil if the parameter has not been set. —
GetParameterDefaults AnimationTrack:GetParameterDefaults(): Dictionary Not yet Returns a dictionary of parameter values initially set as instance attributes on the AnimationGraphDefinition instance used to build the a… —
GetTargetInstance AnimationTrack:GetTargetInstance(name: string): Instance Not yet — —
GetTargetNames AnimationTrack:GetTargetNames(): Array Not yet — —
ResetGraph AnimationTrack:ResetGraph(): null Not yet — RobloxScriptSecurity
SetParameter AnimationTrack:SetParameter(key: string, value: Variant): null Not yet Sets a parameter value on the animation graph, driving animation graph node inputs. —
SetTargetInstance AnimationTrack:SetTargetInstance(name: string, target: Instance): null Not yet — —
UpdateGraphNodeProperty AnimationTrack:UpdateGraphNodeProperty(nodeId: string, propertyName: string, value: Variant, inputPinName: string): bool Not yet — RobloxScriptSecurity

Events

Member Signature Status Notes Flags
DidLoop DidLoop() Not yet Fires when an AnimationTrack loops on the next update following the end of the previous animation loop. —
Ended Ended() Not yet Fires when the AnimationTrack is completely done moving anything in the world. —
ParameterChanged ParameterChanged(key: string, value: Variant) Not yet — RobloxScriptSecurity

Roblox reference: AnimationTrack

Generated from Nova's API dump and Roblox creator-docs. Nova-only members come from the engine's reflection metadata.