Exemple #1
0
        public Twinkle(Palette p_palette, Boolean p_seq, Boolean p_static_sparks,
                       int p_percent,
                       int p_frame_size)
        {
            this.palette       = p_palette;
            this.sequential    = p_seq;
            this.static_sparks = p_static_sparks;
            this.percent       = p_percent;
            this.frame_size    = p_frame_size;

            this.rand = new Random((int)DateTime.Now.Ticks);

            sparks = new Spark[frame_size];
            for (int i = 0; i < sparks.Length; i++)
            {
                sparks[i] = new Spark();
                if (rand.Next(0, 100) < p_percent)//randomly decide it's lit
                {
                    //  if (sequential)
                    sparks[i].color = palette.getColor(i); //palette will autowrap for us
                                                           // else
                                                           //     sparks[i].color = palette.getRandomColor();
                    sparks[i].fade_rate = 1;               // rand.Next(1, 3);
                    sparks[i].alive     = true;
                }
                else
                {
                    sparks[i].color = new Color(CRGB.Black);
                    sparks[i].alive = false;
                }
            }
        }
Exemple #2
0
 private bool sparkOut(Spark spark)
 {
     if (spark.color.red == 0 ||
         spark.color.green == 0 ||
         spark.color.blue == 0)
     {
         return(true);
     }
     return(false);
 }