Improved animations (#907)
* Smoother countdown and new menu and in-game animations - Countdown digits pop in and fade out each second, with a ring of dots showing the remaining part of the second - Medley countdown uses a smoothed timer and no longer stutters - Rating popups scale in from below and drift upwards while fading out - Player scores pulse briefly at the end of a line - Pause menu fades and scales in and out - Buttons and select slides pulse briefly when they get selected - Shared easing functions and a draw transform for animations * Retrigger CI
This commit is contained in:
1 parent
602417e773
commit
e665e31f4a
17 files changed
+489
-46
No files matched your search
@@ -144,10 +144,17 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Stopwatch _SelectTimer = new Stopwatch();
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value && !base.Selected)
|
||||
{
|
||||
_SelectTimer.Restart();
|
||||
}
|
||||
|
||||
base.Selected = value;
|
||||
|
||||
if (!value)
|
||||
@@ -582,6 +589,38 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
var scale = _GetSelectionScale();
|
||||
if (scale > 1f)
|
||||
{
|
||||
CBase.Drawing.PushTransform(scale, Rect.X + Rect.W / 2f, Rect.Y + Rect.H / 2f, 0f, 1f);
|
||||
_DrawSelectSlide();
|
||||
CBase.Drawing.PopTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
_DrawSelectSlide();
|
||||
}
|
||||
}
|
||||
|
||||
private float _GetSelectionScale()
|
||||
{
|
||||
if (!Selected || !_SelectTimer.IsRunning || CBase.Settings.GetProgramState() == EProgramState.EditTheme)
|
||||
{
|
||||
return 1f;
|
||||
}
|
||||
|
||||
var progress = _SelectTimer.ElapsedMilliseconds / 450f;
|
||||
if (progress >= 1f)
|
||||
{
|
||||
_SelectTimer.Stop();
|
||||
return 1f;
|
||||
}
|
||||
|
||||
return 1f + 0.025f * (float)Math.Sin(Math.PI * progress);
|
||||
}
|
||||
|
||||
private void _DrawSelectSlide()
|
||||
{
|
||||
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user