fix: Make lerping consistent across different FPS

This commit is contained in:
MoonDroid
2025-11-28 19:30:36 -06:00
committed by Abnormal
parent 74e2ff7b85
commit 611280b069
2 changed files with 16 additions and 8 deletions
+10 -7
View File
@@ -1189,14 +1189,17 @@ class PlayState extends MusicBeatSubState
if (health > Constants.HEALTH_MAX) health = Constants.HEALTH_MAX;
if (health < Constants.HEALTH_MIN) health = Constants.HEALTH_MIN;
// Apply camera zoom + multipliers.
if (subState == null && cameraZoomRate > 0.0) // && !isInCutscene)
{
cameraBopMultiplier = FlxMath.lerp(1.0, cameraBopMultiplier, 0.95); // Lerp bop multiplier back to 1.0x
var zoomPlusBop = currentCameraZoom * cameraBopMultiplier; // Apply camera bop multiplier.
if (!debugUnbindCameraZoom) FlxG.camera.zoom = zoomPlusBop; // Actually apply the zoom to the camera.
var decayRate:Float = 0.95;
var dt:Float = elapsed * 60; //
camHUD.zoom = FlxMath.lerp(defaultHUDCameraZoom, camHUD.zoom, 0.95);
if (subState == null && cameraZoomRate > 0.0)
{
cameraBopMultiplier = FlxMath.lerp(1.0, cameraBopMultiplier, Math.pow(decayRate, dt));
var zoomPlusBop = currentCameraZoom * cameraBopMultiplier;
if (!debugUnbindCameraZoom) FlxG.camera.zoom = zoomPlusBop;
camHUD.zoom = FlxMath.lerp(defaultHUDCameraZoom, camHUD.zoom, Math.pow(decayRate, dt));
}
if (currentStage != null && currentStage.getBoyfriend() != null)
+6 -1
View File
@@ -224,7 +224,12 @@ class HealthIcon extends FunkinSprite
{
super.update(elapsed);
if (bopEvery != 0) this.angle = MathUtil.smoothLerpPrecision(this.angle, 0, elapsed, 0.512);
if (bopEvery != 0)
{
var dt:Float = elapsed * 60;
this.angle = MathUtil.smoothLerpPrecision(this.angle, 0, dt, 0.512);
}
this.updatePosition();
}