UMD.HCIL.Piccolo.PNode.AnimateToPositionScaleRotation C# (CSharp) Method

AnimateToPositionScaleRotation() public method

Animate this node's matrix from its current location when the activity starts to the specified location, scale, and rotation.
If this node descends from the root then the activity will be scheduled, else the returned activity should be scheduled manually. If two different transform 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.
public AnimateToPositionScaleRotation ( float x, float y, float scale, float theta, long duration ) : UMD.HCIL.Piccolo.Activities.PTransformActivity
x float The x coordinate of the target location.
y float The y coordinate of the target location
scale float The scale of the target matrix
theta float The rotation of the target matrix
duration long The amount of time that the animation should take.
return UMD.HCIL.Piccolo.Activities.PTransformActivity
		public virtual PTransformActivity AnimateToPositionScaleRotation(float x, float y, float scale, float theta, long duration) {
			PMatrix m = Matrix;
			m.OffsetX = x;
			m.OffsetY = y;
			m.Scale = scale;
			m.Rotation = theta;
			return AnimateToMatrix(m, duration);
		}

Usage Example

		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 = PPath.CreateRectangle(0, 0, 100, 80);
			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.AnimateToPositionScaleRotation(0f, 0f, 0.5f, 0f, 5000);
			PActivity a2 = aNode.AnimateToPositionScaleRotation(100f, 0f, 1.5f, 110f, 5000);
			PActivity a3 = aNode.AnimateToPositionScaleRotation(200f, 100f, 1f, 0f, 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);
		}