XAML-Map-Control/MapControl/Avalonia/MapImageLayer.Avalonia.cs

30 lines
753 B
C#
Raw Normal View History

2025-08-19 19:43:02 +02:00
using Avalonia.Animation;
using Avalonia.Styling;
using System.Threading.Tasks;
2025-01-05 09:22:50 +01:00
2026-04-13 17:14:49 +02:00
namespace MapControl;
public partial class MapImageLayer
2025-01-05 09:22:50 +01:00
{
2026-04-13 17:14:49 +02:00
private void FadeOver()
2025-01-05 09:22:50 +01:00
{
2026-04-13 17:14:49 +02:00
var fadeInAnimation = new Animation
2025-01-05 09:22:50 +01:00
{
2026-04-13 17:14:49 +02:00
FillMode = FillMode.Forward,
Duration = MapBase.ImageFadeDuration,
Children =
2025-01-05 09:22:50 +01:00
{
2026-04-13 17:14:49 +02:00
new KeyFrame
2025-01-05 09:22:50 +01:00
{
2026-04-13 17:14:49 +02:00
KeyTime = MapBase.ImageFadeDuration,
Setters = { new Setter(OpacityProperty, 1d) }
2025-01-05 09:22:50 +01:00
}
2026-04-13 17:14:49 +02:00
}
};
2025-01-05 09:22:50 +01:00
2026-04-13 17:14:49 +02:00
_ = fadeInAnimation.RunAsync(Children[1]).ContinueWith(
_ => Children[0].Opacity = 0d,
TaskScheduler.FromCurrentSynchronizationContext());
2025-01-05 09:22:50 +01:00
}
}