mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Add smoothing to flashlight movement (#4771)
Add smoothing to flashlight movement Co-authored-by: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
ebfcc8b3ec
@ -7,6 +7,7 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
@ -48,7 +49,14 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||
{
|
||||
FlashlightPosition = e.MousePosition;
|
||||
const double follow_delay = 120;
|
||||
|
||||
var position = FlashlightPosition;
|
||||
var destination = e.MousePosition;
|
||||
|
||||
FlashlightPosition = Interpolation.ValueAt(
|
||||
MathHelper.Clamp(Clock.ElapsedFrameTime, 0, follow_delay), position, destination, 0, follow_delay, Easing.Out);
|
||||
|
||||
return base.OnMouseMove(e);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user