Easing
Provides easing functions for various predefined equations and customizable functions as well.
- namespace Easing
class EasingFunction[link]
Embodies an easing equation.
Fields
new EasingFunction(functionPointer, intervals)[link]
Creates a new EasingFunction instance based on a custom equation. The function is sampled at even intervals to create a lookup table for optimal speed. This allows for fast run-time computations of easing for potentially complex equations.
Arguments
Name | Type | Optional | Description |
---|---|---|---|
functionPointer | function | A function that takes in a float value from 0 to 1 and returns a value typically in the range of 0 to 1, although it can go out of that range e.g. to achieve springiness. |
|
intervals | integer | Optional | The number of intervals to sample the given function. Default value is 100. |
function ease(start, end, current, duration, useIntegers)[link]
Interpolates the value by using a compound function of the easeOut and easeIn functions.
Arguments
Name | Type | Optional | Description |
---|---|---|---|
start | float | A starting value |
|
end | float | An ending value |
|
current | float | The current point in time |
|
duration | float | The length of the interpolation timeline |
|
useIntegers | boolean | Optional | If true, the output will be rounded to the closest integer. Default value is false. |
function easeIn(start, end, current, duration, useIntegers)[link]
Interpolate two values by evaluating the easing function from 0 to 1
Arguments
Name | Type | Optional | Description |
---|---|---|---|
start | float | A starting value |
|
end | float | An ending value |
|
current | float | The current point in time |
|
duration | float | The length of the interpolation timeline |
|
useIntegers | boolean | Optional | If true, the output will be rounded to the closest integer. Default value is false. |
function easeOut(start, end, current, duration, useIntegers)[link]
Interpolate two values by evaluating the easing function backwards from 1 to 0 and then transposing the output by subtracting it from 1.
Arguments
Name | Type | Optional | Description |
---|---|---|---|
start | float | A starting value |
|
end | float | An ending value |
|
current | float | The current point in time |
|
duration | float | The length of the interpolation timeline |
|
useIntegers | boolean | Optional | If true, the output will be rounded to the closest integer. Default value is false. |