Пример #1
0
 public MintTweener(MintGetter <T> mintGetter, MintSetter <T> mintSetter, MintTweenDataBase <T> mintTweenInfo)
 {
     _getter      = mintGetter;
     _setter      = mintSetter;
     TweenInfo    = mintTweenInfo;
     this.IsPause = true;
     register();
 }
Пример #2
0
        public static MintTweener <Color> Create(MintGetter <Color> mintGetter, MintSetter <Color> mintSetter, Color endvalue, float duration)
        {
            var mintTweenerInfo = new MintTweenDataBase <Color>()
            {
                EaseType   = MintEaseMethod.Linear,
                Duration   = duration,
                StartValue = mintGetter.Invoke(),
                EndValue   = endvalue
            };
            var a = new MintTweener <Color>(mintGetter, mintSetter, mintTweenerInfo);

            return(a);
        }
Пример #3
0
        public static MintTweener <Vector3> RotationTo(this Transform transform, Vector3 endRotation, float duration, MintEaseMethod easeTypoe = MintEaseMethod.Linear)
        {
            MintTweenDataBase <Vector3> tweenInfo = new MintTweenDataBase <Vector3>()
            {
                EaseType = easeTypoe,
                Duration = duration
            };

            tweenInfo.StartValue = transform.localRotation.eulerAngles;
            tweenInfo.EndValue   = endRotation;
            return(new MintTweener <Vector3>(() => transform.localEulerAngles,
                                             rValue => transform.localEulerAngles = rValue, tweenInfo));
        }
Пример #4
0
        public Vector3 GetProgress(float nowTime, MintTweenDataBase <Vector3> dataBase)
        {
            if (nowTime < 0)
            {
                nowTime = 0;
            }
            else if (nowTime > dataBase.Duration)
            {
                nowTime = dataBase.Duration;
            }

            if (!dataBase.IsCustomEase)
            {
                return(MintEaseAction.GetEaseAction(dataBase.EaseType, nowTime / dataBase.Duration) * (dataBase.EndValue - dataBase.StartValue) + dataBase.StartValue);
            }
            else
            {
                return(dataBase.TimeCurve.Evaluate(nowTime / dataBase.Duration) * (dataBase.EndValue - dataBase.StartValue) + dataBase.StartValue);
            }
        }