Skip to content

Commit 5c10181

Browse files
Changed to docs
1 parent 025c3f6 commit 5c10181

File tree

1 file changed

+15
-14
lines changed
  • src/main/java/com/tanishisherewith/dynamichud/helpers/animationhelper/animations

1 file changed

+15
-14
lines changed

src/main/java/com/tanishisherewith/dynamichud/helpers/animationhelper/animations/MathAnimations.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@
66
import net.minecraft.util.math.random.Random;
77

88
public class MathAnimations {
9-
// SHAKE: Random offset animation with smooth decay
9+
/// SHAKE: Random offset animation with smooth decay
1010
public static float shake(float intensity, float frequency, float decay) {
1111
long time = System.currentTimeMillis();
1212
return (float) (Math.sin(time * frequency) *
1313
Math.exp(-decay * time) * intensity);
1414
}
1515

16-
// 2D Shake with different X/Y frequencies
16+
/// 2D Shake with different X/Y frequencies
1717
public static Vec2f shake2D(float intensity, float freqX, float freqY) {
1818
return new Vec2f(
1919
(float) Math.sin(System.currentTimeMillis() * freqX) * intensity,
2020
(float) Math.cos(System.currentTimeMillis() * freqY) * intensity
2121
);
2222
}
2323

24-
// FLICKER: Random flashing effect
24+
/// FLICKER: Random flashing effect
2525
public static float flicker(float min, float max, float chance) {
2626
Random rand = Random.create();
2727
return rand.nextFloat() < chance ?
2828
min + (max - min) * rand.nextFloat() :
2929
max;
3030
}
3131

32-
// CIRCULAR MOTION: Perfect for rotation/orbital animations
32+
/// CIRCULAR MOTION: Perfect for rotation/orbital animations
3333
public static Vec2f circularMotion(float radius, float speed, float phase) {
3434
double angle = Math.toRadians((System.currentTimeMillis() * speed) % 360 + phase);
3535
return new Vec2f(
@@ -38,13 +38,13 @@ public static Vec2f circularMotion(float radius, float speed, float phase) {
3838
);
3939
}
4040

41-
// SAWTOOTH WAVE: Linear rise with sudden drop
41+
/// SAWTOOTH WAVE: Linear rise with sudden drop
4242
public static float sawtooth(float period, float min, float max) {
4343
float phase = (System.currentTimeMillis() % period) / period;
4444
return min + (max - min) * phase;
4545
}
4646

47-
// TRIANGULAR WAVE: Linear rise and fall
47+
/// TRIANGULAR WAVE: Linear rise and fall
4848
public static float triangleWave(float period, float min, float max) {
4949
float halfPeriod = period / 2;
5050
float phase = (System.currentTimeMillis() % period);
@@ -54,20 +54,20 @@ public static float triangleWave(float period, float min, float max) {
5454
return min + (max - min) * value;
5555
}
5656

57-
// BOUNCE: Simulates physical bouncing
57+
/// BOUNCE: Simulates physical bouncing
5858
public static float bounce(float dropHeight, float gravity, float dampening) {
5959
float t = System.currentTimeMillis() / 1000f;
6060
return (float) (dropHeight * Math.abs(Math.sin(t * Math.sqrt(gravity))) *
6161
Math.exp(-dampening * t));
6262
}
6363

64-
// PULSE: Smooth heartbeat-like effect
64+
/// PULSE: Smooth heartbeat-like effect
6565
public static float pulse1(float base, float amplitude, float frequency) {
6666
return (float) (base + amplitude *
6767
(0.5 + 0.5 * Math.sin(System.currentTimeMillis() * frequency)));
6868
}
6969

70-
// SPIRAL: Circular motion with expanding radius
70+
/// SPIRAL: Circular motion with expanding radius
7171
public static Vec2f spiral(float baseRadius, float expansionRate, float speed) {
7272
float t = System.currentTimeMillis() / 1000f;
7373
return new Vec2f(
@@ -76,35 +76,36 @@ public static Vec2f spiral(float baseRadius, float expansionRate, float speed) {
7676
);
7777
}
7878

79-
// Continuous pulsating effect using sine wave
79+
/// Continuous pulsating effect using sine wave
8080
public static float pulse2(float speed, float min, float max) {
8181
return (float) ((Math.sin(System.currentTimeMillis() * speed) + 1) / 2 * (max - min) + min);
8282
}
8383

84-
// Linear interpolation between values over time
84+
/// Linear interpolation between values over time
8585
public static float lerp(float start, float end, long startTime, float duration) {
8686
return lerp(start, end, startTime, duration, EasingType.LINEAR);
8787
}
8888

89+
/// Linear interpolation between values over time with easing
8990
public static float lerp(float start, float end, long startTime, float duration, EasingType easing) {
9091
float progress = (System.currentTimeMillis() - startTime) / duration;
9192
progress = Math.min(1, Math.max(0, progress)); // Clamp 0-1
9293
return start + (end - start) * Easing.apply(easing, progress);
9394
}
9495

95-
// Bouncing animation using quadratic ease-out
96+
/// Bouncing animation using quadratic ease-out
9697
public static float bounce(float start, float end, long startTime, float duration) {
9798
float time = System.currentTimeMillis() - startTime;
9899
time /= duration;
99100
return end * (1 - (time - 1) * (time - 1)) + start;
100101
}
101102

102-
// Continuous rotation using modulo
103+
/// Continuous rotation using modulo
103104
public static float continuousRotation(float speed) {
104105
return (System.currentTimeMillis() % (360_000 / speed)) * (speed / 1000);
105106
}
106107

107-
// Elastic wobble effect
108+
/// Elastic wobble effect
108109
public static float elasticWobble(float speed, float magnitude) {
109110
return (float) (Math.sin(System.currentTimeMillis() * speed) *
110111
Math.exp(-0.001 * System.currentTimeMillis()) * magnitude);

0 commit comments

Comments
 (0)