예제 #1
0
        private void Update()
        {
            int elapseTime = (int)(Time.smoothDeltaTime * 1000);

            TaskLite.Update(elapseTime);
            TweenLite.Update(elapseTime);

            OnUpdate?.Invoke(elapseTime);
        }
예제 #2
0
        public static TweenLite To(Vector2 from, Vector2 to, float duration, TweeningFunction tweeningFunction, Action <Vector2> onupdate, Action onend = null)
        {
            float _x      = 0;
            var   _xTween = TweenLite.To(from.x, to.x, duration, tweeningFunction, v => _x = v);
            var   _yTween = TweenLite.To(from.y, to.y, duration, tweeningFunction, _y => onupdate?.Invoke(new Vector2(_x, _y)), onend);

            _yTween.BeforeRelease += () =>
            {
                _xTween.Release();
            };

            return(_yTween);
        }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="from">起始值</param>
 /// <param name="to">结束值</param>
 /// <param name="duration">缓动时间(单位:毫秒)</param>
 /// <param name="tweeningFunction">缓动方式</param>
 /// <param name="onupdate">
 /// 每帧Update的回调
 /// 参数 float 标示当前的插值
 /// </param>
 /// <param name="onend">缓动结束时的回调</param>
 /// <returns></returns>
 public static TweenLite To(float from, float to, float duration, TweeningFunction tweeningFunction, Action <float> onupdate, Action onend = null)
 {
     lock (m_tasklock)
     {
         var tween = new TweenLite(from, to, duration, tweeningFunction, onupdate);
         if (onend != null)
         {
             tween.Ended += () => { onend(); }
         }
         ;
         m_tweeners.Add(tween);
         return(tween);
     }
 }
예제 #4
0
        public static TweenLite To(Color from, Color to, float duration, TweeningFunction tweeningFunction, Action <Color> onupdate, Action onend = null)
        {
            float r       = 0;
            float g       = 0;
            float b       = 0;
            var   _rTween = TweenLite.To(from.r, to.r, duration, tweeningFunction, v => r = v);
            var   _gTween = TweenLite.To(from.g, to.g, duration, tweeningFunction, v => g = v);
            var   _bTween = TweenLite.To(from.b, to.b, duration, tweeningFunction, v => b = v);
            var   _aTween = TweenLite.To(from.a, to.a, duration, tweeningFunction, a => onupdate?.Invoke(new Color(r, g, b, a)), onend);

            _aTween.BeforeRelease += () =>
            {
                _rTween.Release();
                _gTween.Release();
                _bTween.Release();
            };

            return(_aTween);
        }