-
Notifications
You must be signed in to change notification settings - Fork 0
Animations
Animations are a simple system, making it easier to modify an object over a certain period of time. Animations work by issuing a new task in the bukkit scheduler, and then triggering a function inside the animation, with the reference to the animated object.
To build an animation you can use the animation, or endlessAnimation builder methods like the following:
val animation = animation<KInventory>(10, 1, TimeUnit.SECONDS) {
onAnimationFrame {
}
}
This will generate an animation, which executed the function 10 times, each time with a 1 second delay. If directly used in a class which supports animations, the generic typings are not required.
The onAnimationFrame method, will be invoked after each given timeUnit period, until the given frames are reached.
If you want the animation to start instantly, without the initial delay, use the startInstant property inside the animation.
Endless animations will never stop, unless stopped by the method.
The current classes in KIA which can be animated are the following: