Description
The QuadraticInOut
method provides a quadratic easing function that accelerates and decelerates the transition. It is part of the Easing
class in the Sandbox.Utility
namespace. This function is useful for creating smooth animations where the transition starts slowly, accelerates in the middle, and then slows down towards the end.
Usage
To use the QuadraticInOut
method, pass a single float
parameter f
that represents the normalized time (between 0 and 1) of the transition. The method returns a float
that represents the eased value at that point in time.
Ensure that the input value f
is clamped between 0 and 1 to avoid unexpected results.
Example
// Example usage of the QuadraticInOut easing function
float startValue = 0.0f;
float endValue = 1.0f;
float time = 0.5f; // Halfway through the transition
// Calculate the eased value
float easedValue = Easing.QuadraticInOut(time);
// Interpolate between start and end values using the eased value
float interpolatedValue = startValue + (endValue - startValue) * easedValue;
// interpolatedValue now holds the value at the midpoint of the transition with quadratic easing applied.