-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All vanilla widgets use this through MixinScrollableBaseWidget
- Loading branch information
1 parent
67686c9
commit 03d25b0
Showing
13 changed files
with
653 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package dev.adventurecraft.awakening; | ||
|
||
public final class MathF { | ||
|
||
public static float cubicInterpolation(float mu, float y0, float y1, float y2, float y3) { | ||
float mu2 = mu * mu; | ||
float a0 = -0.5F * y0 + 1.5F * y1 - 1.5F * y2 + 0.5F * y3; | ||
float a1 = y0 - 2.5F * y1 + 2.0F * y2 - 0.5F * y3; | ||
float a2 = -0.5F * y0 + 0.5F * y2; | ||
return a0 * mu * mu2 + a1 * mu2 + a2 * mu + y1; | ||
} | ||
|
||
public static float lerp(float amount, float start, float end) { | ||
return (1.0F - amount) * start + amount * end; | ||
} | ||
|
||
public static double lerp(double amount, double start, double end) { | ||
return (1.0 - amount) * start + amount * end; | ||
} | ||
|
||
public static double round(double value, int decimals) { | ||
return Math.round(value * decimals) / (double) decimals; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.