Exemplo n.º 1
0
        /// <summary>
        ///     Static constructor adds lightning bolts in different colors to both frames
        /// </summary>
        static CrashAnimation()
        {
            var newFrames = new List <ColorScheme>();

            var red    = new ColorScheme(Color.red);
            var yellow = new ColorScheme(Color.yellow);

            // Generate first few frames
            newFrames.AddRange(AnimationUtils.InterpolateFrames(red, yellow, 3));
            // Add the way back to the original
            newFrames.AddRange(newFrames.ToArray().Reverse());
            // Double it
            newFrames.AddRange(newFrames.ToArray());
            // Quadruple it
            newFrames.AddRange(newFrames.ToArray());
            // Octuple it
            newFrames.AddRange(newFrames.ToArray());

            for (var i = 0; i < 30; i++)
            {
                newFrames.Add(AnimationUtils.CircularSineWave(Color.red, Color.yellow, i));
            }

            newFrames.AddRange(AnimationUtils.InterpolateFrames(newFrames.Last(), new ColorScheme(Color.black), 10));

            frames = newFrames.ToArray();
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Helper method that generates all animation frames.
        /// </summary>
        /// <returns></returns>
        private static ColorScheme[] GenerateAnimationFrames()
        {
            // Init with sine wave
            var myReturn = new ColorScheme[40];

            for (var i = 0; i < myReturn.Length; i++)
            {
                myReturn[i] = AnimationUtils.CircularSineWave(new Color(0f, 0f, .2f), new Color(.3f, .3f, 1f), i);
            }

            return(myReturn);
        }