Data type
FloatCurveKey
A time-value pair used with FloatCurve instances.
About FloatCurveKey
A time-value pair used with FloatCurve 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
FloatCurveKey.new
(time: number, value: number, Interpolation: KeyInterpolationMode)Returns a newFloatCurveKeyfrom the given time and value.
Properties 5
Interpolation
: KeyInterpolationModeThe key interpolation mode for the segment started by thisFloatCurveKey.Specifies the interpolation mode used for the curve segment that begins at this key and ends at the next key on the
FloatCurve. Each segment of the curve can use a different interpolation mode. The default value isKeyInterpolationMode.Cubic.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.
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 thisFloatCurveKey.The time position of this
FloatCurveKeyalong the curve's timeline. The default value is0. Keys within aFloatCurveare kept sorted in ascending time order; if you insert a key at a time that already exists on the curve, the existing key at that time is replaced.Value
: numberThe value of thisFloatCurveKey.The numerical output value at this key's position on the curve. The default value is
0. When aFloatCurveis sampled at this key'sTime, the curve evaluates to this value (subject to any interpolation with neighboring keys depending on the sampling time).RightTangent
: numberThe tangent to the right of thisFloatCurveKey.The slope of the curve leaving this key toward the next key. The default value is
nil, which means the tangent is automatically computed (an effective value of0is used during evaluation). This property can only be set whenInterpolationisKeyInterpolationMode.Cubic; attempting to set it on a key with Constant or Linear interpolation raises a runtime error. Pairing a different RightTangent value on this key with a differentLeftTangentvalue on the next key creates a discontinuity in slope (a "corner") at the next key.LeftTangent
: numberThe tangent to the left of thisFloatCurveKey.The slope of the curve arriving at this key from the previous key. The default value is
nil, which means the tangent is automatically computed (an effective value of0is used during evaluation). UnlikeRightTangent, this property can be set on a key with any interpolation mode, because the preceding segment may itself use cubic interpolation and therefore needs a defined left tangent at this endpoint.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.