Event keyframes are special global markers in an animation that signal when certain actions should occur. They allow developers to respond to key moments in the animation with custom logic, such as playing sounds, applying effects, or triggering other actions. For example, you might create an event keyframe named impact to indicate when a character lands from a jump.
You can listen for this event using the API and define the custom logic that should execute when the animation reaches that point.
val blueprintManager = AnimatedPaperAPI.blueprintManager
val blueprint = blueprintManager.getBlueprint("my_blueprint") ?: return
val animation = blueprint.getAnimation("jump") ?: return
animation.onEvent("impact") { rig ->
// Custom logic for when the impact event occurs
// Inflict 5.0 damage to all players in a 10.0 radius.
rig.world.getNearbyEntitiesByType(Player::class.java, rig.location, 10.0)
.forEach { it.damage(5.0) }
}
Event keyframes should only be accessible when plugin mode is enabled, ensuring that this functionality is utilized in the appropriate context.
Event keyframes are special global markers in an animation that signal when certain actions should occur. They allow developers to respond to key moments in the animation with custom logic, such as playing sounds, applying effects, or triggering other actions. For example, you might create an event keyframe named
impact
to indicate when a character lands from a jump.You can listen for this event using the API and define the custom logic that should execute when the animation reaches that point.
Event keyframes should only be accessible when plugin mode is enabled, ensuring that this functionality is utilized in the appropriate context.