Example #1
0
        public override void Initialize()
        {
            PRoot root = Canvas.Root;
            PLayer layer = Canvas.Layer;
            PActivityScheduler scheduler = root.ActivityScheduler;

            PNode singlePulse = new PNode();
            singlePulse.Brush = new SolidBrush(Color.White);
            singlePulse.SetBounds(0, 0, 60, 60);
            PNode repeatPulse = new PNode();
            repeatPulse.Brush = new SolidBrush(Color.White);
            repeatPulse.SetBounds(60, 60, 60, 60);;
            PNode repeatReversePulse = new PNode();
            repeatReversePulse.Brush = new SolidBrush(Color.White);
            repeatReversePulse.SetBounds(120, 120, 60, 60);

            layer.AddChild(singlePulse);
            layer.AddChild(repeatPulse);
            layer.AddChild(repeatReversePulse);

            PColorActivity singlePulseActivity = new PColorActivity(1000, 0, 1, ActivityMode.SourceToDestination, new PulseTarget(singlePulse), Color.Orange);
            PColorActivity repeatPulseActivity = new PColorActivity(1000, 0, 5, ActivityMode.SourceToDestination, new PulseTarget(repeatPulse), Color.Blue);
            PColorActivity repeatReversePulseActivity = new PColorActivity(500, 0, 10, ActivityMode.SourceToDestination, new PulseTarget(repeatReversePulse), Color.Green);

            scheduler.AddActivity(singlePulseActivity);
            scheduler.AddActivity(repeatPulseActivity);
            scheduler.AddActivity(repeatReversePulseActivity);

            base.Initialize ();
        }
        public override void Initialize()
        {
            long currentTime = PUtil.CurrentTimeMillis;

            // Create a new node that we will apply different activities to, and
            // place that node at location 200, 200.
            aNode = new PNode();  //PPath.CreateRectangle(0, 0, 100, 80);
            aNode.SetBounds(0, 0, 100, 80);
            aNode.Brush = new SolidBrush(Color.Blue);
            PLayer layer = Canvas.Layer;
            layer.AddChild(aNode);
            aNode.SetOffset(200, 200);

            // Create a new custom "flash" activity. This activity will start running in
            // five seconds, and while it runs it will flash aNode's brush color between
            // red and green every half second.  The same effect could be achieved by
            // extending PActivity and override OnActivityStep.
            PActivity flash = new PActivity(-1, 500, currentTime + 5000);
            flash.ActivityStepped = new ActivitySteppedDelegate(ActivityStepped);

            Canvas.Root.AddActivity(flash);

            // Use the PNode animate methods to create three activities that animate
            // the node's position. Since our node already descends from the root node the
            // animate methods will automatically schedule these activities for us.
            PActivity a1 = aNode.AnimateToPositionScale(0f, 0f, 0.5f, 5000);
            PActivity a2 = aNode.AnimateToPositionScale(100f, 0f, 1.5f, 5000);
            //PActivity a3 = aNode.AnimateToPositionScale(200f, 100f, 1f, 5000);
            PActivity a3 = aNode.AnimateToPositionScale(20f, 200f, 1f, 5000);

            // the animate activities will start immediately (in the next call to PRoot.processInputs)
            // by default. Here we set their start times (in PRoot global time) so that they start
            // when the previous one has finished.
            a1.StartTime = currentTime;

            a2.StartAfter(a1);
            a3.StartAfter(a2);

            // or the previous three lines could be replaced with these lines for the same effect.
            //a2.setStartTime(currentTime + 5000);
            //a3.setStartTime(currentTime + 10000);

            base.Initialize ();
        }
Example #3
0
        public override void Initialize()
        {
            PNode blue = new PNode();
            blue.SetBounds(0, 0, 60, 80);
            blue.Brush = new SolidBrush(Color.Blue);
            Canvas.Layer.AddChild(blue);

            PEllipse red = new PEllipse();
            red.SetBounds(50, 30, 60, 45);
            red.Brush = new SolidBrush(Color.Red);
            Canvas.Layer.AddChild(red);

            Bitmap bm = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("PocketPiccoloFeatures.hcil.bmp"));
            PImage image = new PImage(bm);
            image.SetBounds(80, 100, image.Width, image.Height);
            Canvas.Layer.AddChild(image);

            Canvas.ZoomEventHandler = null;
            Canvas.AddInputEventListener(new PDragEventHandler());

            base.Initialize ();
        }