feat:Add several predefined SizeAnimations.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user