> For the complete documentation index, see [llms.txt](https://mr-mezzo.gitbook.io/mezzos-railroad-blocks/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mr-mezzo.gitbook.io/mezzos-railroad-blocks/custom-elements/custom-railroad-barriers/creating-animations.md).

# Creating animations

We need to create 4 animations:

* OpenIdle - the barrier is in its open state (doing nothing)
* CloseIdle - same here but closed
* Open - barrier is opening
* Close - barrier is closing

1. Head to the animations tab in the top right corner of blockbench
2. Rightclick the animation pannel and create a new animation

<details>

<summary>Example</summary>

<figure><img src="/files/A0r6sYcDw64yvtwFPakR" alt=""><figcaption></figcaption></figure>

</details>

### OpenIdle / CloseIdle

<div align="left"><figure><img src="/files/3JZyVKM0KfC7I6IpORxX" alt="" width="503"><figcaption></figcaption></figure></div>

Make sure to select "Loop"!

1. Select one of your groups you want to animate, on the right
2. Now you can add keyframes in your timeline: Rotation, Position and Scale
3. For this animation, center second 0 in your timeline and create a rotation keyframe by clicking the + icon next to rotation.
4. Type in your rotation stats (for default position X0, Y0, Z0) Rotate the object around the specified axis only. Using a different rotation axis will result in incorrect in-game animations.

<details>

<summary>Example</summary>

<div align="left"><figure><img src="/files/F0buDVeutnCWgAIguilA" alt="" width="455"><figcaption></figcaption></figure></div>

</details>

5. Repeat this for CloseIdle animation. Then only change the rotation stats to the closing state. (Move the barrier with the rotation tool)

### Open / Close

1. Create a new animation with following stats:
   1. Name: animationClose
   2. Loop mode: Hold on Last Frame
   3. Leave the other fields as they are and continue
2. Select one of your groups you want to animate, on the right
3. Now you can add keyframes in your timeline: Rotation, Position and Scale
4. For this animation, center second 0 in your timeline and create a rotation keyframe by clicking the + icon next to rotation. Set it to 0
5. Think about how long the barrier should be closing and center your curser at the second in the timeline
6. Add another keyframe (rotation) and set the stats to closing. Just use the rotation tool for that
7. Repeat this for animationOpen. Just change the first keyframe to the rotation stats closed and add a keyframe again with the stats X0 Y0 and Z0 (open default state)
