Ejemplo n.º 1
0
        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;
                }
            }
        }