/// <summary> /// Core update routine. /// </summary> /// <param name="context">An AnimationContext that provides internal animation information.</param> protected override void UpdateAnimationOverride(AnimationContext context) { base.UpdateAnimationOverride(context); if (context == null) { return; } Point from = GetPoint(context.Target, this.StartPoint); Point to = GetPoint(context.Target, this.EndPoint); double duration = this.Duration.TimeSpan.TotalSeconds; RectangleGeometry geom = new RectangleGeometry(); context.Target.Clip = geom; if (this.reverseClipAnimation) { context.SingleProperty("ClipStartXProperty", 0, 0, duration, -to.X); context.SingleProperty("ClipStartYProperty", 0, 0, duration, -to.Y); } else { context.SingleProperty("ClipStartXProperty", 0, -from.X, duration, 0); context.SingleProperty("ClipStartYProperty", 0, -from.Y, duration, 0); } SetAnimationCompleteCallback(context); }