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
@@ -15,6 +15,7 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Draw;
|
||||
@@ -74,10 +75,17 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Stopwatch _SelectTimer = new Stopwatch();
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value && !base.Selected)
|
||||
{
|
||||
_SelectTimer.Restart();
|
||||
}
|
||||
|
||||
base.Selected = value;
|
||||
Text.Selected = value;
|
||||
}
|
||||
@@ -171,6 +179,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);
|
||||
_DrawButton();
|
||||
CBase.Drawing.PopTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
_DrawButton();
|
||||
}
|
||||
}
|
||||
|
||||
private float _GetSelectionScale()
|
||||
{
|
||||
if (!Selected || !_Selectable || !_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 _DrawButton()
|
||||
{
|
||||
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user