Esempio n. 1
0
        private void DrawOctagon(ILED3DCanvas canvas, float x, float y, float r, RGB color)
        {
            float d = r * (float)Math.Tan(Math.PI / 8f);

            var pts = new List <PointF>();
            var dx  = (float)Math.Max(0, width * 0.5);

            pts.Add(new PointF(r + x + dx, d + y));   // 右上
            pts.Add(new PointF(r + x + dx, -d + y));  // 右下

            pts.Add(new PointF(d + x + dx, -r + y));  // 下右
            pts.Add(new PointF(-d + x - dx, -r + y)); // 下左
            pts.Add(new PointF(-r + x - dx, -d + y)); // 左下
            pts.Add(new PointF(-r + x - dx, d + y));  // 左上
            pts.Add(new PointF(-d + x - dx, r + y));  // 上左
            pts.Add(new PointF(d + x + dx, r + y));   // 上右
            pts.Add(new PointF(r + x + dx, d + y));   // 1番目と同じ


            for (int i = 0; i < pts.Count - 1; i++)
            {
                var   pt1  = pts[i];
                var   pt2  = pts[i + 1];
                Dot[] dots = drawUtility.Line(pt1, pt2, color, 2f);
                foreach (var dot in dots)
                {
                    canvas.SetLed(dot.X, dot.Y, 0, dot.RGB);
                }
            }
        }
Esempio n. 2
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var dots = drawUtility.Rectangle(rect, this.Color);

            foreach (var dot in dots)
            {
                canvas.SetLed(dot.X, dot.Y, 0, dot.RGB);
            }
        }
Esempio n. 3
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var dots = drawUtility.Circle(this.x, this.y, this.w, this.h, this.Color);

            foreach (var dot in dots)
            {
                canvas.SetLed(dot.X, dot.Y, 0, dot.RGB);
            }
        }
Esempio n. 4
0
 public override void Draw(ILED3DCanvas canvas)
 {
     for (int x = 0; x < LED.WIDTH; x++)
     {
         for (int z = 0; z < LED.DEPTH; z++)
         {
             canvas.SetLed(x, LED.HEIGHT - 1, z, this.Color - (Math.Sin(GetElapsedAt().TotalMilliseconds / 400) * 150));
         }
     }
 }
Esempio n. 5
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var yangle = (GetElapsedAt().TotalMilliseconds / 15) * (Math.PI / 180);

            var newDots = Get6thAngel(yangle, new Dot(8, 4, 7));

            foreach (var dot in newDots)
            {
                canvas.SetLed(dot.X, dot.Y, dot.Z, dot.RGB);
            }
        }
Esempio n. 6
0
 private void SetFlashEffect(ILED3DCanvas canvas)
 {
     for (int x = 0; x < LED.WIDTH; x++)
     {
         for (int y = 0; y < LED.HEIGHT; y++)
         {
             canvas.SetLed(x, y, 0, new RGB(0xff, 0xff, 0xff));
         }
     }
     return;
 }
Esempio n. 7
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var isNeedUpdate = false;

            if (this.GetElapsedAt().Subtract(this.lastUpdateAt).Milliseconds > 100)
            {
                this.lastUpdateAt = this.GetElapsedAt();
                isNeedUpdate      = true;
            }

            canvas.SetLed(this.x, this.y, this.z, this.Color);
            this.Color -= 10;
        }
Esempio n. 8
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var count = 0;

            foreach (var layer in this.dots)
            {
                foreach (var dot in layer)
                {
                    var hsv = Util.RGB2HSV(dot.RGB);
                    hsv.S = hsv.V = 360;
                    hsv.H = 360 * count / LED.DEPTH;
                    canvas.SetLed(dot.X, dot.Y, count, Util.HSV2RGB(hsv.H, hsv.S, hsv.V, dot.RGB.A));
                }
                count++;
            }
        }
Esempio n. 9
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var isNeedUpdate = false;

            if (this.GetElapsedAt().Subtract(this.lastUpdateAt).Milliseconds > 100)
            {
                this.lastUpdateAt = this.GetElapsedAt();
                isNeedUpdate      = true;
            }

            if (this.rs.Min() - 4 >= FIRST_R && this.produced < this.size)
            {
                this.rs.Add(FIRST_R);
                produced++;
            }

            var newRs = new List <float>();


            foreach (var r in this.rs)
            {
                if (r * 20 >= 0xff)
                {
                    continue;
                }
                else
                {
                    var dots = drawUtility.CircleCenterAt(x, y, r * 2, r * 2, new RGB(this.Color.R, this.Color.G, this.Color.B, (int)(this.Color.A - r * 20)));

                    foreach (var dot in dots)
                    {
                        canvas.SetLed(dot.X, dot.Y, 0, dot.RGB);
                    }
                }


                if (isNeedUpdate)
                {
                    newRs.Add(r + 1);
                }
                else
                {
                    newRs.Add(r);
                }
            }
            this.rs = newRs;
        }
Esempio n. 10
0
        public override void Draw(ILED3DCanvas canvas)
        {
            var src = drawUtility.CircleCenterAt(0, 0, this.w, this.h, this.Color);

            var dots   = new List <Dot>();
            var offset = Util.GetOffsetMatrix(new Dot(x, y, z));

            for (double i = 0; i < 2 * Math.PI; i = i + (2 * Math.PI / (w * 3)))
            {
                dots.AddRange(Util.appryMatrix(src, Util.GetYAxisRotateMatrix(i, new Dot(x, y, z))));
            }

            foreach (var dot in dots)
            {
                canvas.SetLed(dot.X, dot.Y, dot.Z, dot.RGB);
            }
        }
Esempio n. 11
0
 public override void Draw(ILED3DCanvas canvas)
 {
     canvas.SetLed(this.x, this.y, this.z, this.Color);
 }