Beispiel #1
0
        /// <summary>
        /// Tweens the color to a new color.
        /// </summary>
        /// <param name="duration">Duration of the tween.</param>
        /// <param name="fromColor"></param>
        /// <param name="toColor">Start color.</param>
        /// <param name="ease">Optional easer function.</param>
        public void tween(float duration, Color fromColor, Color toColor, Easer ease = null)
        {
            Color = fromColor;
            uint from = FP.HexColor(fromColor);
            uint to   = FP.HexColor(toColor);

            _startR = FP.GetRed(from);
            _startG = FP.GetGreen(from);
            _startB = FP.GetBlue(from);

            _rangeR = FP.GetRed(to) - _startR;
            _rangeG = FP.GetGreen(to) - _startG;
            _rangeB = FP.GetBlue(to) - _startB;

            _target = duration;
            _ease   = ease;
            Start();
        }