mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 22:18:56 +00:00
Fade animations
This commit is contained in:
parent
b9a34fd5e4
commit
4c669f4df0
7 changed files with 45 additions and 39 deletions
|
|
@ -12,18 +12,22 @@ namespace MapControl
|
|||
{
|
||||
public static void FadeOver(Image topImage, Image bottomImage)
|
||||
{
|
||||
topImage.BeginAnimation(OpacityProperty, new DoubleAnimation
|
||||
var fadeInAnimation = new DoubleAnimation
|
||||
{
|
||||
To = 1d,
|
||||
Duration = MapBase.ImageFadeDuration
|
||||
});
|
||||
};
|
||||
|
||||
bottomImage.BeginAnimation(OpacityProperty, new DoubleAnimation
|
||||
var fadeOutAnimation = new DoubleAnimation
|
||||
{
|
||||
To = 0d,
|
||||
BeginTime = MapBase.ImageFadeDuration,
|
||||
Duration = TimeSpan.Zero
|
||||
});
|
||||
Duration = TimeSpan.Zero,
|
||||
FillBehavior = FillBehavior.Stop
|
||||
};
|
||||
|
||||
topImage.BeginAnimation(OpacityProperty, fadeInAnimation);
|
||||
bottomImage.BeginAnimation(OpacityProperty, fadeOutAnimation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,18 +13,19 @@ namespace MapControl
|
|||
{
|
||||
public partial class Tile
|
||||
{
|
||||
private void BeginOpacityAnimation()
|
||||
private void BeginFadeInAnimation()
|
||||
{
|
||||
Image.BeginAnimation(UIElement.OpacityProperty,
|
||||
new DoubleAnimation
|
||||
{
|
||||
From = 0d,
|
||||
Duration = MapBase.ImageFadeDuration,
|
||||
FillBehavior = FillBehavior.Stop
|
||||
});
|
||||
var fadeInAnimation = new DoubleAnimation
|
||||
{
|
||||
From = 0d,
|
||||
Duration = MapBase.ImageFadeDuration,
|
||||
FillBehavior = FillBehavior.Stop
|
||||
};
|
||||
|
||||
Image.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation);
|
||||
}
|
||||
|
||||
private void AnimateImageOpacity()
|
||||
private void FadeIn()
|
||||
{
|
||||
if (Image.Source is BitmapSource bitmap && bitmap.IsDownloading && !bitmap.IsFrozen)
|
||||
{
|
||||
|
|
@ -33,7 +34,7 @@ namespace MapControl
|
|||
}
|
||||
else
|
||||
{
|
||||
BeginOpacityAnimation();
|
||||
BeginFadeInAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +45,7 @@ namespace MapControl
|
|||
bitmap.DownloadCompleted -= BitmapDownloadCompleted;
|
||||
bitmap.DownloadFailed -= BitmapDownloadFailed;
|
||||
|
||||
BeginOpacityAnimation();
|
||||
BeginFadeInAnimation();
|
||||
}
|
||||
|
||||
private void BitmapDownloadFailed(object sender, ExceptionEventArgs e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue