# Animated Button

Creating the Animated button is very easy. It's the same as creating a normal button, but you have to use another method called **createAnimatedButton();** Here is how to do that:

```java
// Create the gui with only a line
McGUI gui = new McGUI("§7Name", GuiLines.ONE_LINE, Main.getInstance());

// Create an item
GUItem item = new GUICustomItem(Material.BARRIER);
// All the item configurations ...

// Create the animation
ItemAnimation animation = new ItemAnimation(0, true);
// All the animation configurations ...

// And create the GUIAnimatedItem
GUIAnimatedItem animatedItem = new GUIAnimatedItem(item, animation);

gui.createAnimatedButton(animatedItem , 0, new GUIButtonEvents(() -> {
    // Left click actions
}, () -> { /* Right click actions */}));
```

If you don't remember how to use the GUIButtonEvents, you can visit the Buttons page in the usage section.
