public override void Initialize() { PLayer layer = Canvas.Layer; PNode animatedNode = PPath.CreateRectangle(0, 0, 100, 80); layer.AddChild(animatedNode); // create node to display animation path PPath ppath = new PPath(); // create animation path ppath.AddLine(0, 0, 300, 300); ppath.AddLine(300, 300, 300, 0); ppath.AddArc(0, 0, 300, 300, -90, 90); ppath.CloseFigure(); // add the path to the scene graph layer.AddChild(ppath); PPositionPathActivity positionPathActivity = new PPositionPathActivity(5000, 0, new PositionPathTarget(animatedNode)); positionPathActivity.PositionPath = (XnaGraphicsPath)ppath.PathReference.Clone(); positionPathActivity.LoopCount = int.MaxValue; // add the activity animatedNode.AddActivity(positionPathActivity); }
public override void Initialize() { PPath n1 = PPath.CreateRectangle(0, 0, 100, 80); PPath n2 = PPath.CreateEllipse(100, 100, 200, 34); PPath n3 = new PPath(); n3.AddLine(0, 0, 20, 40); n3.AddLine(20, 40, 10, 200); n3.AddLine(10, 200, 155.444f, 33.232f); n3.CloseFigure(); n3.Brush = Color.Yellow; n1.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Red, 5); n2.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Black, 0); //Fixed width stroke n3.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Black, 0); //Fixed width stroke Canvas.Layer.AddChild(n1); Canvas.Layer.AddChild(n2); Canvas.Layer.AddChild(n3); // create a set of bounds handles for reshaping n3, and make them // sticky relative to the getCanvas().getCamera(). PStickyHandleManager sm = new PStickyHandleManager(Canvas.Camera, n3); Canvas.RemoveInputEventListener(Canvas.PanEventHandler); Canvas.AddInputEventListener(new PDragEventHandler()); }