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 = Brushes.Yellow; n1.Pen = new Pen(Brushes.Red, 5); n2.Pen = new Pen(Brushes.Black, 0); //Fixed width stroke n3.Pen = new Pen(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()); }
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 = (GraphicsPath)ppath.PathReference.Clone(); positionPathActivity.LoopCount = int.MaxValue; // add the activity animatedNode.AddActivity(positionPathActivity); }