Esempio n. 1
0
        public void HandleSparkle(Led led)
        {
            Sparkler sparkler;

            _sparklers.TryGetValue(led, out sparkler);

            if (sparkler != null)
            {
                led.Color = RgbColor.Blend(led.Color, new RgbColor(255, 255, 255), sparkler.Count, Sparkler.Max);

                sparkler.Count--;
                if (sparkler.Count == 0)
                {
                    _sparklers.Remove(led);
                }
            }
            else
            {
                if (_random.Next(10000) > _threshold)
                {
                    sparkler = new Sparkler();
                    _sparklers.Add(led, sparkler);
                }
            }
        }
Esempio n. 2
0
        public SnowflakeLeds()
        {
            _ledCollection = new LedCollection();

            CreateArm(0);
            CreateArm(60);
            CreateArm(120);

            Led led = new Led(0, 0);

            led.Color = new RgbColor(255, 255, 255);
            _ledCollection.Add(led);

            CreateArm(180);
            CreateArm(240);
            CreateArm(300);
        }
Esempio n. 3
0
        private void AddLed(int angle, int distance)
        {
            Led led2 = new Led(angle, distance);

            _ledCollection.Add(led2);
        }
Esempio n. 4
0
 public void Add(Led led)
 {
     _leds.Add(led);
 }