Skip to content

Latest commit

 

History

History
53 lines (43 loc) · 1.67 KB

README.md

File metadata and controls

53 lines (43 loc) · 1.67 KB

MinimalEasing

MinimalEasing is a UniTask friendly minimal easing library for Unity.

Example

record

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;
            }
        }
    }
}

UPM Package

MinimalEasing supports UPM. Write this snippets to manifest.json

"com.notargs.minimal-easing": "git@github.com:notargs/MinimalEasing.git?path=/Packages/MinimalEasing#0.0.2"

License

MIT License