# Easing Functions

Easing functions are common in computer animation; you might know them from Tweening libraries which expose them as options such as "EaseInOutCubic". An easing function takes an input, normalizes it into a 0 to 1 range, and provides an output that conforms to a mathematical curve. In a shader, easing functions are often used as forms of contrast control, and you have likely used them already without realizing it.

To understand what a given function does, it's easiest to graph them out. We can do this easily in a shader by performing a step operation on the U and V texture coordinates.

The step node compares the two inputs and outputs 1 if the first input is greater, or 0 if it is not. The step of the U vs. the V visualizes a linear easing function (in other words, an easing function which performs no changes to the input data).

Now lets use our first easing function, which you may have heard called an "EaseIn" by many tweening libraries. This function is also know as the Power function:

Graphed out we can see this produces a nice curve. Note that we can easily produce an "EaseOut" curve by applying a OneMinus to the input data before running it through the Power function, and we can increase or decrease the strength of the curve using the exponent input of the Power function. Note that many tweening libraries refer to different exponent values as different easing functions, such as "EaseInCubic" or "EaseInQuintic", but the only difference between many of these functions is the value passed into the exponent of the Power node.

A common use case for easing functions is the adjustment of contrast. Here you can see a comparison between the texture which has been computed with a power of 2 and the regular texture output: