mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-04-21 19:24:00 +00:00
增强Dropdown的动画
This commit is contained in:
@@ -1 +1 @@
|
|||||||
2026-03-25 21:44:57
|
2026-03-26 19:55:43
|
||||||
@@ -1 +1 @@
|
|||||||
b964430
|
b607cee
|
||||||
@@ -190,7 +190,7 @@ namespace CMLeonOS.Gui.UILib
|
|||||||
closeAnimationRunning = true;
|
closeAnimationRunning = true;
|
||||||
|
|
||||||
int currentHeight = popupWindow.Height;
|
int currentHeight = popupWindow.Height;
|
||||||
MovementAnimation animation = new MovementAnimation(popupWindow)
|
MovementAnimation windowAnimation = new MovementAnimation(popupWindow)
|
||||||
{
|
{
|
||||||
From = new Rectangle(popupWindow.X, popupWindow.Y, popupWindow.Width, currentHeight),
|
From = new Rectangle(popupWindow.X, popupWindow.Y, popupWindow.Width, currentHeight),
|
||||||
To = new Rectangle(popupWindow.X, popupWindow.Y, popupWindow.Width, 1),
|
To = new Rectangle(popupWindow.X, popupWindow.Y, popupWindow.Width, 1),
|
||||||
@@ -198,7 +198,20 @@ namespace CMLeonOS.Gui.UILib
|
|||||||
EasingType = EasingType.Sine,
|
EasingType = EasingType.Sine,
|
||||||
EasingDirection = EasingDirection.In
|
EasingDirection = EasingDirection.In
|
||||||
};
|
};
|
||||||
animation.Completed = () =>
|
MovementAnimation tableAnimation = null;
|
||||||
|
if (popupTable != null)
|
||||||
|
{
|
||||||
|
tableAnimation = new MovementAnimation(popupTable)
|
||||||
|
{
|
||||||
|
From = new Rectangle(popupTable.X, popupTable.Y, popupTable.Width, currentHeight),
|
||||||
|
To = new Rectangle(popupTable.X, popupTable.Y, popupTable.Width, 1),
|
||||||
|
Duration = 8,
|
||||||
|
EasingType = EasingType.Sine,
|
||||||
|
EasingDirection = EasingDirection.In
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
windowAnimation.Completed = () =>
|
||||||
{
|
{
|
||||||
if (popupTable != null)
|
if (popupTable != null)
|
||||||
{
|
{
|
||||||
@@ -215,7 +228,8 @@ namespace CMLeonOS.Gui.UILib
|
|||||||
closeAnimationRunning = false;
|
closeAnimationRunning = false;
|
||||||
Render();
|
Render();
|
||||||
};
|
};
|
||||||
animation.Start();
|
windowAnimation.Start();
|
||||||
|
tableAnimation?.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PopupSelected(int index)
|
private void PopupSelected(int index)
|
||||||
@@ -284,7 +298,7 @@ namespace CMLeonOS.Gui.UILib
|
|||||||
popupTable.Render();
|
popupTable.Render();
|
||||||
WM.AddWindow(popupTable);
|
WM.AddWindow(popupTable);
|
||||||
|
|
||||||
MovementAnimation animation = new MovementAnimation(popupWindow)
|
MovementAnimation windowAnimation = new MovementAnimation(popupWindow)
|
||||||
{
|
{
|
||||||
From = new Rectangle(popupWindow.X, popupWindow.Y, popupWindow.Width, 1),
|
From = new Rectangle(popupWindow.X, popupWindow.Y, popupWindow.Width, 1),
|
||||||
To = new Rectangle(popupWindow.X, popupWindow.Y, popupWindow.Width, popupHeight),
|
To = new Rectangle(popupWindow.X, popupWindow.Y, popupWindow.Width, popupHeight),
|
||||||
@@ -292,7 +306,16 @@ namespace CMLeonOS.Gui.UILib
|
|||||||
EasingType = EasingType.Sine,
|
EasingType = EasingType.Sine,
|
||||||
EasingDirection = EasingDirection.Out
|
EasingDirection = EasingDirection.Out
|
||||||
};
|
};
|
||||||
animation.Completed = () =>
|
MovementAnimation tableAnimation = new MovementAnimation(popupTable)
|
||||||
|
{
|
||||||
|
From = new Rectangle(popupTable.X, popupTable.Y, popupTable.Width, 1),
|
||||||
|
To = new Rectangle(popupTable.X, popupTable.Y, popupTable.Width, popupHeight),
|
||||||
|
Duration = 8,
|
||||||
|
EasingType = EasingType.Sine,
|
||||||
|
EasingDirection = EasingDirection.Out
|
||||||
|
};
|
||||||
|
|
||||||
|
windowAnimation.Completed = () =>
|
||||||
{
|
{
|
||||||
if (popupWindow != null)
|
if (popupWindow != null)
|
||||||
{
|
{
|
||||||
@@ -306,7 +329,8 @@ namespace CMLeonOS.Gui.UILib
|
|||||||
popupTable.Render();
|
popupTable.Render();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
animation.Start();
|
windowAnimation.Start();
|
||||||
|
tableAnimation.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override void Render()
|
internal override void Render()
|
||||||
|
|||||||
Reference in New Issue
Block a user