Ejemplo n.º 1
0
        private static AnimationEvent newLetter(string letter, int spd, int time, int endtime, int xpos, int ypos, float fadval, int letter_othernumber, int intensity, int rainbow)
        {
            var ltr = new AnimationEvent(letter, letter_othernumber, spd, Background, BottomLeft);

            storyboard.AddSpriteEvent(ltr);
            formatletterfade(time, endtime, ltr, fadval);

            if (intensity != 0)
            {
                ltr.Scale(time, (float)(1 + intensity / 6.0));
                spazletter(ltr, time, endtime, xpos, ypos, intensity);
            }
            else
            {
                ltr.Move(time, new Position(xpos, ypos));
            }

            if (rainbow > 0)
            {
                var       cur_rainbow = rainbow;
                const int cdelay      = 150;
                var       loopcount   = (int)((endtime - time) / (cdelay * 6.0));
                var       finalstart  = time + loopcount * cdelay * 6;


                byte clr1 = 255;
                byte clr2 = 255;
                byte clr3 = 255;
                byte clr4 = 255;
                byte clr5 = 255;
                byte clr6 = 255;

                var loop = ltr.CreateLoop(time, loopcount);

                for (var i = 0; i < 6; i++)
                {
                    clr1 = 255;
                    clr2 = 255;
                    clr3 = 255;
                    clr4 = 255;
                    clr5 = 255;
                    clr6 = 255;

                    if (cur_rainbow == 1)
                    {
                        clr2 = 0;
                        clr3 = 0;
                        clr6 = 0;
                    }
                    else if (cur_rainbow == 2)
                    {
                        clr3 = 0;
                        clr4 = 0;
                        clr6 = 0;
                    }
                    else if (cur_rainbow == 3)
                    {
                        clr1 = 0;
                        clr3 = 0;
                        clr4 = 0;
                    }
                    else if (cur_rainbow == 4)
                    {
                        clr1 = 0;
                        clr4 = 0;
                        clr5 = 0;
                    }
                    else if (cur_rainbow == 5)
                    {
                        clr1 = 0;
                        clr2 = 0;
                        clr5 = 0;
                    }
                    else if (cur_rainbow == 6)
                    {
                        clr2 = 0;
                        clr5 = 0;
                        clr6 = 0;
                    }

                    loop.Color(i * cdelay, (i + 1) * cdelay, None, new Colour(clr1, clr2, clr3), new Colour(clr4, clr5, clr6));
                    cur_rainbow = cur_rainbow + 1;
                    if (cur_rainbow == 7)
                    {
                        cur_rainbow = 1;
                    }
                }


                ltr.Color(finalstart, endtime, None, new Colour(clr4, clr5, clr6), Colour.White);
            }


            return(ltr);
        }