mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 14:08:32 +00:00
Reworked animations
This commit is contained in:
parent
12b33c5376
commit
8708c7ffe6
9 changed files with 159 additions and 85 deletions
32
MapControl/WPF/OpacityHelper.WPF.cs
Normal file
32
MapControl/WPF/OpacityHelper.WPF.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
||||
// Copyright © 2024 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
public static class OpacityHelper
|
||||
{
|
||||
public static async Task SwapOpacities(UIElement topElement, UIElement bottomElement)
|
||||
{
|
||||
topElement.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation
|
||||
{
|
||||
To = 1d,
|
||||
Duration = MapBase.ImageFadeDuration
|
||||
});
|
||||
|
||||
bottomElement.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation
|
||||
{
|
||||
To = 0d,
|
||||
BeginTime = MapBase.ImageFadeDuration,
|
||||
Duration = TimeSpan.Zero
|
||||
});
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue