Skip to content

Commit

Permalink
Better inverting
Browse files Browse the repository at this point in the history
  • Loading branch information
MEEPofFaith committed Feb 24, 2024
1 parent 36e4f5b commit e8ece9b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/drunkustry/graphics/DrunkRendering.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import static arc.Core.*;
import static drunkustry.graphics.DrunkShaders.*;
import static mindustry.Vars.*;

public class DrunkRendering{
public static final float begin = Layer.min;
Expand Down Expand Up @@ -56,11 +57,12 @@ private static void initInversion(){
Draw.draw(begin, () -> inversion.begin());
Draw.draw(end, () -> {
float t = Time.time / 60f * Mathf.PI / 4f * settings.getFloat("du-inversion", 1f);
inversion.lerp = (Mathf.absin(t, 1f, 1f) + //TODO better lerp. Gets stuck in middle.
Mathf.absin(t, 1.3f, 1f) +
Mathf.absin(t, 1.7f, 1f) +
Mathf.absin(t, 0.5f, 1f) +
Mathf.absin(t, 0.8f, 1f)) / 5f;
float s = Mathf.sin(t, 1f, 1f) +
Mathf.sin(t, 1.3f, 1f) +
Mathf.sin(t, 1.7f, 1f) +
Mathf.sin(t, 0.5f, 1f) +
Mathf.sin(t, 0.8f, 1f);
if(!state.isPaused()) inversion.lerp = Mathf.clamp(inversion.lerp + s / 5f / 10f * Time.delta, 0f, 1f);
inversion.end();
});
});
Expand Down

0 comments on commit e8ece9b

Please sign in to comment.