mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 03:22:54 +08:00
Improve curve visualisation.
This commit is contained in:
parent
bf63be0602
commit
b999d92ffb
@ -43,8 +43,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
for (int i = 0; i < slider.Curve.Path.Count; ++i)
|
||||
path.Positions.Add(slider.Curve.Path[i]);
|
||||
for (int i = 0; i < slider.Curve.Length; i += 10)
|
||||
path.Positions.Add(slider.Curve.PositionAt(i / slider.Curve.Length));
|
||||
|
||||
path.PathWidth = startCircle.DrawWidth / 4;
|
||||
|
||||
|
@ -44,11 +44,13 @@ namespace osu.Game.Modes.Osu.Objects
|
||||
|
||||
public Vector2 PositionAt(double progress)
|
||||
{
|
||||
int index = (int)(progress * (calculatedPath.Count - 1));
|
||||
progress = MathHelper.Clamp(progress, 0, 1);
|
||||
|
||||
Vector2 pos = calculatedPath[index];
|
||||
if (index != progress)
|
||||
pos += (calculatedPath[index + 1] - pos) * (float)(progress - index);
|
||||
double index = progress * (calculatedPath.Count - 1);
|
||||
|
||||
Vector2 pos = calculatedPath[(int)index];
|
||||
if (index != (int)index)
|
||||
pos += (calculatedPath[(int)index + 1] - pos) * (float)(index - (int)index);
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user