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); } } }
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); } }
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); } }
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)); } } }
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; }
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); } }
private void FarEffect(ILED3DCanvas canvas) { RGB color = this.GetAtFieldColor(1); int count = 1; foreach (var r in this.rs) { DrawOctagon(canvas, (float)this.x, (float)this.y, r, new RGB(color.R, color.G, color.B, (int)(0xff - this.z * 300f - count * 20f))); count++; } }
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; }
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++; } }
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; }
private void NearEffect(ILED3DCanvas canvas) { RGB color = this.GetAtFieldColor(); if (color == null) { this.SetFlashEffect(canvas); } else { int count = 1; foreach (var r in this.rs) { DrawOctagon(canvas, (float)this.x, (float)this.y, r + GetVibe(), new RGB(color.R, color.G, color.B, (int)(0xff - count * 20))); } } }
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); } }
public void Run(ILED3DCanvas canvas, LED3DCanvasFilter filter) { var rand = new Random(); while (true) { if (canvas.GetObjectCount() < 1) { var x = rand.Next() % LED.WIDTH; var y = rand.Next() % LED.HEIGHT; canvas.AddObject(new LED3DAtField(x, y, 0, 4, 0) , filter ); } canvas.Show(); LED.Wait(20); } }
public void Run(ILED3DCanvas canvas, LED3DCanvasFilter filter) { var rand = new Random(); while (true) { if (canvas.GetObjectCount() < 2) { var x = rand.Next() % LED.WIDTH; var y = rand.Next() % LED.HEIGHT; canvas.AddObject(new LED3DRipple(x, y, new RGB(0xff, 0x00, 0xff), LED.Direction.Front, 6) , filter ); } canvas.Show(); LED.Wait(20); } }
public override void Draw(ILED3DCanvas canvas) { bool isNeedUpdate = false; var updateSpan = this.GetElapsedAt().Subtract(this.lastUpdateAt).TotalMilliseconds; if (updateSpan < 100) { isNeedUpdate = true; } if (this.longTimeNoSee == true && this.z < NEAR_BORDER) { this.SetFlashEffect(canvas); this.longTimeNoSee = false; } if (isNeedUpdate) { if (this.z < NEAR_BORDER) { this.NearEffect(canvas); } else { this.FarEffect(canvas); } } else { foreach (var r in this.rs) { var dcline = this.GetElapsedAt().Subtract(this.lastUpdateAt).TotalMilliseconds; DrawOctagon(canvas, (float)this.x, (float)this.y, r + this.GetVibe(), new RGB(0xff, 0x65, 0x00, (int)(0xff - dcline * 0.8))); } } }
public LED3DHsvColorFilter(ILED3DCanvas canvas) : base(canvas) { }
public void AddObject(LED3DObject obj, ILED3DCanvas filter) { this.objects.Add(new LED3DObjectSet(obj, filter)); }
public LED3DWaveCanvasFilter2(ILED3DCanvas canvas) : base(canvas) { bornAt = DateTime.Now; lastUpdate = DateTime.Now; }
public void SetUp(ILED3DCanvas canvas, LED3DCanvasFilter filter) { canvas.AddObject(new LED3DRectangle(new Rectangle(-5, -5, 10, 10), new RGB(0xff, 0xff, 0xff)), filter); }
public override void Draw(ILED3DCanvas canvas) { canvas.SetLed(this.x, this.y, this.z, this.Color); }
public LED3DWaveCanvasFilter(ILED3DCanvas canvas) : base(canvas) { bornAt = DateTime.Now; }
virtual public void AddObject(LED3DObject obj, ILED3DCanvas filter) { this.canvas.AddObject(obj, filter); }
abstract public void Draw(ILED3DCanvas canvas);
public LED3DSurfaceCanvasFilter(ILED3DCanvas canvas) : base(canvas) { }
public LED3DCanvasFilter(ILED3DCanvas canvas) { this.canvas = canvas; }
public void SetUp(ILED3DCanvas canvas, LED3DCanvasFilter filter) { canvas.AddObject(new LED3D5thAngel(), filter); }
public LED3DObjectSet(LED3DObject obj, ILED3DCanvas filter) { this.obj = obj; this.filter = filter; }
public void Run(ILED3DCanvas canvas, LED3DCanvasFilter filter) { }
public void SetUp(ILED3DCanvas canvas, LED3DCanvasFilter filter) { }
public void SetUp(ILED3DCanvas canvas, LED3DCanvasFilter filter) { canvas.AddObject(new LED3DBall(4, 4, 4, 8, 8, new RGB(0xff, 0xff, 0xff)), filter); }