1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 14:07:25 +08:00

Add a tween when clicking to seek

This commit is contained in:
Dean Herbert 2019-05-09 18:05:28 +09:00
parent 3f702d13a3
commit 5942072128

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.MathUtils;
namespace osu.Game.Screens.Play
{
@ -107,9 +108,17 @@ namespace osu.Game.Screens.Play
protected override void UpdateValue(float value)
{
var xFill = value * UsableWidth;
fill.Width = xFill;
handleBase.X = xFill;
// handled in update
}
protected override void Update()
{
base.Update();
float newX = (float)Interpolation.Lerp(handleBase.X, NormalizedValue * UsableWidth, Time.Elapsed / 40);
fill.Width = newX;
handleBase.X = newX;
}
protected override void OnUserChange(double value) => OnSeek?.Invoke(value);