Beispiel #1
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);
        }
Beispiel #2
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);
        }