Exemple #1
0
        public virtual void FadeTo(RGBColor dest, double time, bool blocking = true)
        {
            if (blocking)
            {
                RGBColor start = this.Color;

                int tstart = System.Environment.TickCount;
                int tend   = tstart + (int)Math.Round(time * 1000.0);
                int t      = tstart;

                while (t < tend)
                {
                    float x = ((float)(t - tstart) / (float)(tend - tstart));
                    this.Color = RGBColor.Interpolate(start, dest, x);

                    System.Threading.Thread.Sleep(1000 / 60);
                    t = System.Environment.TickCount;
                }
            }


            Color = dest;
        }