Skip to content

LuchunPen/TweenAnimator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tween animator

It's a DoTween wrapper for configuring simple animations in the inspector (mainly designed for UI)

Install via UPM (with Package Manager UI)

Click Window > Package Manager to open Package Manager UI. Click + > Add package from git URL... and input the repository URL: https://github.com/LuchunPen/TweenAnimator.git?path=Packages/src

Image alt

Supports parrallel and sequence animations in any combinations. All of the animations are inherited from AnimationBase class.

Image alt

Animation example:

public class TweenAnimationScale : TweenAnimation
{
    [Space(10)]
    [SerializeField] private Transform _trans;
    [SerializeField] private float _startValue;
    [SerializeField] private float _endValue;
    
    protected override void UpdateAnimator()
    {
        float scale =  _startValue + (_tweenerValue * (_endValue - _startValue));
        _trans.localScale = new Vector3(scale, scale, scale);
    }
}

How to use:

public class Test_TweenAnimationController : MonoBehaviour
{
    [SerializeField] private AnimationBase _anim;

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q))
        {
            _anim.ResetAnimation();
            _anim.PlayAnimation(OnComplete);
        }

        if (Input.GetKey(KeyCode.E))
        {
            _anim.StopAnimation();
        }
    }

    private void OnComplete()
    {
        UnityEngine.Debug.Log("Complete animation");
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages