Class · inherits Instance
Keyframe
About Keyframe
A Keyframe holds the Poses applied to joints in a Model
at a given point of time in an animation. Keyframes are
interpolated between during animation playback.
Note, in most cases developers do not need to manipulate
KeyframeSequences as the animation editor covers most
animation functionality. However, in some cases a developer may wish to
generate an animation from a Script or build their own plugin.
Structure
Keyframes are held within a KeyframeSequence and contain Pose
objects. The poses are named in accordance with the BaseParts
they correspond to and are structured in terms of joint hierarchy. This means
each Pose is parented to the Pose corresponding to the part it
is attached to.
Note, as Poses are named in accordance with the
BaseParts they correspond to, animations require distinct
part names to play correctly.
Interpolation
During animation playback the poses in different keyframes are interpolated
between. This allows a smooth animation to be created without needing to
define every frame. Note, the style of interpolation is determined in the
Pose object. The Keyframe object merely holds the Poses
at a defined point of time in the animation (Keyframe.Time).
Properties 1
Time
: floatTheKeyframetime position (in seconds) in an animation. This determines the time at which thePosesinside the keyframe will be shown.This property gives the
Keyframetime position (in seconds) in an animation. This determines the time at which thePosesinside the keyframe will be shown.Note the
Keyframewith the highest time value in aKeyframeSequenceis used to determine the length of the animation.
Methods 6
AddMarker
(marker: Instance) → ()Adds aKeyframeMarkerto theKeyframeby parenting it to the keyframe.This function adds a
KeyframeMarkerto theKeyframeby parenting it to the keyframe. It is functionally identical to setting the marker'sInstance.Parentto the Keyframe.Note, this function will not error when an instance other than a KeyframeMarker is given as the parameter and will parent it successfully.
More about Keyframes
Keyframenames do not need to be unique. For example, if an Animation has three keyframes named "Particles" the connected event returned byAnimationTrack.GetMarkerReachedSignalwill fire each time one of these keyframes is reached.Keyframenames can be set in the Roblox Animation Editor when creating or editing an animation. They cannot however be set by aScripton an existing animation prior to playing it.See also:
AddPose
(pose: Instance) → ()Adds aPoseto theKeyframeby parenting it to the keyframe.This function adds a
Poseto theKeyframeby parenting it to the keyframe. It is functionally identical to setting the pose'sInstance.Parentto the keyframe.Note, this function will not error when an instance other than a
Poseis given as the pose parameter and will parent it successfully.GetMarkers
() → List<KeyframeMarker>Returns an array containing allKeyframeMarkersthat have been added to theKeyframe.This function returns an array containing all
KeyframeMarkersthat have been added to theKeyframe. Note, this function will only returninstancesof type KeyframeMarker.More about Keyframes
Keyframenames do not need to be unique. For example, if an Animation has three keyframes named "Particles" the connected event returned byAnimationTrack.GetMarkerReachedSignalwill fire each time one of these keyframes is reached.Keyframenames can be set in the Roblox Animation Editor when creating or editing an animation. They cannot however be set by aScripton an existing animation prior to playing it.See also:
RemoveMarker
(marker: Instance) → ()Removes aKeyframeMarkerfrom theKeyframeby settings itsInstance.Parenttonil.This function removes a
KeyframeMarkerfrom theKeyframeby settings itsInstance.Parenttonil.The KeyframeMarker's
Instance.Parentis set tonilbut it is not destroyed. This means, provided the marker is referenced it can be re-parented later.Note, this function will not error when an instance other than a KeyframeMarker is given as the parameter.
More about Keyframes
Keyframenames do not need to be unique. For example, if an Animation has three keyframes named "Particles" the connected event returned byAnimationTrack.GetMarkerReachedSignalwill fire each time one of these keyframes is reached.Keyframenames can be set in the Roblox Animation Editor when creating or editing an animation. They cannot however be set by aScripton an existing animation prior to playing it.See also:
RemovePose
(pose: Instance) → ()Removes aPosefrom theKeyframeby setting itsInstance.Parenttonil.This function removes a
Posefrom theKeyframeby setting itsInstance.Parenttonilwithout destroying it. This means the provided the pose is referenced and it can be re-parented later.Note, this function will not error when an instance other than a
Poseis given as the pose parameter.
Keyframe also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.