AnimationCurve
The AnimationCurve class represents a curve that defines the interpolation between keyframes over time. It's commonly used in animation systems to define smooth transitions between different values over time.
Properties
The number of keys in the curve. (Read Only)
Methods
Interpolates the value from the curve at a given time point. The curve is evaluated, giving the value of the curve at that exact time. This becomes very handy when lerping between two values in a non-linear way for smoother transitions.
Parameters
time
The time at which to evaluate the curve.
Returns
Returns the value of the curve at the specified time.
Tool designed to insert a new key into your AnimationCurve. A way to dynamically shape your animation by adding keyframes at certain times with specific values.
Parameters
time
The time at which the new key should be inserted.
value
The value of the new key at the specified time.
Returns
Returns the index of the added key, or of the existing key if one already exists at the given time.
Erase all keys from the AnimationCurve. It can be beneficial when you need to reset the curve or want to dynamically generate a new one.
Returns
This method does not return a value.
Removes the key at a specified index from your AnimationCurve. Varying curves dynamically can lead to interesting gameplay possibilities and variation in animations.
Parameters
index
The index of the key you want to remove.
Returns
This method does not return a value.
Updates the tangent of a key in the AnimationCurve to create a smooth transition in the curve. This becomes essential while crafting natural and organic animations.
Parameters
index
The index of the key to update.
weight
How much influence the tangent has. A weight of 0 will make the tangent flat.
Returns
This method does not return a value.
Copies all settings, including all keys from the given curve. This can prove useful when you want to duplicate the behavior of an existing curve.
Parameters
other
AnimationCurveThe source AnimationCurve to copy from.
Returns
This method does not return a value.
Creates a new AnimationCurve where all values are the same (constant). This can come in handy when creating a stable, unchanging behavior.
Parameters
timeStart
The starting time of the curve.
timeEnd
The ending time of the curve.
value
The constant value for the curve.
Returns
Returns a new AnimationCurve with a constant value.
Creates a new AnimationCurve representing a linear interpolation between a start and end value (valueStart and valueEnd) over a specified time period (timeStart to timeEnd). This is particularly useful when a linear transition between two states is required over a given duration.
Parameters
timeStart
The starting time of the curve.
valueStart
The value of the curve at the start time.
timeEnd
The ending time of the curve.
valueEnd
The value of the curve at the end time.
Returns
Returns a new AnimationCurve representing a linear interpolation.
Creates a new AnimationCurve that smoothly transitions between the start and end values over a specified time period. This method is especially useful to create animations with smooth starts and ends, providing a more natural look.
Parameters
timeStart
The starting time of the curve.
valueStart
The value of the curve at the start time.
timeEnd
The ending time of the curve.
valueEnd
The value of the curve at the end time.
Returns
Returns a new AnimationCurve with smooth transitions at start and end.