Hand-written by Joseph San Nicolas, Roblox Developer
RotationCurveKey
Constructors
| Name | Description |
| new(time: number,cframe: CFrame,interpolation: Enum.KeyInterpolationMode) | Creates a new RotationCurveKey at the given time with the given CFrame - only the rotational component of the CFrame is used, the position is ignored. LeftTangent and RightTangent are left uninitialized, and a tangent value of 0 is used when evaluating the curve unless set explicitly. interpolation sets the mode for the segment that starts at this key and defaults to Enum.KeyInterpolationMode.Cubic. |
Code Snippet
local rotationCurve = Instance.new("RotationCurve")
local key1 = RotationCurveKey.new(0, CFrame.identity, Enum.KeyInterpolationMode.Cubic)
local key2 = RotationCurveKey.new(1, CFrame.Angles(0, math.rad(180), 0), Enum.KeyInterpolationMode.Cubic)
rotationCurve:SetKeys({key1, key2})
Properties
| Name | Type | Description |
| Interpolation | Enum.KeyInterpolationMode | Defines the interpolation mode for the curve segment that begins at this key and ends at the next key. Constant holds this key's value until the next key, Linear uses spherical linear interpolation, and Cubic uses a hermite spline shaped by this key's RightTangent and the next key's LeftTangent. Defaults to Cubic. Setting this to a non-Cubic mode automatically clears RightTangent. |
| Time | number | The time position of this key along the curve's timeline, in seconds. Keys are kept sorted by ascending time; inserting a key at an existing time replaces it. Defaults to 0. |
| Value | CFrame | The rotation stored at this key, represented as a CFrame. Only the rotational component is used - the positional component is ignored. Defaults to CFrame.identity. |
| RightTangent | number | The outgoing tangent (slope) at this key, controlling the shape of the cubic segment extending toward the next key. Can only be set when Interpolation is Cubic; setting it otherwise raises a runtime error. Defaults to 0, and returns nil if not explicitly assigned. |
| LeftTangent | number | The incoming tangent (slope) at this key, controlling the shape of the cubic segment arriving from the previous key. Can be set regardless of this key's own interpolation mode. Defaults to 0, and returns nil if not explicitly assigned. |