Reference API Roblox

Engine API

Website

Related

Reference API Roblox

KeyframeSequence

This object stores all of the Keyframes and other data for the animation.

Member index 4

HistoryMember
573AddKeyframe(keyframe: Instance): null
648GetKeyframes(): Instances
573RemoveKeyframe(keyframe: Instance): null
inherited from AnimationClip
553Loop: bool
553Priority: AnimationPriority
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Removed member index 2

HistoryMember
497Loop: bool
497Priority: AnimationPriority

Description

This object stores all the Keyframes for an animation, determines if the animation is looped, and determines its priority against other animations.

What is a KeyframeSequence?

Roblox constructs the animation data it uses in the playback of an animation, referenced by the Animation.AnimationId property from a KeyframeSequence. Every animation refers to a KeyframeSequence or to a CurveAnimation internally. Although, usually created by the Roblox Animation Editor, KeyframeSequence can also be created by other plugins or even manually. Once uploaded to Roblox, Roblox assigns a Content ID that Animations use for the Animation.AnimationId property to refer to the uploaded KeyframeSequence.

Note, in most cases, you do not need to manipulate KeyframeSequences, as the animation editor covers most animation functionality. However, in some cases you may wish to generate an animation from a Script or build your own plugin. However, only Roblox Studio can use a KeyframeSequence created in such a way. If you wish to use such a KeyframeSequence, you will need to upload it to Roblox as described below.

KeyframeSequence Properties

KeyframeSequence.Priority and KeyframeSequence.Loop save the priority and looped animation settings for the sequence. Note that AnimationTrack properties can eventually overwrite these properties at playback time.

The last Keyframe in the sequence, meaning the Keyframe with the highest Keyframe.Time property, determines the length of an animation.

KeyframeSequence Structure

KeyframeSequences act as a container that hold Keyframes. Keyframes represent a 'key' frame in the animation, that are interpolated between during playback.

Keyframes contain Poses. Poses, specific to each BasePart being animated, contain the CFrame applied to the Motor6D connecting two parts. Poses match the BasePart they correspond with by name and apply their data to the Motor6D with this same-named part identified as Motor6D.P1 . For this reason, animations require distinct part names to play correctly.

Poses follow a structure based on joint hierarchy. The parent of each Pose corresponds to the Pose of the part it is attached to. In practice, this means the poses branch out from the root part. See below for a visual example.

Using KeyframeSequences when making animations

You must first upload KeyframeSequences to Roblox before they can be played in an experience. In Studio, right click on the KeyframeSequence and click 'Save to Roblox'. Alternatively, you can use the Plugin:SaveSelectedToRoblox() function. Either method will bring up the animation upload window and allow you to upload your KeyframeSequence as an animation.

In some cases, you may want to preview an Animation before uploading it to the Roblox site. You can generate a temporary id using KeyframeSequenceProvider:RegisterKeyframeSequence(). This will generate a hash id that can be used for localized animation testing.

Obtaining KeyframeSequences

In some cases you may wish to download the KeyframeSequence corresponding to an existing uploaded Animation. You can use AnimationClipProvider:GetAnimationClipAsync() to download an animation.

History 24

Members 4

AddKeyframe

Parameters (1)
keyframeInstance
Returns (1)
null

This function adds a Keyframe to the KeyframeSequence by parenting it to the KeyframeSequence. It is functionally identical to setting the keyframe's Instance.Parent to the KeyframeSequence.

Note, this function will not error when called with an instance other than a Keyframe as the keyframe parameter and will parent it successfully.

History 3

GetKeyframes

Parameters (0)
No parameters.
Returns (1)
Instances

GetKeyframes returns an array that contains all Keyframes that have been added to a KeyframeSequence.

History 3

RemoveKeyframe

Parameters (1)
keyframeInstance
Returns (1)
null

This function removes a Keyframe from the KeyframeSequence by setting its parent to nil. It is functionally identical to setting the keyframe's parent to nil.

This sets the keyframe's parent to nil, but does not destroy it. This means, provided another reference to the keyframe remains, it can be re-parented later.

Note, this function will not error when called with an Instance other than a Keyframe as the keyframe parameter.

History 3

Removed members 2

Loop

TypeDefault
bool

History 4

Priority

TypeDefault
AnimationPriority

History 4

Settings