https://github.com/hexdogstudio/ease-function-kit
Set of Ease Function for Unity
https://github.com/hexdogstudio/ease-function-kit
extension math unity
Last synced: about 2 months ago
JSON representation
Set of Ease Function for Unity
- Host: GitHub
- URL: https://github.com/hexdogstudio/ease-function-kit
- Owner: hexdogstudio
- License: mit
- Created: 2024-10-18T20:32:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-03-04T15:05:12.000Z (4 months ago)
- Last Synced: 2026-04-25T23:37:51.087Z (2 months ago)
- Topics: extension, math, unity
- Language: C#
- Homepage:
- Size: 59.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ease Function Kit | Unity
This implementation provides a simple set of easing functions for various speed modifications in Unity. Easing functions are commonly used in animations to create smooth transitions and control the rate of change over time, allowing for effects like acceleration, deceleration, and oscillation. These native C# implementations are adapted from examples available on [Easings.net](https://easings.net/), a popular resource for visualizing and understanding easing curves. The functions are designed to work seamlessly with Unity’s animation and movement systems, giving developers the ability to easily apply different types of motion, such as linear, quadratic, cubic, and elastic, to their game objects or UI elements. These easing functions are ideal for fine-tuning animations, transitions, and movement behaviors in games or interactive applications.
## Installation Guide
Dowload the latest `.unitypackage` from the repository at `/Packages` folder.
To import a local asset package in Unity:
1. Open the project in the Editor where you want to import the asset package.
2. Choose `Assets` > `Import Package` > `Custom Package`. A file browser appears, prompting you to locate the `.unitypackage` file.
3. In the file browser, select the file you want to import and click `Open`. The Import Unity Package window displays all the items in the package already selected, ready to install.
## Easing Functions
- [InExpo](https://easings.net/#easeInExpo)
- [OutExpo](https://easings.net/#easeOutExpo)
- [InOutExpo](https://easings.net/#easeInOutExpo)
- [InBack](https://easings.net/#easeInBack)
- [OutBack](https://easings.net/#easeOutBack)
- [InOutBack](https://easings.net/#easeInOutBack)
- [InSine](https://easings.net/#easeInSine)
- [OutSine](https://easings.net/#easeOutSine)
- [InOutSine](https://easings.net/#easeInOutSine)
- [InCubic](https://easings.net/#easeInCubic)
- [OutCubic](https://easings.net/#easeOutCubic)
- [InOutCubic](https://easings.net/#easeInOutCubic)
- [InQuint](https://easings.net/#easeInQuint)
- [OutQuint](https://easings.net/#easeOutQuint)
- [InOutQuint](https://easings.net/#easeInOutQuint)
- [InCirc](https://easings.net/#easeInCirc)
- [OutCirc](https://easings.net/#easeOutCirc)
- [InOutCirc](https://easings.net/#easeInOutCirc)
- [InElastic](https://easings.net/#easeInElastic)
- [OutElastic](https://easings.net/#easeOutElastic)
- [InOutElastic](https://easings.net/#easeInOutElastic)
- [InQuad](https://easings.net/#easeInQuad)
- [OutQuad](https://easings.net/#easeOutQuad)
- [InOutQuad](https://easings.net/#easeInOutQuad)
- [InQuart](https://easings.net/#easeInQuart)
- [OutQuart](https://easings.net/#easeOutQuart)
- [InOutQuart](https://easings.net/#easeInOutQuart)
## Example of Usage
Instead of the direct value of `t / time`, we may use the output of the `Calc` function to simulate a more organic acceleration. In the example we used the `OutBack` acceleration function.
```cs
[SerializeField] private EaseCurve curve = new EaseCurve(Ease.Type.OutBack);
private IEnumerator ScaleTween(Vector2 from, Vector2 to, float time)
{
float t = 0.0f;
while (t < time)
{
t += Time.deltaTime;
transform.localScale = Vector2.LerpUnclamped(from, to, curve.Calc(t / time));
yield return null;
}
transform.localScale = to;
}
```
> [!Note]
> Some curves like `OutBack` may overshoot the the range of `[0.0, 1.0]`. In these cases you should use `LerpUnclamped` instead of `Lerp`.
## License
- [MIT](https://choosealicense.com/licenses/mit/)