Skip to content

api animations

Wundero edited this page Dec 18, 2014 · 5 revisions

Animations

Animations are broken up in several ways. These ways are: Individual frames, sequences of frames and types of animations.

AnimationFrame

An AnimationFrame is one frame in the sequence. Each animation time has text, fade in time, stay time and fade out time. In tab animations and actionbar animations, the times all do the same thing. In title (hovering text), the fade in and out times dictate how long the title fades in and out.

To create an animation frame, the code looks a little like this:

public AnimationFrame createAnimationFrame(String text, int fadeIn, int stay, int fadeOut) {
     return new AnimationFrame(text, fadeIn, stay, fadeOut);
}

FrameSequence

A FrameSequence is a list of frames that plays in order. Each FrameSequence contains a list of AnimationFrames.

To create a frame sequence, the code looks like this:

public FrameSequence createFrameSequence(List<AnimationFrame> frames) {    
    return new FrameSequence(frames);    
}

Animation Types

TitleAnimation

This type of animation is in the hovering text, and is simple enough to create. Keep in mind that you can also input strings as text and it will just display unchanging strings in that section, and this applies to all animation types.

public TitleAnimation createTitleAnimation(FrameSequence title, FrameSequence subtitle) {
    return new TitleAnimation(title, subtitle);
}

TabTitleAnimation

This type of animation is in the text that displays above and below the list of players. Keep in mind that you can also input strings as text and it will just display unchanging strings in that section, and this applies to all animation types.

public TabTitleAnimation createTabTitleAnimation(FrameSequence header, String footer) {
    return new TabTitleAnimation(header, footer);
}

ActionbarTitleAnimation

This type of animation is in the actionbar, which is just above where item tooltips are displayed. Keep in mind that you can also input strings as text and it will just display unchanging strings in that section, and this applies to all animation types.

public ActionbarTitleAnimation createActionbarTitleAnimation(FrameSequence text) {
    return new ActionbarTitleAnimation(text);
}

Sending Animations

To send an animation to a player, it looks exactly the same as regular title objects. Using the .send(player) method will send it to the specified player, but the .broadcast() method will send it to all players on the server.

public void bc(TitleAnimation animation) {
    animation.broadcast();
}

Clone this wiki locally