/// <summary> /// Animate this node's matrix from its current values when the activity /// starts to the new values specified in the given matrix. /// </summary> /// <param name="destMatrix">The final matrix value.</param> /// <param name="duration">The amount of time that the animation should take.</param> /// <returns>The newly scheduled activity</returns> /// <remarks> /// 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. /// </remarks> public virtual PTransformActivity AnimateToMatrix(PMatrix destMatrix, long duration) { if (duration == 0) { Matrix = destMatrix; return null; } PTransformActivity.Target t = new PNodeTransformTarget(this); PTransformActivity ta = new PTransformActivity(duration, PUtil.DEFAULT_ACTIVITY_STEP_RATE, t, destMatrix); AddActivity(ta); return ta; }
/// <summary> /// Animate the camera's view matrix from its current value when the activity starts /// to the new destination matrix value. /// </summary> /// <param name="destination">The final matrix value.</param> /// <param name="duration">The amount of time that the animation should take.</param> /// <returns> /// The newly scheduled activity, if the duration is greater than 0; else null. /// </returns> public virtual PTransformActivity AnimateViewToMatrix(PMatrix destination, long duration) { if (duration == 0) { ViewMatrix = destination; return null; } PTransformActivity ta = new PTransformActivity(duration, PUtil.DEFAULT_ACTIVITY_STEP_RATE, new PCameraTransformTarget(this), destination); PRoot r = Root; if (r != null) { r.AddActivity(ta); } return ta; }