Class LinearCurve<T>
An animation spline represented by a set of keyframes, each representing an endpoint of a linear curve.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
public class LinearCurve<T> : CurveBase<T> where T : new()
Type Parameters
|
T
The animated value type. |
Constructors
LinearCurve()
LinearCurve(LinearCurve<T>.Keyframe[])
Initializes a new instance of the LinearCurve<T> class.
Declaration
public LinearCurve(params LinearCurve<T>.Keyframe[] keyframes)
Parameters
|
LinearCurve.Keyframe<>[]
keyframes
The keyframes. |
LinearCurve(IEnumerable<LinearCurve<T>.Keyframe>)
Initializes a new instance of the LinearCurve<T> class.
Declaration
public LinearCurve(IEnumerable<LinearCurve<T>.Keyframe> keyframes)
Parameters
|
System.Collections.Generic.IEnumerable<LinearCurve.Keyframe<>>
keyframes
The keyframes. |
Fields
Keyframes
The keyframes collection. Can be directly modified but ensure to sort it after editing so keyframes are organized by ascending time value.
Declaration
[Serialize]
public LinearCurve<T>.Keyframe[] Keyframes
Field Value
|
LinearCurve.Keyframe<>[]
|
Methods
Evaluate(out T, Single, Boolean)
Evaluates the animation curve value at the specified time.
Declaration
public override void Evaluate(out T result, float time, bool loop = true)
Parameters
|
T
result
The interpolated value from the curve at provided time. |
|
System.Single
time
The time to evaluate the curve at. |
|
System.Boolean
loop
If true the curve will loop when it goes past the end or beginning. Otherwise the curve value will be clamped. |
Overrides
EvaluateKey(out LinearCurve<T>.Keyframe, Single, Boolean)
Evaluates the animation curve key at the specified time.
Declaration
public void EvaluateKey(out LinearCurve<T>.Keyframe result, float time, bool loop = true)
Parameters
|
LinearCurve.Keyframe<>
result
The interpolated key from the curve at provided time. |
|
System.Single
time
The time to evaluate the curve at. |
|
System.Boolean
loop
If true the curve will loop when it goes past the end or beginning. Otherwise the curve value will be clamped. |
FindKeys(Single, out Int32, out Int32)
Returns a pair of keys that can be used for interpolating to field the value at the provided time.
Declaration
public override void FindKeys(float time, out int leftKey, out int rightKey)
Parameters
|
System.Single
time
The time for which to find the relevant keys from. It is expected to be clamped to a valid range within the curve. |
|
System.Int32
leftKey
The index of the key to interpolate from. |
|
System.Int32
rightKey
The index of the key to interpolate to. |
Overrides
TransformTime(Single, Single)
Applies the linear transformation (scale and offset) to the keyframes time values.
Declaration
public override void TransformTime(float timeScale, float timeOffset)
Parameters
|
System.Single
timeScale
The time scale. |
|
System.Single
timeOffset
The time offset. |
Overrides
Trim(Single, Single)
Trims the curve keyframes to the specified time range.
Declaration
public override void Trim(float start, float end)
Parameters
|
System.Single
start
The time start. |
|
System.Single
end
The time end. |
Overrides
Operators
Implicit(LinearCurve<T> to Byte[])
Raw memory copy (used by scripting bindings - see MarshalAs tag).
Declaration
public static implicit operator byte[](LinearCurve<T> curve)
Parameters
|
LinearCurve<T>
curve
The curve to copy. |
Returns
|
System.Byte[]
The raw keyframes data. |
Implicit(Byte[] to LinearCurve<T>)
Raw memory copy (used by scripting bindings - see MarshalAs tag).
Declaration
public static implicit operator LinearCurve<T>(byte[] raw)
Parameters
|
System.Byte[]
raw
The raw keyframes data. |
Returns
|
LinearCurve<T>
The curve. |