public static Vector2KeyFrameAnimation CreateVector2KeyFrameAnimation(this Compositor compositor, Vector2 to, Vector2?from, TimeSpan duration, TimeSpan?delay, CompositionEasingFunction ease) { var ani = compositor.CreateVector2KeyFrameAnimation(); // 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 Vector2KeyFrameAnimation CreateVector2KeyFrameAnimation( [NotNull] this Compositor compositor, Vector2?from, [NotNull] string to, TimeSpan duration, TimeSpan?delay, [CanBeNull] CompositionEasingFunction ease = null) { // Set duration and delay time Vector2KeyFrameAnimation ani = compositor.CreateVector2KeyFrameAnimation(); 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); }