MinimalEasing is a UniTask friendly minimal easing library for Unity.
public class MinimalEasingSample : MonoBehaviour
{
private void Start()
{
RunAsync(destroyCancellationToken).Forget();
}
private async UniTaskVoid RunAsync(CancellationToken cancellationToken)
{
while (!cancellationToken.IsCancellationRequested)
{
await foreach (var t in Easing.LinearAsyncEnumerable(0.5f, cancellationToken: cancellationToken))
{
transform.position = Easing.InOutQuad(t) * Vector3.right;
}
await foreach (var t in Easing.LinearAsyncEnumerable(0.5f, cancellationToken: cancellationToken))
{
transform.position = Vector3.right + Easing.InSine(t) * Vector3.up;
}
await foreach (var t in Easing.LinearAsyncEnumerable(0.5f, cancellationToken: cancellationToken))
{
transform.position = Vector3.right + Vector3.up + Easing.OutExpo(t) * Vector3.left;
}
await foreach (var t in Easing.LinearAsyncEnumerable(0.5f, cancellationToken: cancellationToken))
{
transform.position = Vector3.up + Easing.InQuint(t) * Vector3.down;
}
}
}
}
MinimalEasing supports UPM.
Write this snippets to manifest.json
"com.notargs.minimal-easing": "[email protected]:notargs/MinimalEasing.git?path=/Packages/MinimalEasing#0.0.2"
MIT License