public static Vector3KeyFrameAnimation CreateVector3KeyFrameAnimation(this Compositor compositor, Vector3 to, Vector3?from, TimeSpan duration, TimeSpan?delay, CompositionEasingFunction ease) { var ani = compositor.CreateVector3KeyFrameAnimation(); // Set duration and delay time ani.Duration = duration; if (delay.HasValue) { ani.DelayTime = delay.Value; } // Insert "to" and "from" keyframes ani.InsertKeyFrame(1, to, ease ?? compositor.CreateLinearEasingFunction()); if (from.HasValue) { ani.InsertKeyFrame(0, from.Value); } return(ani); }
public static Vector3KeyFrameAnimation CreateVector3KeyFrameAnimation( [NotNull] this Compositor compositor, Vector3?from, [NotNull] string to, TimeSpan duration, TimeSpan?delay, [CanBeNull] CompositionEasingFunction ease = null) { // Set duration and delay time Vector3KeyFrameAnimation ani = compositor.CreateVector3KeyFrameAnimation(); ani.Duration = duration; if (delay.HasValue) { ani.DelayTime = delay.Value; } // Insert "to" and "from" keyframes ani.InsertExpressionKeyFrame(1, to, ease ?? compositor.CreateLinearEasingFunction()); if (from.HasValue) { ani.InsertKeyFrame(0, from.Value); } return(ani); }