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 ();
        }
Exemple #2
0
 /// <summary>
 /// Animate this node's color from its current value to the new value
 /// specified.
 /// </summary>
 /// <param name="destColor">The final color value.</param>
 /// <param name="duration">The amount of time that the animation should take.</param>
 /// <returns>The newly scheduled activity.</returns>
 /// <remarks>
 /// This method assumes that this nodes Brush property is of type SolidBrush.
 /// If this node descends from the root then the activity will be scheduled,
 /// else the returned activity should be scheduled manually. If two different
 /// color activities are scheduled for the same node at the same time, they will
 /// both be applied to the node, but the last one scheduled will be applied last
 /// on each frame, so it will appear to have replaced the original. Generally
 /// you will not want to do that.
 /// </remarks>
 public virtual PColorActivity AnimateToColor(Color destColor, long duration)
 {
     PColorActivity.Target t = new PNodeColorTarget(this);
     PColorActivity ca = new PColorActivity(duration, PUtil.DEFAULT_ACTIVITY_STEP_RATE, t, destColor);
     AddActivity(ca);
     return ca;
 }