Added ContextMenu/Flyout animations. Added platform services. Use bitmap cache for all views.

This commit is contained in:
2025-03-18 09:31:32 -04:00
parent 7c70eb3814
commit 9214e97100
17 changed files with 649 additions and 169 deletions

View File

@@ -0,0 +1,58 @@
using Avalonia;
using Avalonia.Animation;
using Avalonia.Media;
using Avalonia.Styling;
using System;
namespace Harmonia.UI.Animations
{
public static class Animations
{
public static Animation SlideIn(Point start, Point end, long duration = 200)
{
return new()
{
Duration = TimeSpan.FromMilliseconds(duration),
Children =
{
new KeyFrame
{
Cue = new Cue(0f),
Setters =
{
new Setter(Visual.OpacityProperty, 0.0),
new Setter(TranslateTransform.XProperty, start.X),
new Setter(TranslateTransform.YProperty, start.Y)
}
},
new KeyFrame
{
Cue = new Cue(1f),
Setters =
{
new Setter(Visual.OpacityProperty, 1.0),
new Setter(TranslateTransform.XProperty, end.X),
new Setter(TranslateTransform.YProperty, end.Y)
}
}
}
};
}
public static Animation SlideFromRight(double offSet, long duration = 200)
{
Point start = new(-offSet, 0);
Point end = new(0, 0);
return SlideIn(start, end, duration);
}
public static Animation SlideToRight(double offSet, long duration = 200)
{
Point start = new(0, 0);
Point end = new(offSet, 0);
return SlideIn(start, end, duration);
}
}
}