Repository navigation
6. Animations
Maxim edited this page Jan 22, 2025
·
2 revisions
HologramLib provides a basic animation system for text holograms.
TextAnimation animation = new TextAnimation()
.setDelay(20) // Initial delay in ticks (higher number
= longer delay)
.setSpeed(20); // Frame duration in ticks (higher number = slower)
animation.addFrame("Frame 1")
.addFrame("Frame 2")
.addFrame("Frame 3");
hologramManager.applyAnimation(textHologram, animation);TextAnimation typingAnimation = new TextAnimation()
.setDelay(5)
.setSpeed(5);
typingAnimation.addFrame("H")
.addFrame("He")
.addFrame("Hel")
.addFrame("Hell")
.addFrame("Hello");TextAnimation colorAnimation = new TextAnimation()
.setDelay(20)
.setSpeed(20);
colorAnimation.addFrame("<red>Colored Text</red>")
.addFrame("<blue>Colored Text</blue>")
.addFrame("<green>Colored Text</green>")
.addFrame("<yellow>Colored Text</yellow>");// Apply and automatically start the animation
hologramManager.applyAnimation(textHologram, animation);TextAnimation animation = new TextAnimation();
/* Add frames */
animation.addFrame("New Frame");
/* Remove frames */
animation.removeFrame(0); // Remove by index
animation.removeFirstFrame(); // Remove first frame
animation.removeLastFrame(); // Remove last frame
animation.clearFrames(); // Remove all frameshologramManager.cancelAnimation(textHologram);TextAnimation rainbowAnimation = new TextAnimation()
.setDelay(5)
.setSpeed(5);
String[] colors = {"<red>", "<gold>", "<yellow>", "<green>", "<aqua>", "<blue>", "<purple>"};
String text = "Rainbow Text";
for (String color : colors) {
rainbowAnimation.addFrame(color + text);
}TextAnimation scrollAnimation = new TextAnimation()
.setDelay(5)
.setSpeed(5);
String text = "This is scrolling text ";
int length = text.length();
for (int i = 0; i < length; i++) {
String frame = text.substring(i) + text.substring(0, i);
scrollAnimation.addFrame(frame);
}- Creating Holograms - Basic hologram creation
- Hologram Management - Managing hologram instances
- MiniMessage Format - Text formatting guide
