From 123a7ae59b2b928006b8e11755c2e0a40a2ba8a4 Mon Sep 17 00:00:00 2001 From: MtH Date: Sat, 15 May 2021 23:39:13 +0200 Subject: [PATCH] boopin boppers.. head lerp --- source/CoolUtil.hx | 6 +++--- source/PlayState.hx | 4 ++-- source/SwagCamera.hx | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/CoolUtil.hx b/source/CoolUtil.hx index 1d5beeff9..4bbcd6bd3 100644 --- a/source/CoolUtil.hx +++ b/source/CoolUtil.hx @@ -57,10 +57,10 @@ class CoolUtil } /* - * just lerp that does camLerpShit for u so u dont have to do it every time + * frame dependant lerp kinda lol */ - public static function coolLerp(a:Float, b:Float, ratio:Float):Float + public static function coolLerp(base:Float, target:Float, ratio:Float):Float { - return FlxMath.lerp(a, b, camLerpShit(ratio)); + return base + camLerpShit(ratio) * (target - base); } } \ No newline at end of file diff --git a/source/PlayState.hx b/source/PlayState.hx index 522755b00..ee63736c1 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1964,8 +1964,8 @@ class PlayState extends MusicBeatState // FlxG.watch.addQuick('VOL', vocals.amplitudeLeft); // FlxG.watch.addQuick('VOLRight', vocals.amplitudeRight); - iconP1.setGraphicSize(Std.int(FlxMath.lerp(150, iconP1.width, 0.85))); - iconP2.setGraphicSize(Std.int(FlxMath.lerp(150, iconP2.width, 0.85))); + iconP1.setGraphicSize(Std.int(CoolUtil.coolLerp(iconP1.width, 150, 0.15))); + iconP2.setGraphicSize(Std.int(CoolUtil.coolLerp(iconP2.width, 150, 0.15))); iconP1.updateHitbox(); iconP2.updateHitbox(); diff --git a/source/SwagCamera.hx b/source/SwagCamera.hx index 826954baf..34efffa9e 100644 --- a/source/SwagCamera.hx +++ b/source/SwagCamera.hx @@ -93,8 +93,10 @@ class SwagCamera extends FlxCamera else { // THIS THE PART THAT ACTUALLY MATTERS LOL - scroll.x += (_scrollTarget.x - scroll.x) * CoolUtil.camLerpShit(followLerp); - scroll.y += (_scrollTarget.y - scroll.y) * CoolUtil.camLerpShit(followLerp); + scroll.x = CoolUtil.coolLerp(scroll.x, _scrollTarget.x, followLerp); + scroll.y = CoolUtil.coolLerp(scroll.y, _scrollTarget.y, followLerp); + // scroll.x += (_scrollTarget.x - scroll.x) * CoolUtil.camLerpShit(followLerp); + // scroll.y += (_scrollTarget.y - scroll.y) * CoolUtil.camLerpShit(followLerp); } } }