1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-23 21:56:46 +00:00

framerate adjusted lerps for all menu shit that isnt cameras

This commit is contained in:
MtH 2021-04-14 04:02:21 +02:00
parent b4274343c5
commit 84be474f15
5 changed files with 19 additions and 16 deletions

View file

@ -224,8 +224,8 @@ class Alphabet extends FlxSpriteGroup
{
var scaledY = FlxMath.remapToRange(targetY, 0, 1, 0, 1.3);
y = FlxMath.lerp(y, (scaledY * 120) + (FlxG.height * 0.48), 0.16);
x = FlxMath.lerp(x, (targetY * 20) + 90, 0.16);
y = CoolUtil.coolLerp(y, (scaledY * 120) + (FlxG.height * 0.48), 0.16);
x = CoolUtil.coolLerp(x, (targetY * 20) + 90, 0.16);
}
super.update(elapsed);

View file

@ -3,6 +3,7 @@ package;
import flixel.FlxG;
import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.math.FlxMath;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.system.FlxAssets.FlxGraphicAsset;
@ -55,6 +56,14 @@ class CoolUtil
return lerp * (FlxG.elapsed / (1 / 60));
}
/*
* just lerp that does camLerpShit for u so u dont have to do it every time
*/
public static function coolLerp(a:Float, b:Float, ratio:Float):Float
{
return FlxMath.lerp(a, b, camLerpShit(ratio));
}
public static function fromAnimate(Source:FlxGraphicAsset, Description:String):FlxAtlasFrames
{
var graphic:FlxGraphic = FlxG.bitmap.add(Source);

View file

@ -26,7 +26,7 @@ class FreeplayState extends MusicBeatState
var scoreText:FlxText;
var diffText:FlxText;
var lerpScore:Int = 0;
var lerpScore:Float = 0;
var intendedScore:Int = 0;
var coolColors:Array<Int> = [
@ -204,13 +204,10 @@ class FreeplayState extends MusicBeatState
}
}
lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.4));
bg.color = FlxColor.interpolate(bg.color, coolColors[songs[curSelected].week % coolColors.length], 0.045);
lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.4);
bg.color = FlxColor.interpolate(bg.color, coolColors[songs[curSelected].week % coolColors.length], CoolUtil.camLerpShit(0.045));
if (Math.abs(lerpScore - intendedScore) <= 10)
lerpScore = intendedScore;
scoreText.text = "PERSONAL BEST:" + lerpScore;
scoreText.text = "PERSONAL BEST:" + Math.round(lerpScore);
positionHighscore();

View file

@ -36,7 +36,7 @@ class MenuItem extends FlxSpriteGroup
override function update(elapsed:Float)
{
super.update(elapsed);
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
y = CoolUtil.coolLerp(y, (targetY * 120) + 480, 0.17);
if (isFlashing)
flashingInt += 1;

View file

@ -228,12 +228,9 @@ class StoryMenuState extends MusicBeatState
override function update(elapsed:Float)
{
// scoreText.setFormat('VCR OSD Mono', 32);
lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.5));
lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.5);
if (Math.abs(lerpScore - intendedScore) <= 10)
lerpScore = intendedScore;
scoreText.text = "WEEK SCORE:" + lerpScore;
scoreText.text = "WEEK SCORE:" + Math.round(lerpScore);
txtWeekTitle.text = weekNames[curWeek].toUpperCase();
txtWeekTitle.x = FlxG.width - (txtWeekTitle.width + 10);
@ -369,7 +366,7 @@ class StoryMenuState extends MusicBeatState
FlxTween.tween(sprDifficulty, {y: leftArrow.y + 15, alpha: 1}, 0.07);
}
var lerpScore:Int = 0;
var lerpScore:Float = 0;
var intendedScore:Int = 0;
function changeWeek(change:Int = 0):Void