Configuration Before Sending and Executing Animations to use the animation API you must first configure the keyframes before sending and executing them.
KeyframeAnimationMessageConfig config = new KeyframeAnimationMessageConfig(
titleMessage = "Your Title Message",
subtitleMessage = "Your Subtitle Message",
character = "", // Optionally, specify a character for animation
numberOfFrames = 5 // Specify the number of frames to operate on
);
Player player = event.getPlayer();
KeyframeAnimationMessageConfig config = new KeyframeAnimationMessageConfig(
"Title Message",
"Subtitle Message",
"",
5
);
// Create and dispatch standard the animation
KeyframeAnimationDispatcher instantDispatcher = KeyframeAnimationDispatcher.of(player, config,
KeyframeRenderer.miniMessageRenderer(),
Duration.ofSeconds(10), this
);
instantDispatcher.dispatch();
// Create custom keyframes animation
List<Keyframe> customKeyFrames = List.of(
new Keyframe("S", "s"),
new Keyframe("U", "u"),
new Keyframe("S", "s")
);
KeyframeAnimationMessageConfig customKeyframesConfig = new KeyframeAnimationMessageConfig(
"Start Title",
"Start subtitle",
"",
10,
customKeyFrames
);
KeyframeAnimationDispatcher customDispatcher = KeyframeAnimationDispatcher.of(player, customKeyframesConfig,
KeyframeRenderer.miniMessageRenderer(),
Duration.ofSeconds(20), this
);
customDispatcher.dispatch();
In addition to the primary implementation, several example animations have also been provided, such as:
- Countdown Animation
- Custom Character Animation
- Loading Progress Animation
- Spinning Slash Animation
- Wobble Text Animation
If you are interested in exploring functional programming and its applications within this project visit the repository at vavr-in-action, fp-practice.