feat:Add several predefined SizeAnimations.

This commit is contained in:
望尘空忧
2025-08-18 23:11:02 +08:00
parent 2345c8a9de
commit c631c9a871
6 changed files with 201 additions and 67 deletions

View File

@@ -17,38 +17,4 @@ public partial class NavMenuDemo : UserControl
{
InitializeComponent();
}
public static SizeAnimationHelperAnimationGeneratorDelegate NavMenuAnimation { get; } =
(_, oldDesiredSize, newDesiredSize) =>
{
if (oldDesiredSize.Width > newDesiredSize.Width)
newDesiredSize = newDesiredSize.WithWidth(newDesiredSize.Width + 20);
return new Animation
{
Duration = TimeSpan.FromMilliseconds(300),
Easing = new CubicEaseInOut(),
FillMode = FillMode.None,
Children =
{
new KeyFrame
{
Cue = new Cue(0.0),
Setters =
{
new Setter(WidthProperty, oldDesiredSize.Width),
new Setter(HeightProperty, oldDesiredSize.Height)
}
},
new KeyFrame
{
Cue = new Cue(1.0),
Setters =
{
new Setter(WidthProperty, newDesiredSize.Width),
new Setter(HeightProperty, newDesiredSize.Height)
}
}
}
};
};
}