Beispiel #1
0
 /// <summary>
 /// Create a generator of smooth transition between colors.
 /// </summary>
 /// <param name="initial">Initial color.</param>
 /// <param name="final">Final color.</param>
 /// <returns>Color transition generator.</returns>
 private IEnumerator <Color> smoothFader(Color initial, Color final)
 {
     for (int x = 0; x <= TransitionFrames; x++)
     {
         double alpha = Util.SmoothTransition((double)x / TransitionFrames);
         yield return(Color.Lerp(initial, final, (float)alpha));
     }
 }
Beispiel #2
0
        /// <summary>
        /// Create a generator of smooth transition between target position.
        /// </summary>
        /// <param name="initial">Initial position.</param>
        /// <param name="final">Final position.</param>
        /// <returns>Transition generator.</returns>
        private IEnumerator <double[]> smoothTranslater(double[] initial, double[] final)
        {
            if (final == null)
            {
                yield break;
            }

            for (int x = 0; x <= TransitionFrames; x++)
            {
                double alpha = Util.SmoothTransition((double)x / TransitionFrames);
                yield return((1 - alpha).Multiply(initial).Add(alpha.Multiply(final)));
            }
        }