ValueCurveKey

Constructors

NameDescription
new(time: number,value: any,Interpolation: KeyInterpolationMode)Creates a new ValueCurveKey at the given time and value. Interpolation defaults to Enum.KeyInterpolationMode.Constant if omitted. LeftTangent and RightTangent start uninitialized and evaluate as 0 until set.

Code Snippet

local valueCurve = Instance.new("ValueCurve")

valueCurve:InsertKey(ValueCurveKey.new(0, Vector3.new(0, 0, 0), Enum.KeyInterpolationMode.Linear))
valueCurve:InsertKey(ValueCurveKey.new(1, Vector3.new(0, 10, 0), Enum.KeyInterpolationMode.Linear))

print(valueCurve:GetValueAtTime(0.5)) --> 0, 5, 0

Properties

NameTypeDescription
TimenumberThe time position of this ValueCurveKey along the curve. Defaults to 0. Keys are automatically sorted by time within a ValueCurve.
ValueanyThe value stored in this ValueCurveKey. Supports numbers, booleans, strings, Vector2, Vector3, CFrame, UDim, UDim2, NumberRange, NumberSequence, ColorSequence, and enums. All keys on a single ValueCurve must share the same value type. Defaults to nil.
InterpolationKeyInterpolationModeSpecifies the interpolation mode used for the curve segment that begins at this key. Defaults to Constant. Automatically clears RightTangent when changed to a non-cubic mode.
LeftTangentnumberThe incoming tangent (slope) at this key, used when the preceding segment uses Cubic interpolation. Can be set on any key regardless of its own interpolation mode. Defaults to unset, which evaluates as 0.
RightTangentnumberThe outgoing tangent (slope) at this key, used when this key's Interpolation is Cubic. Throws a runtime error if set while Interpolation is not Cubic. Defaults to unset, which evaluates as 0.