Пример #1
0
        public override void Execute(Strip strip)
        {
            var w = strip.Width / 2;
            var h = strip.Height / 2;

            foreach (var light in strip.Lights)
            {
                var   p = strip.EdgePoint(light);
                Color c;
                if (p.X < w)
                {
                    if (p.Y > h)
                    {
                        c = Color.Red;
                    }
                    else
                    {
                        c = Color.Blue;
                    }
                }
                else if (p.Y > h)
                {
                    c = Color.Green;
                }
                else
                {
                    c = Color.Yellow;
                }
                light.Color = Mix(c);
            }
        }
Пример #2
0
        public override void Execute(Strip strip)
        {
            var position = Step() / 2;
            var radius   = Length * strip.Width / 2;
            var source   = strip.EdgePoint(position);

            foreach (var light in strip.Lights)
            {
                var d = strip.EdgePoint(light).Distance(source);
                if (d > radius)
                {
                    light.Color = Mix(Color2);
                }
                else
                {
                    Color c = ColorMix((float)(d / radius), Color1, Color2);
                    light.Color = Mix(c);
                }
            }
        }
Пример #3
0
        public override void Execute(Strip strip)
        {
            var   position = Step() / 20d;
            Point p        = new Point(position, position);
            var   scale    = Length * 5;
            var   half     = scale / 2;

            foreach (var light in strip.Lights)
            {
                var d      = strip.EdgePoint(light).Distance(p);
                var stripe = d % scale;
                var color  = stripe < half ? Color1 : Color2;
                light.Color = Mix(color);
            }
        }
Пример #4
0
        public override void Execute(Strip strip)
        {
            var position = Step() / 5;
            var radius   = Length * 5;
            var w        = strip.Width;
            var h        = strip.Height;
            var source   = new Point(w / 2, h / 2);

            foreach (var light in strip.Lights)
            {
                var d = strip.EdgePoint(light).Distance(source) + position;
                d = (Math.Sin(d / radius) + 1) / 2;
                Color c = ColorMix((float)d, Color1, Color2);
                light.Color = Mix(c);
            }
        }
Пример #5
0
        public override void Execute(Strip strip)
        {
            var position = Step() * 2;
            var a        = Length * strip.Width;
            var b        = a * 2;

            foreach (var light in strip.Lights)
            {
                var p = strip.EdgePoint(light);
                if ((position - p.X) % b < a)
                {
                    light.Color = Mix(Color1);
                }
                else
                {
                    light.Color = Mix(Color2);
                }
            }
        }