Skip to content

[FR] Event Keyframes #352

Open
Open

Description

@Dearliet

Image

Event keyframes are special markers in an animation that signal when certain actions should occur. They allow API users 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 then 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

✨ EnhancementNew feature or request🔌 Plugin ModeThis issue pertains to blueprints in plugin mode

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions