Animation FillBehavior

This commit is contained in:
ClemensFischer 2025-01-24 23:04:59 +01:00
parent 5856223e17
commit 2d6b2eb2aa
4 changed files with 9 additions and 14 deletions

View file

@ -19,7 +19,7 @@ namespace MapControl
new KeyFrame new KeyFrame
{ {
KeyTime = MapBase.ImageFadeDuration, KeyTime = MapBase.ImageFadeDuration,
Setters = { new Setter(Visual.OpacityProperty, 1d) } Setters = { new Setter(OpacityProperty, 1d) }
} }
} }
}; };

View file

@ -137,8 +137,7 @@ namespace MapControl
{ {
To = new Location(targetCenter.Latitude, CoerceLongitude(targetCenter.Longitude)), To = new Location(targetCenter.Latitude, CoerceLongitude(targetCenter.Longitude)),
Duration = AnimationDuration, Duration = AnimationDuration,
EasingFunction = AnimationEasingFunction, EasingFunction = AnimationEasingFunction
FillBehavior = FillBehavior.Stop
}; };
centerAnimation.Completed += CenterAnimationCompleted; centerAnimation.Completed += CenterAnimationCompleted;
@ -154,9 +153,9 @@ namespace MapControl
centerAnimation.Completed -= CenterAnimationCompleted; centerAnimation.Completed -= CenterAnimationCompleted;
centerAnimation = null; centerAnimation = null;
BeginAnimation(CenterProperty, null);
SetValueInternal(CenterProperty, TargetCenter); SetValueInternal(CenterProperty, TargetCenter);
UpdateTransform(); UpdateTransform();
BeginAnimation(CenterProperty, null);
} }
} }
@ -202,8 +201,7 @@ namespace MapControl
{ {
To = targetZoomLevel, To = targetZoomLevel,
Duration = AnimationDuration, Duration = AnimationDuration,
EasingFunction = AnimationEasingFunction, EasingFunction = AnimationEasingFunction
FillBehavior = FillBehavior.Stop
}; };
zoomLevelAnimation.Completed += ZoomLevelAnimationCompleted; zoomLevelAnimation.Completed += ZoomLevelAnimationCompleted;
@ -219,9 +217,9 @@ namespace MapControl
zoomLevelAnimation.Completed -= ZoomLevelAnimationCompleted; zoomLevelAnimation.Completed -= ZoomLevelAnimationCompleted;
zoomLevelAnimation = null; zoomLevelAnimation = null;
BeginAnimation(ZoomLevelProperty, null);
SetValueInternal(ZoomLevelProperty, TargetZoomLevel); SetValueInternal(ZoomLevelProperty, TargetZoomLevel);
UpdateTransform(true); UpdateTransform(true);
BeginAnimation(ZoomLevelProperty, null);
} }
} }
@ -262,8 +260,7 @@ namespace MapControl
{ {
By = delta, By = delta,
Duration = AnimationDuration, Duration = AnimationDuration,
EasingFunction = AnimationEasingFunction, EasingFunction = AnimationEasingFunction
FillBehavior = FillBehavior.Stop
}; };
headingAnimation.Completed += HeadingAnimationCompleted; headingAnimation.Completed += HeadingAnimationCompleted;
@ -279,9 +276,9 @@ namespace MapControl
headingAnimation.Completed -= HeadingAnimationCompleted; headingAnimation.Completed -= HeadingAnimationCompleted;
headingAnimation = null; headingAnimation = null;
BeginAnimation(HeadingProperty, null);
SetValueInternal(HeadingProperty, TargetHeading); SetValueInternal(HeadingProperty, TargetHeading);
UpdateTransform(); UpdateTransform();
BeginAnimation(HeadingProperty, null);
} }
} }
} }

View file

@ -22,8 +22,7 @@ namespace MapControl
{ {
To = 0d, To = 0d,
BeginTime = MapBase.ImageFadeDuration, BeginTime = MapBase.ImageFadeDuration,
Duration = TimeSpan.Zero, Duration = TimeSpan.Zero
FillBehavior = FillBehavior.Stop
}; };
topImage.BeginAnimation(OpacityProperty, fadeInAnimation); topImage.BeginAnimation(OpacityProperty, fadeInAnimation);

View file

@ -27,8 +27,7 @@ namespace MapControl
{ {
To = 0d, To = 0d,
BeginTime = MapBase.ImageFadeDuration, BeginTime = MapBase.ImageFadeDuration,
Duration = TimeSpan.Zero, Duration = TimeSpan.Zero
FillBehavior = FillBehavior.Stop
}; };
Storyboard.SetTargetProperty(fadeInAnimation, nameof(Opacity)); Storyboard.SetTargetProperty(fadeInAnimation, nameof(Opacity));