MapImageLayer animation

This commit is contained in:
ClemensFischer 2025-01-25 16:47:42 +01:00
parent 2d6b2eb2aa
commit e0e2061014
5 changed files with 22 additions and 24 deletions

View file

@ -4,10 +4,8 @@
using System;
#if UWP
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
#else
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
#endif
@ -15,7 +13,7 @@ namespace MapControl
{
public partial class MapImageLayer
{
public static void FadeOver(Image topImage, Image bottomImage)
private void FadeOver()
{
var fadeInAnimation = new DoubleAnimation
{
@ -30,11 +28,11 @@ namespace MapControl
Duration = TimeSpan.Zero
};
Storyboard.SetTarget(fadeInAnimation, Children[1]);
Storyboard.SetTargetProperty(fadeInAnimation, nameof(Opacity));
Storyboard.SetTarget(fadeInAnimation, topImage);
Storyboard.SetTarget(fadeOutAnimation, Children[0]);
Storyboard.SetTargetProperty(fadeOutAnimation, nameof(Opacity));
Storyboard.SetTarget(fadeOutAnimation, bottomImage);
var storyboard = new Storyboard();
storyboard.Children.Add(fadeInAnimation);

View file

@ -25,8 +25,8 @@ namespace MapControl
FillBehavior = FillBehavior.Stop
};
Storyboard.SetTargetProperty(fadeInAnimation, nameof(UIElement.Opacity));
Storyboard.SetTarget(fadeInAnimation, Image);
Storyboard.SetTargetProperty(fadeInAnimation, nameof(UIElement.Opacity));
var storyboard = new Storyboard();
storyboard.Children.Add(fadeInAnimation);