protected void CreateRects(Random rnd) { PTransformActivity rotActivity; P3Path rect; // Create a bunch of animated rectangles for (int x = 0; x < 2000; x += 100) { for (int y = 200; y < 1500; y += 100) { int w = 200; int h = 200; rect = P3Path.CreateRectangle(x, y, w, h); rect.Brush = new SolidBrush(Color.FromArgb(50, Color.Purple.R, Color.Purple.G, Color.Purple.B)); rect.Pen = new Pen(Color.Red, 0); canvas.Layer.AddChild(rect); PMatrix matrix = new PMatrix(); matrix.RotateBy(90, x + w / 2, y + h / 2); rotActivity = rect.AnimateToMatrix(matrix, 5000 + (long)(2000 * rnd.NextDouble())); rotActivity.LoopCount = 1000; rotActivity.Mode = ActivityMode.SourceToDestinationToSource; } } }
protected void CreatePath(Random rnd) { PTransformActivity rotActivity; // Create a path P3Path path = P3Path.CreateEllipse(0, 0, 100, 100); path.Brush = Brushes.Red; path.AddLine(0, 0, 20, 20); path.AddLine(20, 20, 34, 67); path.AddArc(0, 30, 30, 30, 30, 30); path.Tolerance = .002f; canvas.Layer.AddChild(path); PMatrix rMatrix = new PMatrix(); PointF center = PUtil.CenterOfRectangle(path.Bounds); rMatrix.RotateBy(90, center.X, center.Y); rotActivity = path.AnimateToMatrix(rMatrix, 2000 + (long)(2000 * rnd.NextDouble())); rotActivity.LoopCount = 1000; rotActivity.Mode = ActivityMode.SourceToDestinationToSource; }
protected void CreateImages(Random rnd) { PTransformActivity rotActivity; P3Image image; // Create a bunch of animated images for (int x = 0; x < 2000; x += 500) { for (int y = 1500; y < 3000; y += 500) { int w = 200; int h = 200; image = new P3Image("hcil-logo.png"); canvas.Layer.AddChild(image); PMatrix matrix = new PMatrix(); matrix.RotateBy(90, x + w / 2, y + h / 2); rotActivity = image.AnimateToMatrix(matrix, 5000 + (long)(2000 * rnd.NextDouble())); rotActivity.LoopCount = 1000; rotActivity.Mode = ActivityMode.SourceToDestinationToSource; } } }