Skip to content

Trigger Animations

liopyu edited this page Aug 30, 2025 · 6 revisions

These methods are available on the player object and allow scripters to trigger animations anywhere directly off the server player.

triggerAnimation(animationName)

Used to trigger animations off a server player. This method can be called from any server player object.

Example Usage:

event.player.triggerAnimation("animationjs:waving")
  • animationName: ResourceLocation - The name of the animation specified in the JSON.

triggerAnimation(animationName, canOverlapSelf)

Used to trigger animations off a server player with the option for animations to overlap themselves when played.

Example Usage:

event.player.triggerAnimation("animationjs:waving", true)
  • animationName: ResourceLocation - The name of the animation specified in the JSON.
  • canOverlapSelf: Boolean - Whether the animation can overlap itself if it's already playing.

triggerAnimation(animationID, transitionLength, easeID, firstPersonEnabled, important)

Used to trigger animations off the server player with customizable animation data.

Example Usage:

event.player.triggerAnimation("animationjs:waving", 1, "linear", true, false);
  • animationID: ResourceLocation - The name of the animation specified in the JSON.
  • transitionLength: int - Duration of the transition length in milliseconds.
  • easeID: String - ID of the easing function to use for animation easing from the Ease class.
  • firstPersonEnabled: Boolean - Whether the animation should be visible in first-person view.
  • important: Boolean - Whether the animation is important and should override other animations.

event.player.triggerAnimation (with part control/modifiers)

  • Description: Used to trigger animations off a server player with part control and modifiers.
  • Example Usage:
    event.player.triggerAnimation("animationjs:smith", 1, "linear", true, false, ["playeranimatorapi:headposboundcamera"], parts => {
      parts.leftArm.setEnabled(false);
    });
  • Parameters:
    • animationID: ResourceLocation - The name of the animation specified in the JSON.
    • transitionLength: int - Duration of the transition length in milliseconds.
    • easeID: String - ID of the easing function to use for animation easing from the dev.kosmx.playerAnim.core.util.Ease class.
    • firstPersonEnabled: boolean - Whether the animation should be visible in first-person view.
    • important: boolean - Whether the animation is important and should override other animations.
    • modifiers: List - List of modifiers to apply to the animation.
    • partsConsumer: Consumer - Consumer to modify player parts such as part visibility, rotation, etc.

event.player.stopAnimation

  • Description: Stops a specified animation for the player.
  • Parameters:
    • animationID: ResourceLocation - The name of the animation to stop.
  • Example:
    event.player.stopAnimation("animationjs:walk");

Clone this wiki locally