Class AnimationCurveExtension
Provides extension methods for the AnimationCurve class.
public static class AnimationCurveExtension
Inheritance
Methods
EvaluateTime(AnimationCurve, float, float, float, float)
Finds the time on the AnimationCurve at which the curve evaluates to the specified target value. Uses a binary search approach, assuming the curve is monotonic (strictly increasing or decreasing) within the search interval.
public static float EvaluateTime(this AnimationCurve curve, float targetValue, float startTime = -1, float endTime = -1, float elipson = 0.001)
Parameters
| Name | Type | Description |
|---|---|---|
curve | AnimationCurve | The animation curve to evaluate. |
targetValue | float | The value on the curve you want to find the corresponding time for. |
startTime | float | Optional start time for the search interval; if negative, the curve's first key time is used. |
endTime | float | Optional end time for the search interval; if negative, the curve's last key time is used. |
elipson | float | The acceptable margin of error when matching the target value. |
Returns
float — The time at which the curve approximately reaches the target value, or -1 if no solution is found within the interval.
Remarks
This method works reliably only if the curve has a unique time for each value within the specified range.