rojo/.cursor/rules/roblox/reference/engine/classes/Keyframe.yaml
2026-02-02 12:08:47 -06:00

289 lines
9.8 KiB
YAML

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: Keyframe
type: class
memory_category: Animation
summary: |
A Keyframe holds the `Class.Pose|Poses` applied to joints in a `Class.Model`
at a given point of time in an animation. `Class.Keyframe|Keyframes` are
interpolated between during animation playback.
description: |
A Keyframe holds the `Class.Pose|Poses` applied to joints in a `Class.Model`
at a given point of time in an animation. `Class.Keyframe|Keyframes` are
interpolated between during animation playback.
Note, in most cases developers do not need to manipulate
`Class.KeyframeSequence|KeyframeSequences` as the animation editor covers most
animation functionality. However, in some cases a developer may wish to
generate an animation from a `Class.Script` or build their own plugin.
## Structure
Keyframes are held within a `Class.KeyframeSequence` and contain `Class.Pose`
objects. The poses are named in accordance with the `Class.BasePart|BaseParts`
they correspond to and are structured in terms of joint hierarchy. This means
each `Class.Pose` is parented to the `Class.Pose` corresponding to the part it
is attached to.
Note, as `Class.Pose|Poses` are named in accordance with the
`Class.BasePart|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
`Class.Pose` object. The Keyframe object merely holds the `Class.Pose|Poses`
at a defined point of time in the animation (`Class.Keyframe.Time`).
code_samples:
- Keyframe-Generate-Poses
inherits:
- Instance
descendants: []
tags: []
deprecation_message: ''
properties:
- name: Keyframe.Time
summary: |
The `Class.Keyframe` time position (in seconds) in an animation. This
determines the time at which the `Class.Pose|Poses` inside the keyframe
will be shown.
description: |
This property gives the `Class.Keyframe` time position (in seconds) in an
animation. This determines the time at which the `Class.Pose|Poses` inside
the keyframe will be shown.
Note the `Class.Keyframe` with the highest time value in a
`Class.KeyframeSequence` is used to determine the length of the animation.
code_samples:
- Get-KeyframeSequence-Length
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- Animation
methods:
- name: Keyframe:AddMarker
summary: |
Adds a `Class.KeyframeMarker` to the `Class.Keyframe` by parenting it to
the keyframe.
description: |
This function adds a `Class.KeyframeMarker` to the `Class.Keyframe` by
parenting it to the keyframe. It is functionally identical to setting the
marker's `Class.Instance.Parent` to 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
`Class.Keyframe` names do not need to be unique. For example, if an
Animation has three keyframes named "Particles" the connected event
returned by `Class.AnimationTrack:GetMarkerReachedSignal()` will fire each
time one of these keyframes is reached.
`Class.Keyframe` names can be set in the Roblox Animation Editor when
creating or editing an animation. They cannot however be set by a
`Class.Script` on an existing animation prior to playing it.
See also:
- `Class.Keyframe:RemoveMarker()`
- `Class.Keyframe:GetMarkers()`
- `Class.AnimationTrack:GetMarkerReachedSignal()`
code_samples:
- add-marker-remove-marker
parameters:
- name: marker
type: Instance
default:
summary: |
The `Class.KeyframeMarker` being parented to the `Class.Keyframe`.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Animation
- name: Keyframe:AddPose
summary: |
Adds a `Class.Pose` to the `Class.Keyframe` by parenting it to the
keyframe.
description: |
This function adds a `Class.Pose` to the `Class.Keyframe` by parenting it
to the keyframe. It is functionally identical to setting the pose's
`Class.Instance.Parent` to the keyframe.
Note, this function will not error when an instance other than a
`Class.Pose` is given as the pose parameter and will parent it
successfully.
code_samples:
- Keyframe-Generate-Poses
- Keyframe-Add-Remove-Pose
parameters:
- name: pose
type: Instance
default:
summary: |
The `Class.Pose` to be added.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Animation
- name: Keyframe:GetMarkers
summary: |
Returns an array containing all `KeyframeMarkers` that have been added to
the `Class.Keyframe`.
description: |
This function returns an array containing all
`Class.KeyframeMarker|KeyframeMarkers` that have been added to the
`Class.Keyframe`. Note, this function will only return
`Class.Instance|instances` of type KeyframeMarker.
#### More about Keyframes
`Class.Keyframe` names do not need to be unique. For example, if an
Animation has three keyframes named "Particles" the connected event
returned by `Class.AnimationTrack:GetMarkerReachedSignal()` will fire each
time one of these keyframes is reached.
`Class.Keyframe` names can be set in the Roblox Animation Editor when
creating or editing an animation. They cannot however be set by a
`Class.Script` on an existing animation prior to playing it.
See also:
- `Class.Keyframe:AddMarker()`
- `Class.Keyframe:RemoveMarker()`
- `Class.AnimationTrack:GetMarkerReachedSignal()`
code_samples:
- get-keyframe-markers-attached-to-a-keyframe
parameters: []
returns:
- type: Instances
summary: |
An array containing all `Class.KeyframeMarker|KeyframeMarkers` that
have been added to the `Class.Keyframe`.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Animation
- name: Keyframe:GetPoses
summary: |
Returns an array containing all `Class.Pose|Poses` that have been added to
a `Class.Keyframe`.
description: |
This function returns an array containing all `Class.Pose|Poses` that have
been added to a `Class.Keyframe`.
code_samples:
- Keyframe-Reset-Poses
parameters: []
returns:
- type: Instances
summary: |
An array of `Class.Pose|Poses`.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Animation
- name: Keyframe:RemoveMarker
summary: |
Removes a `Class.KeyframeMarker` from the `Class.Keyframe` by settings its
`Class.Instance.Parent` to `nil`.
description: |
This function removes a `Class.KeyframeMarker` from the `Class.Keyframe`
by settings its `Class.Instance.Parent` to `nil`.
The KeyframeMarker's `Class.Instance.Parent` is set to `nil` but 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
`Class.Keyframe` names do not need to be unique. For example, if an
Animation has three keyframes named "Particles" the connected event
returned by `Class.AnimationTrack:GetMarkerReachedSignal()` will fire each
time one of these keyframes is reached.
`Class.Keyframe` names can be set in the Roblox Animation Editor when
creating or editing an animation. They cannot however be set by a
`Class.Script` on an existing animation prior to playing it.
See also:
- `Class.Keyframe:AddMarker()`
- `Class.Keyframe:GetMarkers()`
- `Class.AnimationTrack:GetMarkerReachedSignal()`
code_samples:
- add-marker-remove-marker
parameters:
- name: marker
type: Instance
default:
summary: |
The marker being removed from the `Class.Keyframe`.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Animation
- name: Keyframe:RemovePose
summary: |
Removes a `Class.Pose` from the `Class.Keyframe` by setting its
`Class.Instance.Parent` to `nil`.
description: |
This function removes a `Class.Pose` from the `Class.Keyframe` by setting
its `Class.Instance.Parent` to `nil` without 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
`Class.Pose` is given as the pose parameter.
code_samples:
- Keyframe-Add-Remove-Pose
parameters:
- name: pose
type: Instance
default:
summary: |
The `Class.Pose` to be removed.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Animation
events: []
callbacks: []