Пример #1
0
 private static void ApplyColors(IEnumerable<IEffect> colorEffect, int numCycles)
 {
     Patterns patt = new Patterns();
     IList<Color> colors = Enumerable.Range(0, numCycles).Select(i => patt.RandomColor()).ToList();
     foreach (var effect in colorEffect)
     {
         ((FixedEffect) effect)._colorEffect.Colors = colors;
     }
 }
Пример #2
0
        private static void ApplyColors(IEnumerable<IEffect> colorEffect, int numCycles)
        {
            colorEffect = colorEffect.ToList();
            List<Color> startColors = new List<Color>();
            List<Color> endColors = new List<Color>();
            Patterns patt = new Patterns();
            startColors.Add(patt.RandomColor());

            for (int i = 0; i < (numCycles-1); i++)
            {
                Color next = patt.RandomColor();
                startColors.Add(next);
                endColors.Add(next);
            }
            endColors.Add(patt.RandomColor());
            IColorEffect startEffect = ((Sweep)(colorEffect.First()))._startColorEffect;
            IColorEffect endEffect = ((Sweep)(colorEffect.First()))._endColorEffect;
            if(startEffect.GetType() == typeof(ColorFade))
                startColors.Add(patt.RandomColor());
            if (endEffect.GetType() == typeof(ColorFade))
                endColors.Add(patt.RandomColor());

            foreach (var effect in colorEffect)
            {
                ((Sweep) effect)._startColorEffect.Colors = startColors;
                ((Sweep) effect)._endColorEffect.Colors = endColors;
            }
        }