Documentation

Unity Engine

Download Unity

Unity Engine

Interpolator

Easing functions that remap a value between 0 and 1 along a curve.
Read time 3 minutesLast updated 3 hours ago

Definition

[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.
Evaluate
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.

Static Methods

Method

Description

CircularInInterpolation function modeled after shifting quadrant IV of a unit circle.
CircularInOutInterpolation 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]
CircularOutInterpolation function modeled after shifting quadrant II of a unit circle.
CubicInInterpolation function modeled after the cubic y = x^3.
CubicInOutInterpolation 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]
CubicOutInterpolation function modeled after the cubic y = 1 + (x - 1)^3.
EvaluateInterpolates value of x based on specified interpolation function type.
ExponentialInInterpolation function modeled after the exponential y = 2^(10(x - 1)).
ExponentialInOutInterpolation 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]
ExponentialOutInterpolation function modeled after the exponential y = 1 - 2^(-10x).
LinearInterpolation function modeled after the line y = x.
QuadraticInInterpolation function modeled after the parabola y = x^2.
QuadraticInOutInterpolation 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]
QuadraticOutInterpolation function modeled after the parabola y = 1 - (1 - x)^2.
QuarticInInterpolation function modeled after the quartic y = x^4.
QuarticInOutInterpolation 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]
QuarticOutInterpolation function modeled after the quartic y = 1 - (x - 1)^4.
QuinticInInterpolation function modeled after the quintic y = x^5.
QuinticInOutInterpolation 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]
QuinticOutInterpolation function modeled after the quintic y = 1 + (x - 1)^5.
SineInInterpolation function modeled after the quarter-cycle of a shifted sine wave.
SineInOutInterpolation function modeled after a half sine wave.
SineOutInterpolation function modeled after the quarter-cycle of a shifted sine wave.
SmoothStepInterpolation function modeled after the smoothstep curve y = 3x^2 - 2x^3.

Enums

Enum

Description

Interpolator.FunctionTypeOptions for the easing curve that is applied to a value.