-
Notifications
You must be signed in to change notification settings - Fork 0
AnimationCurve Extensions
Andrzej Kebab edited this page Jan 23, 2024
·
1 revision
This utility library, part of the AnimationCurveExtensions namespace, provides extension methods for Unity's AnimationCurve class. These methods enhance the functionality of working with animation curves, including checking for looping, obtaining maximum and minimum values, and reversing the curve.
Checks if the animation curve is looping.
// Example usage
AnimationCurve myCurve = /* Instantiate or reference an AnimationCurve */;
bool isLooping = myCurve.IsLooping();
Debug.Log($"Is the animation curve looping? {isLooping}");Parameters:
-
animationCurve(AnimationCurve): The animation curve to check.
Returns:
- bool: True if the animation curve is looping, false otherwise.
Gets the maximum value of the animation curve.
// Example usage
AnimationCurve myCurve = /* Instantiate or reference an AnimationCurve */;
float maxValue = myCurve.GetMaxValue();
Debug.Log($"Maximum value of the animation curve: {maxValue}");Parameters:
-
animationCurve(AnimationCurve): The animation curve to get the maximum value from.
Returns:
- float: The maximum value of the animation curve.
Gets the minimum value of the animation curve.
// Example usage
AnimationCurve myCurve = /* Instantiate or reference an AnimationCurve */;
float minValue = myCurve.GetMinValue();
Debug.Log($"Minimum value of the animation curve: {minValue}");Parameters:
-
animationCurve(AnimationCurve): The animation curve to get the minimum value from.
Returns:
- float: The minimum value of the animation curve.
Reverses the animation curve.
// Example usage
AnimationCurve myCurve = /* Instantiate or reference an AnimationCurve */;
myCurve.Reverse();
Debug.Log($"Reversed animation curve: {myCurve}");Parameters:
-
animationCurve(AnimationCurve): The animation curve to reverse.
Returns:
- void