Item Animations
Items can be animated in panels to cycle through different appearances, such as changing colors or materials. This allows for dynamic, visually engaging menus that update over time.
Animations are defined using the animate
property on an item, and they cycle through a sequence of items before returning to the original item. The items will change at the same speed as the update delay value, by default that is every 20 ticks.
How Animations Work
- The
animate
field defines the next item to display in the animation sequence. - When the item with
animate
is shown in a slot, it will automatically switch to the item defined in theanimate
field after a short interval. - If an item in the sequence does not have an
animate
field, the sequence will reset to the original item and repeat the cycle endlessly. - All commands and interactions triggered by the item will be taken from the original item only. Animated frames do not require commands to be redefined.
Example: Simple Animation Loop
title: 'Example Menu'
type: inventory
rows: 1
layout:
4:
- red_item
items:
red_item:
material: 'RED_WOOL'
name: 'Click to continue'
animate: 'green_item'
green_item:
material: 'LIME_WOOL'
name: 'Click to continue'
animate: 'blue_item'
blue_item:
material: 'BLUE_WOOL'
name: 'Click to continue'
# No animate value, will go back to the original item (red_item)
Explanation:
- The item in slot
4
starts asred_item
. - After a short time, it animates to
green_item
, then toblue_item
. - Since
blue_item
does not have ananimate
value, the animation returns tored_item
, starting the loop again. - The command
say You clicked the menu!
will only be executed when any of the animated items are clicked, as the command is defined only onred_item
.
Animation Behavior Summary
Behavior | Description |
---|---|
animate defined | Item will transition to the defined next item. |
No animate on last item | Resets to the original item, loops animation. |
Commands | Always taken from the original item. |
Other properties (e.g., lore, name) | Defined per animated item; only visuals change unless stated otherwise. |
Best Practices
- Keep animated items simple — only define
material
,name
, orlore
if needed. - Do not duplicate commands in animated items.
- Use animations to create visual interest or feedback loops, like pulsing colors or indicating activity.
Longer Animation Chains
Animations can be as short or as long as desired.
Example with 5-frame animation:
items:
frame1:
material: 'RED_WOOL'
name: 'Click Me'
animate: 'frame2'
actions:
commands:
- '[msg] Item has been clicked.'
frame2:
material: 'ORANGE_WOOL'
name: 'Click Me'
animate: 'frame3'
frame3:
material: 'YELLOW_WOOL'
name: 'Click Me'
animate: 'frame4'
frame4:
material: 'LIME_WOOL'
name: 'Click Me'
animate: 'frame5'
frame5:
material: 'BLUE_WOOL'
name: 'Click Me'
# No animate value; loops back to frame1