A lightweight Minecraft animation library for creating smooth, math-based entity animations without keyframes.
Mathimations allows you to animate Minecraft entities using mathematical functions instead of traditional keyframe systems. Perfect for procedural animations like idle movements, walking cycles, breathing effects, and more.
Instead of defining static keyframes, you write animation logic using sine waves, cosine functions, and other mathematical operations to create smooth, dynamic movements that can adapt to gameplay conditions in real-time.
- Math-Based Animations - Use trigonometric functions and mathematical expressions instead of keyframes
- Smooth Transitions - Automatic blending between animations with configurable transition times
- Layer System - Combine multiple animations simultaneously using layers (e.g., walk + attack + blink)
- Per-Entity & Global Animations - Register animations for specific entities or all entities of a type
- Lightweight - Minimal overhead, only modifies model part transformations
- Animation Sync - Built-in support for synchronized animations across multiple entities
- Utility Functions - Helpers for common animation patterns (leg cycles, timing windows, trigonometric mapping)
- Prefabs - Ready-to-use animations like walking cycles for quick setup
public class IdleAnimation implements IMathAnimation<YourEntity> {
@Override
public float getTransitionTime() {
return 0.4f; // Blend in/out over 0.4 seconds
}
@Override
public void update(YourEntity entity, AnimationContext ctx) {
ModelPartState body = ctx.getPart("body");
if (body == null) return;
// Create a gentle bobbing motion
float time = (float) ctx.getTimeSinceEntityStart();
float bob = (float) Math.sin(time * 2) * 0.05f;
body.translateY(bob);
body.setPitch((float) Math.sin(time) * 0.1f);
}
}// MAKE SURE YOU HAVE Modrinth MAVEN REPOSITORY
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
}
dependencies {
modImplementation "maven.modrinth:mathimations:%VERSION_HERE%"
}- Getting Started Guide - Step-by-step setup instructions
- Full Documentation - Complete API reference and examples
- Example Implementation - Working example code (most up-to-date reference)
- API Reference - Detailed class and method documentation
Mathimations works by manipulating the transformations (position, rotation, scale) of entity model parts during rendering. Since Minecraft shares model instances across all entities of the same type, the system:
- Stores animation state per-entity
- Calculates transformations each frame using your math functions
- Applies transformations just before rendering
- Resets the model after rendering
This approach is perfect for procedural animations that respond to game state, but may not be ideal for complex pre-authored animation sequences.
Organize animations into layers that blend together:
- Layer 0: Base animations (idle, walk)
- Layer 1+: Additive animations (attacks, gestures)
Each layer can have one active animation at a time, with smooth transitions between them.
Contributions are welcome! Feel free to:
- Report bugs via Issues
- Submit feature requests
- Create pull requests
This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the LICENSE file for details.
Created by oxydien for fun and personal projects.
Note: This is a math-based animation system, not magic. It requires understanding of basic trigonometry and Minecraft's entity rendering pipeline. Check out the documentation and examples to get started!