Data type
ValueCurveKey
A time-value pair used with ValueCurve instances.
About ValueCurveKey
A time-value pair used with ValueCurve instances.
The Interpolation property dictates the
interpolation mode for the segment started by this key and ended by the next
key on the curve. Each segment may use a different interpolation mode.
The LeftTangent and
RightTangent properties apply to the
cubic interpolation mode and define the desired tangent (slope) at the key.
Different left and right values can be used to encode discontinuities in slope
at the key. Attempting to set a
RightTangent value on a key that doesn't
use the cubic interpolation mode will result in a runtime error. It is
possible to set the LeftTangent property
on any key, as it will be used should the preceding segment use cubic
interpolation.
Constructors 1
ValueCurveKey.new
(time: number, value: any, Interpolation: KeyInterpolationMode)Returns a newValueCurveKeyfrom the given time and value.
Properties 5
Interpolation
: KeyInterpolationModeThe key interpolation mode for the segment started by thisValueCurveKey.Specifies the interpolation mode used for the curve segment that begins at this key and ends at the next key on the
ValueCurve. Each segment of the curve can use a different interpolation mode. The default value isKeyInterpolationMode.Constant.The available modes are:
- Constant — the segment holds the value of this key until the next key.
- Linear — the segment linearly interpolates between this key's value and the next key's value.
- Cubic — the segment uses a cubic Hermite spline defined by this
key's
RightTangentand the next key'sLeftTangent.
Not all value types support Linear or Cubic interpolation. Non-numerical types such as strings, booleans, and enums revert to Constant interpolation regardless of this setting.
Changing this property to a non-cubic mode automatically clears the
RightTangentof this key, because only cubic segments use a right tangent.Time
: numberThe time position of thisValueCurveKey.The time position of this
ValueCurveKeyalong the curve. Defaults to0. Keys within aValueCurveare stored sorted by their time values; the time determines where in the animation timeline this key's value applies.Value
: anyThe value of thisValueCurveKey.The value stored in this
ValueCurveKey. Defaults tonil. Can hold any supported Luau type, including numbers, booleans, strings,Vector2,Vector3,CFrame,UDim,UDim2,NumberRange,NumberSequence,ColorSequence, and enums. All keys on a singleValueCurvemust hold values of the same type; attempting to insert a key whose value type differs from existing keys produces an error.RightTangent
: numberThe tangent to the right of thisValueCurveKey.The outgoing tangent (slope) at this key, used when the
InterpolationisKeyInterpolationMode.Cubic. Defaults tonil(unset); when unset, an effective tangent of0is used during curve evaluation. Attempting to set this property on a key whose interpolation mode is not Cubic throws a runtime error. This property is automatically cleared whenInterpolationis changed to a non-cubic mode.LeftTangent
: numberThe tangent to the left of thisValueCurveKey.The incoming tangent (slope) at this key, used when the preceding segment uses
KeyInterpolationMode.Cubicinterpolation. Defaults tonil(unset); when unset, an effective tangent of0is used during curve evaluation. UnlikeRightTangent, this property can be set on any key regardless of its own interpolation mode, because it defines the slope at the endpoint of the preceding cubic segment.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.