static void CreateDemoFrames(Func <LaserPoint[], bool> onFrameCreated, uint frameCount = 400) { if (onFrameCreated == null) { throw new ArgumentNullException("onFrameCreated"); } const int nPointCnt = 300; // create a set of frames for (int nFrames = 0; nFrames < frameCount; nFrames++) { var frame = new LaserPoint[nPointCnt]; //draw some nice basic circle into the frame for (int i = 0; i < nPointCnt; i++) { var location = new Point( (int)(Math.Sin(i * 2.0f * Math.PI / nPointCnt) * 32700), (int)(Math.Cos(i * 2.0f * Math.PI / nPointCnt) * 32700) ); var color = Color.FromArgb( (int)(Math.Sin(i * 2.0f * Math.PI / nPointCnt + nFrames / 50.0f) * 127 + 127), (int)(Math.Cos(i * 2.0f * Math.PI / nPointCnt - nFrames / 50.0f) * 127 + 127), (int)(Math.Cos(i * 2.0f * Math.PI / nPointCnt + Math.PI / 4 + nFrames / 50.0f) * 127 + 127) ); frame[i] = new LaserPoint(location, color, true); } onFrameCreated(frame); } }
public LaserPoint(LaserPoint punto) { this.Location = punto.Location; this.Color = punto.Draw ? punto.Color : Color.FromArgb(0, 0, 0); this.Draw = punto.Draw; }