Interpolator
Easing functions that remap a value between 0 and 1 along a curve.
Read time 3 minutesLast updated 3 hours ago
Definition
- Type: Class
- Namespace: Unity.Animations
- Assembly: UnityEngine.AnimationCoreModule
[BurstCompile]public static class Interpolator
Remarks
An easing function remaps an input value from 0 to 1 to an output value from 0 to 1, and its curve controls how fast the output changes. Each function maps the input 0 to the output 0, and the input 1 to the output 1.
Ease-in functions, such as Interpolator.QuadraticIn, start slowly and accelerate. Ease-out functions, such as Interpolator.QuadraticOut, start quickly and slow down. Ease-in-out functions, such as Interpolator.QuadraticInOut, start and end slowly. The sine-based functions, Interpolator.SineIn, Interpolator.SineOut, and Interpolator.SineInOut, use a fast approximation of the sine and cosine functions.
Call Interpolator.Evaluate to choose the function with a Interpolator.FunctionType value. clamps its input to the range from 0 to 1. The individual functions don't clamp their input, and some are only valid for a smaller or larger range, which their remarks list.
EvaluateStatic Methods
Method | Description |
|---|---|
| CircularIn | Interpolation function modeled after shifting quadrant IV of a unit circle. |
| CircularInOut | Interpolation function modeled after the piecewise circular function: y = (1/2)(1 - sqrt(1 - 4x^2)) : [0, 0.5] y = (1/2)(sqrt(-(2x - 3)*(2x - 1)) + 1) : (0.5, 1] |
| CircularOut | Interpolation function modeled after shifting quadrant II of a unit circle. |
| CubicIn | Interpolation function modeled after the cubic y = x^3. |
| CubicInOut | Interpolation function modeled after the piecewise cubic: y = (1/2)((2x)^3) : [0, 0.5] y = (1/2)(1 + (1-(1-(2x-1))^3)) : (0.5, 1] |
| CubicOut | Interpolation function modeled after the cubic y = 1 + (x - 1)^3. |
| Evaluate | Interpolates value of x based on specified interpolation function type. |
| ExponentialIn | Interpolation function modeled after the exponential y = 2^(10(x - 1)). |
| ExponentialInOut | Interpolation function modeled after the piecewise exponential y = (1/2)2^(10(2x - 1)) : [0, 0.5] y = -(1/2)*2^(-10(2x - 1)) + 1 : (0.5, 1] |
| ExponentialOut | Interpolation function modeled after the exponential y = 1 - 2^(-10x). |
| Linear | Interpolation function modeled after the line y = x. |
| QuadraticIn | Interpolation function modeled after the parabola y = x^2. |
| QuadraticInOut | Interpolation function modeled after the piecewise quadratic: y = (1/2)((2x)^2) : [0, 0.5] y = (1/2)(1 + (1-(1-(2x-1))^2)) : (0.5, 1] |
| QuadraticOut | Interpolation function modeled after the parabola y = 1 - (1 - x)^2. |
| QuarticIn | Interpolation function modeled after the quartic y = x^4. |
| QuarticInOut | Interpolation function modeled after the piecewise quartic: y = (1/2)((2x)^4) : [0, 0.5] y = (1/2)(1 + (1-(1-(2x-1))^4)) : (0.5, 1] |
| QuarticOut | Interpolation function modeled after the quartic y = 1 - (x - 1)^4. |
| QuinticIn | Interpolation function modeled after the quintic y = x^5. |
| QuinticInOut | Interpolation function modeled after the piecewise quintic: y = (1/2)((2x)^5) : [0, 0.5] y = (1/2)(1 + (1-(1-(2x-1))^5)) : (0.5, 1] |
| QuinticOut | Interpolation function modeled after the quintic y = 1 + (x - 1)^5. |
| SineIn | Interpolation function modeled after the quarter-cycle of a shifted sine wave. |
| SineInOut | Interpolation function modeled after a half sine wave. |
| SineOut | Interpolation function modeled after the quarter-cycle of a shifted sine wave. |
| SmoothStep | Interpolation function modeled after the smoothstep curve y = 3x^2 - 2x^3. |
Enums
Enum | Description |
|---|---|
| Interpolator.FunctionType | Options for the easing curve that is applied to a value. |