Skip to content

notargs/MinimalEasing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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": "[email protected]:notargs/MinimalEasing.git?path=/Packages/MinimalEasing#0.0.2"

License

MIT License