Ejemplo n.º 1
0
        public void StaticRingsAnimated()
        {
            double progress = this.config.beatBroadcaster.ProgressThroughBeat(
                this.config.domeVolumeRotationSpeed
                );

            double level = this.audio.LevelForChannel(0);

            for (int i = 0; i < 5; i++)
            {
                StrutLayoutSegment segment =
                    this.ringsLayout.GetSegment(i);

                double totalLength = segment.TotalLength;
                double totalPos    = 0;
                foreach (Strut strut in segment.GetStruts())
                {
                    double frac = totalPos / totalLength;
                    double dist = Math.Abs(progress - frac);
                    dist  = dist > 0.5 ? 1.0 - dist : dist;
                    dist *= 2;
                    double d = dist * dist * level * progress;
                    int    c = LEDColor.FromDoubles(d, d, d);

                    for (int j = 0; j < strut.Length; j++, totalPos += 1)
                    {
                        this.dome.SetPixel(strut.Index, j, c);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void ParametricTest()
        {
            double progress = this.config.beatBroadcaster.ProgressThroughBeat(
                this.config.domeVolumeRotationSpeed
                );

            double level = this.audio.LevelForChannel(0);

            for (int i = 0; i < LEDDomeOutput.GetNumStruts(); i++)
            {
                Strut strut = Strut.FromIndex(this.config, i);
                var   leds  = LEDDomeOutput.GetNumLEDs(i);
                for (int j = 0; j < leds; j++)
                {
                    var    p = StrutLayoutFactory.GetProjectedLEDPointParametric(i, j);
                    double r = 0;
                    double g = 0;
                    double b = 0;

                    //radar effect
                    double a = (p.Item3 + Math.PI) / (Math.PI * 2);
                    r = progress - a;
                    if (r < 0)
                    {
                        r += 1;
                    }
                    if (r > 1)
                    {
                        r = 1;
                    }

                    //pulse effect
                    double dist = Math.Abs(progress - p.Item4);
                    r = 1 - dist;
                    if (r < 0.9)
                    {
                        r = 0;
                    }

                    //spiral effect
                    double m = p.Item4 - a;
                    if (m < 0)
                    {
                        m += 1;
                    }
                    double n = progress - m;
                    if (n < 0)
                    {
                        n += 1;
                    }
                    r = 1 - n;

                    this.dome.SetPixel(i, j, LEDColor.FromDoubles(r, g, b));
                }
            }
        }