| title | Controlling Animation Playback |
|---|---|
| description | Learn how to control the playback of Animations. |
{ $frontmatter.description }
Animation playback is controlled using functions. Each animation has a set of functions that can be called to control it. Animation functions must be ran as the root entity of the Rig Instance.
Starts playing the animation from the beginning.
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/playPauses the animation at the current frame.
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/pauseResumes the animation from the current frame.
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/resumeStops the animation and resets it to the beginning.
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/stopSets the animation to a specific frame with interpolation.
| Name | Type | Description |
|---|---|---|
frame |
Integer | The frame to set the animation to. |
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/apply_frame {frame: 10}Sets the animation to a specific frame instantly without interpolation.
| Name | Type | Description |
|---|---|---|
frame |
Integer | The frame to set the animation to. |
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/set_frame {frame: 10}Pauses all currently playing animations, and smoothly transitions to the target frame of this animation over the duration, then resumes the animation from the target frame.
| Name | Type | Description |
|---|---|---|
to_frame |
Integer | The frame of this animation to tween to. |
duration |
Integer | The duration of the tween in ticks. |
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/tween {to_frame: 10, duration: 20}