Exemplo n.º 1
0
        public static void ColorSplosion(string Key, Color color, int spread = 5, int millDelay = 100, Color FadeTo = null)
        {
            if (FadeTo == null)
            {
                FadeTo = color;
            }

            FadeTo.R = (color.R - FadeTo.R) / spread;
            FadeTo.G = (color.G - FadeTo.G) / spread;
            FadeTo.B = (color.B - FadeTo.B) / spread;

            int[] KeyPos = KeyControl.GetKeyPos(Key);

            for (int i = 0; spread - i > 0; i++)
            {
                //for (int y=KeyPos[0]-i,x=KeyPos[1]-i; y <= KeyPos[0] + i;)
                //{
                //    KeyControl.SetKey(x, y, color);
                //    x++;
                //    if (x > KeyPos[1] + i) { x = KeyPos[1] - i; y++; }
                //}

                int dx = 1, dy = 0;

                for (int y = KeyPos[0] - i, x = KeyPos[1] - i; ;)
                {
                    KeyControl.SetKey(x, y, color);

                    x += dx;
                    y += dy;

                    if (x > KeyPos[1] + i)
                    {
                        dx = 0; dy = 1; x--;
                    }
                    if (y > KeyPos[0] + i)
                    {
                        dx = -1; dy = 0; y--;
                    }
                    if (x < KeyPos[1] - i)
                    {
                        dx = 0; dy = -1; x++;
                    }
                    if (y < KeyPos[0] - i)
                    {
                        break;
                    }
                }

                Thread.Sleep(millDelay);
                color.R -= FadeTo.R;
                color.G -= FadeTo.G;
                color.B -= FadeTo.B;
            }
        }
Exemplo n.º 2
0
        public static void RandomKeyColors(int repeat = 100, int millDelay = 5)
        {
            KeyControl.ResetBG();
            while (repeat > 0)
            {
                KeyControl.SetKey(rnd.Next(0, 21), rnd.Next(0, 6), new Color(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255)));
                Thread.Sleep(millDelay);

                repeat--;
            }
        }
Exemplo n.º 3
0
        public static void ShowText(string S)
        {
            Color col = null, prevCol = null;
            char  PrevC = 'c';
            bool  Clear = true;

            foreach (char C in S.ToUpper())
            {
                if (Clear)
                {
                    KeyControl.ResetBG(); Thread.Sleep(100); Clear = false;
                }

                while (col == prevCol)
                {
                    col = CPalette[rnd.Next(0, CPalette.Length)];
                }

                if (PrevC != 'c')
                {
                    KeyControl.SetKey(PrevC.ToString(), prevCol);
                }

                if (C == ' ' || C == '\n')
                {
                    Clear   = true;
                    prevCol = null;
                    PrevC   = 'c';
                }
                else
                {
                    KeyControl.SetKey(C.ToString(), Color.White);
                    prevCol = col;
                    PrevC   = C;
                }

                Thread.Sleep(800);
            }

            KeyControl.ResetBG();
        }