Hand-written by Joseph San Nicolas, Roblox Developer
FloatCurveKey
Constructors
| Name | Description |
| new(time: number,value: number,Interpolation: KeyInterpolationMode) | Creates a new FloatCurveKey at the given time and value. Interpolation defaults to Enum.KeyInterpolationMode.Cubic when omitted. LeftTangent and RightTangent are left uninitialized; an effective value of 0 is used for them during curve evaluation. |
Code Snippet
local curve = Instance.new("FloatCurve")
curve:SetKeys({
FloatCurveKey.new(0, 0, Enum.KeyInterpolationMode.Linear),
FloatCurveKey.new(1, 10, Enum.KeyInterpolationMode.Cubic),
})
print(curve:GetKeyAtIndex(2).Value) --> 10
Properties
| Name | Type | Description |
| Time | number | The time position of this FloatCurveKey along the curve's timeline. Default is 0. Keys are kept sorted in ascending time order; inserting a key at an existing time replaces it. |
| Value | number | The numerical output value at this key's position on the curve. Default is 0. |
| Interpolation | KeyInterpolationMode | The interpolation mode (Constant, Linear, or Cubic) used for the curve segment that begins at this key. Default is Cubic. Switching to a non-Cubic mode automatically clears RightTangent. |
| RightTangent | number | The slope of the curve leaving this key toward the next key. Default is nil (an effective value of 0 is used). Can only be set when Interpolation is Cubic. |
| LeftTangent | number | The slope of the curve arriving at this key from the previous key. Default is nil (an effective value of 0 is used). Can be set on a key with any interpolation mode. |