public static void renderEvent(Event event) {
DrawGradientRect(new AbstractAnimatedUtils(null, null, null, null
, null, null, null, null, null, null,
null, null
, null, null, null, null, 5, AnimationType.bouncing
), 0, 0, 200, 150);
}
public static void DrawGradientRect(AbstractAnimatedUtils abstractAnimatedUtils, int x, int y, int x2, int y2) {
RenderUtils.drawRect(x, y, x2, y2, abstractAnimatedUtils.GetThis(x, y, x2, y2).GetCurrentThreadAnimationState(x, y, x2, y2));
}
private static class AbstractAnimatedUtils extends Thread {
private Color[] colors;
private AnimationType CurrentAnimationType;
public float Currentanimation, CurrentanimationSpeed;
public AbstractAnimatedUtils(Color colorRed_0, Color colorGreen_0, Color colorBlue_0, Color colorAlpha_0,
Color colorRed_1, Color colorGreen_1, Color colorBlue_1, Color colorAlpha_1,
Color colorRed_2, Color colorGreen_2, Color colorBlue_2, Color colorAlpha_2,
Color colorRed_3, Color colorGreen_3, Color colorBlue_3, Color colorAlpha_3,
float CurrentAnimation, AnimationType currentAnimationType) {
colors = Arrays.asList(colorRed_0, colorGreen_0, colorBlue_0, colorAlpha_0,
colorRed_1, colorGreen_1, colorBlue_1, colorAlpha_1,
colorRed_2, colorGreen_2, colorBlue_2, colorAlpha_2,
colorRed_2, colorGreen_2, colorBlue_2, colorAlpha_2).toArray(new Color[0]);
this.CurrentAnimationType = currentAnimationType;
this.Currentanimation = CurrentAnimation;
start();
}
public AbstractAnimatedUtils GetThis(int x, int y, int x2, int y2) {
return this;
}
public float GetCurrentThreadAnimationState(int x, int y, int x2, int y2) {
return GetThis(x, y, x2, y2).Currentanimation;
}
public void run() {
Update(this);
}
private static void Update(Thread thread) {
if (thread instanceof AbstractAnimatedUtils abstractAnimatedUtils) {
if (!thread.isAlive()) {
AliveThread(thread);
return;
}
abstractAnimatedUtils.Currentanimation = abstractAnimatedUtils.Currentanimation + abstractAnimatedUtils.CurrentanimationSpeed;
}
}
public static void AliveThread(Thread thread) {
thread.start();
}
}
private enum AnimationType {
bouncing("bouncing", Float.intBitsToFloat(0b1000001)), classic("classic", 4.3333336F);
private String name;
AnimationType(String name, float AnimationSpeed) {
this.name = name.concat(String.valueOf(AnimationSpeed));
}
public String GetName() {
return this.name;
}
}