> ## Documentation Index
> Fetch the complete documentation index at: https://entities.lodemc.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Model Animation

> Play and stop a model's animations, lock its rotation, and add or remove models at runtime.

Plays animations from your Blockbench model on any trigger: a wind-up before an attack, a roar on spawn, a stagger when hurt.

```yaml theme={null}
- animation{name=roar;loop=once} +onSpawn @self
- animation{name=slam;loop=once;speed=1.5} +onAttack @self
- stopanimation{name=walk} +onDeath @self
```

| Mechanic | Usage | What it does |
| :- | :- | :- |
| `animation` <sub>also anim, playanim, state, mstate, modelstate</sub> | `animation{name=<animation>;loop=once\|loop\|hold;speed=1;model=<model>;lerpin=0;lerpout=0}` | Plays an animation from the target's model. |
| `stopanimation` <sub>also stopanim, animationstop</sub> | `stopanimation{name=<animation>}` | Stops a model animation on the target. |
| `lockmodel` <sub>also modellock</sub> | `lockmodel{lock=true}` | Stops the model turning with the entity, or lets it turn again. |
| `model` <sub>also setmodel</sub> | `model{mid=<model id>;remove=false}` | Adds a model to the target at runtime, or removes one with `remove=true`. |
| `playanimation` <sub>also effect:playanimation, playarmanimation</sub> | `playAnimation{animation=<name>}` | Plays a vanilla arm or entity animation, or a model animation when given `model=`, `name=`, or a name the game doesn't have. |

## animation options

| Option | Also | Default | What it does |
| :- | :- | :- | :- |
| `name` | `a`, `anim`, `animation`, `s`, `state` | — | The animation, as named in the `.bbmodel`. Also accepted positionally: `animation roar`. |
| `loop` | `type`, `mode` | the animation's own | `once`, `loop` or `hold` (freeze on the last frame). `true` and `false` work too. |
| `speed` | `sp` | `1` | Playback multiplier. |
| `model` | `m`, `mid` | every model on the target | Restrict it to one model, for an entity wearing more than one. |
| `lerpin` | `blendin`, `li` | `0` | Ticks blended in at the start, so it eases in instead of snapping. |
| `lerpout` | `blendout`, `lo` | `0` | Ticks blended out at the end. |

## Coming from Model Engine

Model Engine's spelling parses unchanged: `state{s=attack;li=2;lo=2}` is `animation{name=attack;lerpin=2;lerpout=2}`. A Model Engine `model{mid=…}` line on an imported mob becomes the mob's `model:` field instead; see [MythicMobs](https://entities.lodemc.net/mythicmobs.md).

## Notes

* Targets with no model are skipped silently, so one skill can be shared between modelled and plain mobs.
* An animation the model doesn't have does nothing, so a typo shows up as nothing happening. [`/le test <mob> <animation>`](test-model) autocompletes the real names and plays one without any effect lines.
* The model is attached **before** `+onSpawn` runs, so animating a mob the moment it appears works.
* How fast the automatic animations (`idle`, `walk`, …) play is a mob field, `animation-speed`; see [Mob Stats](https://entities.lodemc.net/mob-fields.md).
* The reverse direction, running a skill **from** a frame of an animation, is a keyframe in Blockbench: see [Animating Your Model](https://entities.lodemc.net/animating-a-model.md#effects-on-an-animation-frame).
* Addons can drive animations directly through the engine's own API; see [Models & Animation](https://entities.lodemc.net/addon-models.md#animations).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.