Revision Difference
math.ease#546483
<type name="math.ease" category="libraryfunc" is="library">
<summary>An easing library that allows you to interpolate with various kinds of smoothing [functions](https://easings.net/). To use with <page>Global.Lerp</page>, input what you would to the fraction argument in one of these easing functions and then the output of that into the <page>Global.Lerp</page> fraction argument.
<example>
<description>Example usage with Lerp and <page>math.ease.InSine</page></description>
<code>
local easedFraction = math.ease.InSine(.25) --25% progress is now eased in using sine.⤶
⤶
print(Lerp(.25, 0, 1))
print(Lerp(easedFraction, 0, 1))
print(Lerp(.25, 0, 5))⤶
print(Lerp(easedFraction, 0, 5))⤶
-- Define a wrapper function to make it easier to work with⤶
local function easedLerp(fraction, from, to)
return Lerp(math.ease.InSine(fraction), from, to)
end⤶
⤶
-- Compare with the non-eased version of Lerp⤶
print(easedLerp(0.25, 0, 1))⤶
print(Lerp(0.25, 0, 1))⤶
⤶
print(easedLerp(0.25, 0, 5))⤶
print(Lerp(0.25, 0, 5))⤶
</code>
<output>
```⤶
0.076120467488713⤶
0.25
0.07612...⤶
⤶
0.38060233744357⤶
1.25
0.38060...⤶
```⤶
</output>
</example>
</summary>
</type>