Class
RotationCurve
Represents a sequence of rotations and the interpolation curve between them.
This class holds a sorted list of
RotationCurveKeys that represent a sequence of
rotations. The shape of the interpolation curve between two keys is determined
by the RotationCurveKey.Interpolation type.
Properties 1#
Lengthint | Number of rotation keys in this curve.ReadSafeReadOnlyNotReplicated |
Length: int#
ReadOnlyNotReplicatedReadSafe
Number of rotation keys in this curve.
Methods 7#
| GetKeyAtIndex | Returns a copy of a key at a given index. |
| GetKeyIndicesAtTime | Returns the index of the last and first key of a period of time. |
| GetKeys | Returns a copy of all the keys in the rotation curve as a Luau array of
RotationCurveKeys. |
| GetValueAtTime | Samples the rotation curve at a given time and returns the corresponding
rotation as a CFrame. |
| InsertKey | Adds the key passed as an argument to this curve. If a key at the same time is found, it will be replaced. |
| RemoveKeyAtIndex | Removes a given number of keys starting from a given index. |
| SetKeys | Resets this curve's keys using the RotationCurveKey array
passed as an argument. |
GetKeyAtIndex(index: int): RotationCurveKey#
Returns a copy of a key at a given index.
| Name | Type | Default | Description |
|---|---|---|---|
index | int | Index of the key to return. |
Returns
RotationCurveKey— Copy of theRotationCurveKeystored atindex.
GetKeyIndicesAtTime(time: float): Array#
The first item in the returned array is the index of the last key with
time less than or equal to time (or the lesser of either 1 or the curve
length if no key was found). The second item in the returned array is the
index of the first key with time greater than or equal to time (or the
curve length if no key was found satisfying the inequality).
| Name | Type | Default | Description |
|---|---|---|---|
time | float | Time to look up within the curve. |
Returns
Array— Array with the indices of the keys that brackettime.
GetKeys(): Array#
Returns a copy of all the keys in the rotation curve as a Luau array of
RotationCurveKeys.
Returns
Array— Array ofRotationCurveKeys.
GetValueAtTime(time: float): CFrame?#
Samples the rotation curve at a given time and returns the corresponding
rotation as a CFrame. Empty rotation curves are evaluated as
CFrame.identity.
| Name | Type | Default | Description |
|---|---|---|---|
time | float | Time at which to sample the curve. |
Returns
CFrame?— Value of the curve at the requestedtime.
InsertKey(key: RotationCurveKey): Array#
Adds the key passed as an argument to this curve. If a key at the same
time is found, it will be replaced. In the returned array, the first value
is true if a key was added or false if a previous key was replaced;
the second value is the index at which the marker was added.
| Name | Type | Default | Description |
|---|---|---|---|
key | RotationCurveKey | RotationCurveKey to insert. |
Returns
Array— (see description) .
RemoveKeyAtIndex(startingIndex: int, count: int = 1): int#
Removes a given number (count) of keys starting from the startingIndex
index and returns the number of keys that were removed.
| Name | Type | Default | Description |
|---|---|---|---|
startingIndex | int | Starting index from which to remove keys. | |
count | int | 1 | Number of keys to remove. |
Returns
int— Number of keys removed.
SetKeys(keys: Array): int#
Resets this curve's keys using the RotationCurveKey array
passed as an argument. Keys in the keys array are sorted in ascending
time order before insertion, and keys at duplicated times are removed in a
stable manner.
Returns the number of keys actually inserted. Keys previously stored in this curve are removed before the keys passed as arguments are added.
| Name | Type | Default | Description |
|---|---|---|---|
keys | Array | Array of RotationCurveKeys. |
Returns
int— Number of keys inserted.
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild