Начинающий
- Статус
- Оффлайн
- Регистрация
- 8 Янв 2023
- Сообщения
- 43
- Реакции
- 1
Сливаю вам и так опен сурс который есть в рунете, но малоли кому нужен будет
пример использования
Java:
package air.sense.utils;
import air.sense.utils.math.TimerUtil;
import java.util.ArrayList;
import java.util.List;
public class BetterText {
private List<String> texts = new ArrayList<>();
public String output = "";
private int delay = 0;
public BetterText(List<String> texts, int delay) {
this.texts = texts;
this.delay = delay;
start();
}
private TimerUtil timerUtil = new TimerUtil();
public void start() {
new Thread(() -> {
try {
int index = 0;
while (true) {
for (int i = 0; i < texts.get(index).length(); i++) {
output += texts.get(index).charAt(i);
Thread.sleep(100);
}
Thread.sleep(delay);
for (int i = output.length(); i >= 0; i--) {
output = output.substring(0, i);
Thread.sleep(60);
}
if (index >= texts.size() - 1) {
index = 0;
}
index += 1;
Thread.sleep(400);
}
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
}).start();
}
}
пример использования
Java:
private BetterText text = new BetterText(Arrays.asList("думаю...", "запускаю..."), 800);
Fonts.msMedium[20].drawCenteredString(matrixStack, text.output, width / 2f, height / 2f + 50, ColorUtil.rgba(255, 255, 255, 255));