Example #1
0
 public Tween(
     TweenMode mode,
     Func <float> valueGetter,
     Action <float> valueSetter,
     float value,
     EaseFunction.Ease easer,
     float millisecondsDuration,
     Action onStart  = null,
     Action onFinish = null) :
     this(mode, value, easer, millisecondsDuration, onStart, onFinish)
 {
     getCustomValue = valueGetter;
     setCustomValue = valueSetter;
 }
Example #2
0
        private Tween(TweenMode mode, float value, EaseFunction.Ease easer, float millisecondsDuration, Action onStart = null, Action onFinish = null)
        {
            OnStart     = onStart;
            OnFinish    = onFinish;
            Mode        = mode;
            IsReverse   = false;
            TargetValue = value;
            Ease        = easer;
            Eased       = Percent = 0;
            Duration    = millisecondsDuration;

            if (Mode == TweenMode.Loop || Mode == TweenMode.Yoyo || Mode == TweenMode.Restart)
            {
                IsRepeating = true;
            }

            if (millisecondsDuration <= 0)
            {
                throw new Exception($"[Tween]: Duration must be a positive integer. Setting from '{millisecondsDuration}'to 0 (zero).");
            }
        }
Example #3
0
 public Tween(TweenMode mode, TweenProperty property, float value, EaseFunction.Ease easer, float millisecondsDuration, Action onStart = null, Action onFinish = null) :
     this(mode, value, easer, millisecondsDuration, onStart, onFinish)
 {
     Property = property;
 }